mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 05:55:55 +00:00
Changed events to generic node
This commit is contained in:
parent
b89043cd8c
commit
7b2d32e727
17 changed files with 166 additions and 135 deletions
|
|
@ -7,21 +7,36 @@ namespace Cirno.Scripts.Resources.Events;
|
|||
public partial class AlarmEnableEvent : EventResource
|
||||
{
|
||||
private bool _isComplete = false;
|
||||
private AlarmManager _alarmManager;
|
||||
|
||||
|
||||
public override bool IsComplete()
|
||||
{
|
||||
return _isComplete;
|
||||
}
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
public override void Init(Node parent)
|
||||
{
|
||||
_alarmManager = parent.GetAlarmManager();
|
||||
|
||||
}
|
||||
|
||||
public override void Start(Node2D parent)
|
||||
public override void Start(Node parent)
|
||||
{
|
||||
_alarmManager.SoundAlarm(parent.GlobalPosition);
|
||||
if (AlarmManager.Instance is null)
|
||||
{
|
||||
_isComplete = true;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (parent)
|
||||
{
|
||||
case Node2D node2D:
|
||||
AlarmManager.Instance.SoundAlarm(node2D.GlobalPosition);
|
||||
break;
|
||||
case Node3D node3D:
|
||||
AlarmManager.Instance.SoundAlarm(node3D.GlobalPosition);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
_isComplete = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue