49 lines
871 B
C#
49 lines
871 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.Collections;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Puzzles/ButtonCheck.cs")]
|
|
public partial class ButtonCheck : Node2D
|
|
{
|
|
[Signal]
|
|
public delegate void TriggerEventHandler();
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private PuzzleButton[] buttons;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Array<SaveFile.Flags> flag;
|
|
|
|
|
|
public override void _Ready()
|
|
{
|
|
if (SaveFile.HasFlags(flag))
|
|
{
|
|
base.ProcessMode = ProcessModeEnum.Disabled;
|
|
QueueFree();
|
|
}
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
for (int i = 0; i < buttons.Length; i++)
|
|
{
|
|
if (!buttons[i].active)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
foreach (SaveFile.Flags item in flag)
|
|
{
|
|
SaveFile.AddFlag(item);
|
|
}
|
|
EmitSignal(SignalName.Trigger);
|
|
_Ready();
|
|
}
|
|
|
|
}
|