mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Alarm trigger enhancements
This commit is contained in:
parent
9f89246425
commit
d0baa87bba
9 changed files with 80 additions and 20 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Cirno.Scripts;
|
||||
using Godot.Collections;
|
||||
|
||||
public partial class Camera : Enemy
|
||||
{
|
||||
|
|
@ -8,6 +9,8 @@ public partial class Camera : Enemy
|
|||
|
||||
private AlarmManager _alarmManager;
|
||||
|
||||
[Export] public Array<Node2D> AlarmActivationTargets { get; private set; }
|
||||
|
||||
///private AlarmManager _alarmManager;
|
||||
|
||||
public override void _Ready()
|
||||
|
|
|
|||
|
|
@ -8,9 +8,13 @@ public partial class AlarmTrigger : Node2D
|
|||
|
||||
[Export]
|
||||
public AlarmTriggerType TriggerType { get; private set; }
|
||||
|
||||
[Export] public float ActivationRange { get; private set; } = 200f;
|
||||
|
||||
[Export]
|
||||
public Node2D Target { get; private set; }
|
||||
|
||||
[Export] public ActivationType ActivationType { get; private set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -32,14 +36,17 @@ public partial class AlarmTrigger : Node2D
|
|||
|
||||
private void AlarmManagerOnAlarmEnabled(Vector2 location)
|
||||
{
|
||||
Activate();
|
||||
if (this.GlobalPosition.DistanceTo(location) <= ActivationRange)
|
||||
{
|
||||
Activate();
|
||||
}
|
||||
}
|
||||
|
||||
private void Activate()
|
||||
{
|
||||
if (Target is IActivable activatable)
|
||||
{
|
||||
activatable.Activate();
|
||||
activatable.Activate(ActivationType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue