mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 09:13:48 +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
74
Scripts/Activables/ScriptableBase3D.cs
Normal file
74
Scripts/Activables/ScriptableBase3D.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
using Cirno.Scripts.Resources.Events;
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
|
namespace Cirno.Scripts.Activables;
|
||||||
|
|
||||||
|
public partial class ScriptableArea3D : Area3D, IActivable
|
||||||
|
{
|
||||||
|
[Export] public Array<EventResource> Events { get; set; } = [];
|
||||||
|
|
||||||
|
private EventResource CurrentEvent => Events[_currentEventIndex];
|
||||||
|
|
||||||
|
private int _currentEventIndex = 0;
|
||||||
|
|
||||||
|
private bool _started = false;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
foreach (var item in Events)
|
||||||
|
{
|
||||||
|
item.Init(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
_started = true;
|
||||||
|
StartEvent(CurrentEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartEvent(EventResource eventResource)
|
||||||
|
{
|
||||||
|
eventResource.Start(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
if (!_started) return;
|
||||||
|
|
||||||
|
CurrentEvent.UpdateEvent(delta);
|
||||||
|
|
||||||
|
if (!CurrentEvent.WaitForCompletion || CurrentEvent.IsComplete())
|
||||||
|
{
|
||||||
|
// This loops
|
||||||
|
_currentEventIndex++;
|
||||||
|
if (_currentEventIndex >= Events.Count)
|
||||||
|
{
|
||||||
|
// It's over
|
||||||
|
_started = false;
|
||||||
|
_currentEventIndex = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentEvent.Start(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||||
|
{
|
||||||
|
Start();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Toggle()
|
||||||
|
{
|
||||||
|
this.Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanActivate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
Scripts/Activables/ScriptableBase3D.cs.uid
Normal file
1
Scripts/Activables/ScriptableBase3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cpwn25m6b4lqf
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Cirno.Scripts;
|
namespace Cirno.Scripts;
|
||||||
|
|
||||||
public partial class AlarmManager : Node2D
|
public partial class AlarmManager : Node
|
||||||
{
|
{
|
||||||
[Export]
|
[Export]
|
||||||
public AudioStream AlarmSound { get; private set; }
|
public AudioStream AlarmSound { get; private set; }
|
||||||
|
|
@ -12,10 +12,14 @@ public partial class AlarmManager : Node2D
|
||||||
public bool IsAlarmOn { get; private set; } = false;
|
public bool IsAlarmOn { get; private set; } = false;
|
||||||
|
|
||||||
public Vector2 LastAlarmPosition { get; private set; } = new Vector2();
|
public Vector2 LastAlarmPosition { get; private set; } = new Vector2();
|
||||||
|
public Vector3 LastAlarmPosition3D { get; private set; } = new Vector3();
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void AlarmEnabledEventHandler(Vector2 location);
|
public delegate void AlarmEnabledEventHandler(Vector2 location);
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void AlarmEnabled3DEventHandler(Vector3 location);
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void AlarmDisabledEventHandler();
|
public delegate void AlarmDisabledEventHandler();
|
||||||
|
|
||||||
|
|
@ -40,7 +44,18 @@ public partial class AlarmManager : Node2D
|
||||||
if (IsAlarmOn) return;
|
if (IsAlarmOn) return;
|
||||||
IsAlarmOn = true;
|
IsAlarmOn = true;
|
||||||
LastAlarmPosition = location;
|
LastAlarmPosition = location;
|
||||||
EmitSignal(nameof(AlarmEnabled), location);
|
EmitSignalAlarmEnabled(location);
|
||||||
|
|
||||||
|
GD.Print($"Alarm sounded at {location}");
|
||||||
|
_player?.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SoundAlarm(Vector3 location)
|
||||||
|
{
|
||||||
|
if (IsAlarmOn) return;
|
||||||
|
IsAlarmOn = true;
|
||||||
|
LastAlarmPosition3D = location;
|
||||||
|
EmitSignalAlarmEnabled3D(location);
|
||||||
|
|
||||||
GD.Print($"Alarm sounded at {location}");
|
GD.Print($"Alarm sounded at {location}");
|
||||||
_player?.Play();
|
_player?.Play();
|
||||||
|
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
using Cirno.Scripts.Misc;
|
|
||||||
using Godot;
|
|
||||||
|
|
||||||
namespace Cirno.Scripts.Resources.Events._3D;
|
|
||||||
|
|
||||||
[GlobalClass]
|
|
||||||
public partial class GenericDialogueStartEvent : EventResource
|
|
||||||
{
|
|
||||||
[Export] public StringName TimelineName = "timeline";
|
|
||||||
private Node _dialogic;
|
|
||||||
private GameManager _gameManager;
|
|
||||||
private bool _isComplete = false;
|
|
||||||
|
|
||||||
private DialogueSkipListener _listener;
|
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
|
||||||
{
|
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
_dialogic = parent.GetNode("/root/Dialogic");
|
|
||||||
_dialogic.ProcessMode = Node.ProcessModeEnum.Always;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
|
||||||
{
|
|
||||||
if (GlobalState.Instance.SessionSettings.SkipDialogues)
|
|
||||||
{
|
|
||||||
DialogueEndAction();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateSkipListener(parent);
|
|
||||||
|
|
||||||
Hud.Instance?.HideHud();
|
|
||||||
|
|
||||||
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
|
||||||
|
|
||||||
var dialogicNode =_dialogic.Call("start", TimelineName.ToString());
|
|
||||||
((Node)dialogicNode).ProcessMode = Node.ProcessModeEnum.Always;
|
|
||||||
_gameManager.ChangeState(GameState.Dialogue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateSkipListener(Node2D parent)
|
|
||||||
{
|
|
||||||
_listener = new DialogueSkipListener();
|
|
||||||
parent.AddChild(_listener);
|
|
||||||
_listener.ProcessMode = Node.ProcessModeEnum.Always;
|
|
||||||
_listener.Skipped += ListenerOnSkipped;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ListenerOnSkipped()
|
|
||||||
{
|
|
||||||
_listener.Skipped -= ListenerOnSkipped;
|
|
||||||
_listener.QueueFree();
|
|
||||||
_dialogic.Call("end_timeline");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTimelineEnded()
|
|
||||||
{
|
|
||||||
Hud.Instance?.ShowHud();
|
|
||||||
_gameManager.ChangeState(GameState.Playing);
|
|
||||||
if (_dialogic.IsConnected("timeline_ended", Callable.From(OnTimelineEnded)))
|
|
||||||
{
|
|
||||||
_dialogic.Disconnect("timeline_ended", Callable.From(OnTimelineEnded));
|
|
||||||
}
|
|
||||||
|
|
||||||
DialogueEndAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DialogueEndAction()
|
|
||||||
{
|
|
||||||
_isComplete = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void UpdateEvent(double delta)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsComplete()
|
|
||||||
{
|
|
||||||
return _isComplete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://no0it4lihfx
|
|
||||||
|
|
@ -10,7 +10,7 @@ public partial class ActivateEvent : EventResource
|
||||||
|
|
||||||
[Export] public Array<NodePath> Targets;
|
[Export] public Array<NodePath> Targets;
|
||||||
|
|
||||||
private Node2D _parent;
|
private Node _parent;
|
||||||
|
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
|
|
||||||
|
|
@ -37,12 +37,12 @@ public partial class ActivateEvent : EventResource
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
ActivateTargets();
|
ActivateTargets();
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,25 @@ namespace Cirno.Scripts.Resources.Events;
|
||||||
public partial class AlarmDisableEvent : EventResource
|
public partial class AlarmDisableEvent : EventResource
|
||||||
{
|
{
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
private AlarmManager _alarmManager;
|
|
||||||
|
|
||||||
public override bool IsComplete()
|
public override bool IsComplete()
|
||||||
{
|
{
|
||||||
return _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.DisableAlarm();
|
if (AlarmManager.Instance is null)
|
||||||
|
{
|
||||||
|
_isComplete = true;
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
AlarmManager.Instance.DisableAlarm();
|
||||||
_isComplete = true;
|
_isComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,36 @@ namespace Cirno.Scripts.Resources.Events;
|
||||||
public partial class AlarmEnableEvent : EventResource
|
public partial class AlarmEnableEvent : EventResource
|
||||||
{
|
{
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
private AlarmManager _alarmManager;
|
|
||||||
|
|
||||||
public override bool IsComplete()
|
public override bool IsComplete()
|
||||||
{
|
{
|
||||||
return _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;
|
_isComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public partial class CameraTargetEvent : CameraTargetPlayerEvent
|
||||||
[Export]
|
[Export]
|
||||||
public Vector2 Offset { get; private set; }
|
public Vector2 Offset { get; private set; }
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
GameManager.Instance.CameraTargetObject(parent.GetNode<Node2D>(Target), Offset);
|
GameManager.Instance.CameraTargetObject(parent.GetNode<Node2D>(Target), Offset);
|
||||||
_isComplete = true;
|
_isComplete = true;
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@ public partial class CameraTargetPlayerEvent : EventResource
|
||||||
{
|
{
|
||||||
protected bool _isComplete = false;
|
protected bool _isComplete = false;
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
GameManager.Instance.CameraTargetPlayer();
|
GameManager.Instance.CameraTargetPlayer();
|
||||||
_isComplete = true;
|
_isComplete = true;
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,20 @@ public partial class ControlActorEvent : EventResource
|
||||||
[Export]
|
[Export]
|
||||||
public NodePath Target { get; set; }
|
public NodePath Target { get; set; }
|
||||||
|
|
||||||
private Node2D _parent;
|
private Node _parent;
|
||||||
|
|
||||||
private GameManager _gameManager;
|
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
public override bool IsComplete()
|
public override bool IsComplete()
|
||||||
{
|
{
|
||||||
return _isComplete;
|
return _isComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parentNode)
|
public override void Start(Node parentNode)
|
||||||
{
|
{
|
||||||
_isComplete = false;
|
_isComplete = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,28 +8,27 @@ public partial class ControlEnemyEvent : EventResource
|
||||||
[Export]
|
[Export]
|
||||||
public NodePath Target { get; set; }
|
public NodePath Target { get; set; }
|
||||||
|
|
||||||
private Node2D _parent;
|
private Node _parent;
|
||||||
|
|
||||||
private GameManager _gameManager;
|
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
public override bool IsComplete()
|
public override bool IsComplete()
|
||||||
{
|
{
|
||||||
return _isComplete;
|
return _isComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parentNode)
|
public override void Start(Node parentNode)
|
||||||
{
|
{
|
||||||
_isComplete = false;
|
_isComplete = false;
|
||||||
|
|
||||||
if (_parent.GetNode<Node2D>(Target) is Enemy enemy)
|
if (_parent.GetNode<Node2D>(Target) is Enemy enemy)
|
||||||
{
|
{
|
||||||
_gameManager.CameraTargetObject(enemy);
|
GameManager.Instance.CameraTargetObject(enemy);
|
||||||
GameManager.Instance.Player.SetState(PlayerState.Controlling);
|
GameManager.Instance.Player.SetState(PlayerState.Controlling);
|
||||||
// _gameManager.Player.RequestMovementDisable(true);
|
// _gameManager.Player.RequestMovementDisable(true);
|
||||||
enemy.AssumeControl();
|
enemy.AssumeControl();
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,17 @@ public partial class DialogueStartEvent : EventResource
|
||||||
{
|
{
|
||||||
[Export] public StringName TimelineName = "timeline";
|
[Export] public StringName TimelineName = "timeline";
|
||||||
private Node _dialogic;
|
private Node _dialogic;
|
||||||
private GameManager _gameManager;
|
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
|
|
||||||
private DialogueSkipListener _listener;
|
private DialogueSkipListener _listener;
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
_dialogic = parent.GetNode("/root/Dialogic");
|
_dialogic = parent.GetNode("/root/Dialogic");
|
||||||
_dialogic.ProcessMode = Node.ProcessModeEnum.Always;
|
_dialogic.ProcessMode = Node.ProcessModeEnum.Always;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
if (GlobalState.Instance.SessionSettings.SkipDialogues)
|
if (GlobalState.Instance.SessionSettings.SkipDialogues)
|
||||||
{
|
{
|
||||||
|
|
@ -36,10 +34,22 @@ public partial class DialogueStartEvent : EventResource
|
||||||
|
|
||||||
var dialogicNode =_dialogic.Call("start", TimelineName.ToString());
|
var dialogicNode =_dialogic.Call("start", TimelineName.ToString());
|
||||||
((Node)dialogicNode).ProcessMode = Node.ProcessModeEnum.Always;
|
((Node)dialogicNode).ProcessMode = Node.ProcessModeEnum.Always;
|
||||||
_gameManager.ChangeState(GameState.Dialogue);
|
ChangeState(GameState.Dialogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateSkipListener(Node2D parent)
|
private void ChangeState(GameState state)
|
||||||
|
{
|
||||||
|
if (GameManager.Instance is not null)
|
||||||
|
{
|
||||||
|
GameManager.Instance.ChangeState(state);
|
||||||
|
}
|
||||||
|
else if (GameController.Instance is not null)
|
||||||
|
{
|
||||||
|
GameController.Instance.ChangeState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateSkipListener(Node parent)
|
||||||
{
|
{
|
||||||
_listener = new DialogueSkipListener();
|
_listener = new DialogueSkipListener();
|
||||||
parent.AddChild(_listener);
|
parent.AddChild(_listener);
|
||||||
|
|
@ -57,7 +67,7 @@ public partial class DialogueStartEvent : EventResource
|
||||||
private void OnTimelineEnded()
|
private void OnTimelineEnded()
|
||||||
{
|
{
|
||||||
Hud.Instance?.ShowHud();
|
Hud.Instance?.ShowHud();
|
||||||
_gameManager.ChangeState(GameState.Playing);
|
ChangeState(GameState.Playing);
|
||||||
if (_dialogic.IsConnected("timeline_ended", Callable.From(OnTimelineEnded)))
|
if (_dialogic.IsConnected("timeline_ended", Callable.From(OnTimelineEnded)))
|
||||||
{
|
{
|
||||||
_dialogic.Disconnect("timeline_ended", Callable.From(OnTimelineEnded));
|
_dialogic.Disconnect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ namespace Cirno.Scripts.Resources.Events;
|
||||||
public abstract partial class EventResource : Resource
|
public abstract partial class EventResource : Resource
|
||||||
{
|
{
|
||||||
[Export] public bool WaitForCompletion = true;
|
[Export] public bool WaitForCompletion = true;
|
||||||
public abstract void Init(Node2D parent);
|
public abstract void Init(Node parent);
|
||||||
public abstract void Start(Node2D parent);
|
public abstract void Start(Node parent);
|
||||||
public abstract void UpdateEvent(double delta);
|
public abstract void UpdateEvent(double delta);
|
||||||
public abstract bool IsComplete();
|
public abstract bool IsComplete();
|
||||||
}
|
}
|
||||||
|
|
@ -26,14 +26,13 @@ public partial class MovePlayerEvent : EventResource
|
||||||
|
|
||||||
private bool _isComplete = false;
|
private bool _isComplete = false;
|
||||||
|
|
||||||
private GameManager _gameManager;
|
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parentNode)
|
public override void Start(Node parentNode)
|
||||||
{
|
{
|
||||||
_isComplete = false;
|
_isComplete = false;
|
||||||
_ = MovePlayer();
|
_ = MovePlayer();
|
||||||
|
|
@ -45,8 +44,8 @@ public partial class MovePlayerEvent : EventResource
|
||||||
//_gameManager.Player.RequestMovementDisable(true);
|
//_gameManager.Player.RequestMovementDisable(true);
|
||||||
|
|
||||||
var gtween = GTweenSequenceBuilder.New()
|
var gtween = GTweenSequenceBuilder.New()
|
||||||
.Append(_gameManager.Player.MainObject.TweenGlobalPosition(
|
.Append(GameManager.Instance.Player.MainObject.TweenGlobalPosition(
|
||||||
_gameManager.Player.MainObject.GlobalPosition + RelativeTargetPosition, MovementTime)
|
GameManager.Instance.Player.MainObject.GlobalPosition + RelativeTargetPosition, MovementTime)
|
||||||
.SetEasing(GTweenEasing)
|
.SetEasing(GTweenEasing)
|
||||||
//.
|
//.
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,18 @@ namespace Cirno.Scripts.Resources.Events;
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
public partial class UpdateCheckPointEvent : EventResource
|
public partial class UpdateCheckPointEvent : EventResource
|
||||||
{
|
{
|
||||||
private GameManager _gameManager;
|
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public NodePath Target { get; set; }
|
public NodePath Target { get; set; }
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager = parent.GetGameManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
_gameManager.LastCheckpointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
GameManager.Instance.LastCheckpointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
||||||
// _gameManager.Player.LastCheckPointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
// _gameManager.Player.LastCheckPointPosition = parent.GetNode<Node2D>(Target).GlobalPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ public partial class WaitEvent : EventResource
|
||||||
public float WaitTime { get; set; }
|
public float WaitTime { get; set; }
|
||||||
protected bool _isComplete = false;
|
protected bool _isComplete = false;
|
||||||
|
|
||||||
public override void Init(Node2D parent)
|
public override void Init(Node parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start(Node2D parent)
|
public override void Start(Node parent)
|
||||||
{
|
{
|
||||||
_ = Wait();
|
_ = Wait();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue