mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 05:25:54 +00:00
Map Triggers
This commit is contained in:
parent
5ce2ffb48e
commit
054c0998ad
34 changed files with 5896 additions and 477 deletions
|
|
@ -41,6 +41,11 @@ public partial class BlackCover : Sprite2D, IActivable
|
|||
UpdateSprite();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private void UpdateSprite()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,4 +131,9 @@ public partial class BulletEmitter : Node2D, IActivable
|
|||
EmitSignal(SignalName.StateChanged, IsEmitting);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +63,11 @@ public partial class ScriptableBase : Node2D, IActivable
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
public bool CanActivate()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,4 +30,9 @@ public partial class ActorSpawner : Node2D, IActivable
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -164,6 +164,11 @@ public partial class Boss : Enemy, IActivable, IScriptHost
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private async Task Switchphase(BossPhase phase)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
[Tool]
|
||||
public partial class Elevator3D : PathFollow3D, IActivable
|
||||
{
|
||||
[Export] public float Speed { get; set; }
|
||||
|
|
@ -11,6 +12,7 @@ public partial class Elevator3D : PathFollow3D, IActivable
|
|||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
if (!_isMoving) return;
|
||||
|
||||
ProgressRatio += (Speed * (float)delta) * _multiplier;
|
||||
|
|
@ -24,12 +26,18 @@ public partial class Elevator3D : PathFollow3D, IActivable
|
|||
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return false;
|
||||
if (_isMoving) return false;
|
||||
|
||||
StartMoving();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
public void StartMoving()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,36 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
[Tool]
|
||||
public partial class ElevatorProxy3D : Path3D, IActivable
|
||||
{
|
||||
[Export] public StringName TargetName { get; set; }
|
||||
[Export] public Elevator3D Elevator { get; private set; }
|
||||
public bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
if (Engine.IsEditorHint()) return false;
|
||||
return Elevator.Activate(activationType);
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
public void _func_godot_apply_properties(Dictionary props)
|
||||
{
|
||||
TargetName = (string)props["targetname"];
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
if (!string.IsNullOrWhiteSpace(TargetName))
|
||||
{
|
||||
this.AddToGroup(TargetName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -149,4 +149,9 @@ public partial class RogueliteEnemySpawner : Marker2D, IActivable
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,11 @@ public partial class ScriptableBulletsEmitter : Node2D, IActivable, IScriptHost
|
|||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (!_isActive) return;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public partial class ElevatorProxy : Area2D, IActivable
|
|||
EmitSignal(SignalName.Activated, (int)activationType);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private void _on_area_entered(Area2D area)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,4 +18,9 @@ public partial class ElevatorProxyProxy : Path2D, IActivable
|
|||
{
|
||||
return _elevatorProxy.Activate(activationType);
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -71,4 +71,9 @@ public partial class EnemyFSMProxy : CharacterBody2D, IActivable
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
public interface IActivable
|
||||
{
|
||||
bool Activate(ActivationType activationType = ActivationType.Toggle);
|
||||
void Toggle();
|
||||
}
|
||||
|
||||
public enum ActivationType
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ public partial class CheckpointAnimation : Node2D, IActivable
|
|||
return true;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private async Task AnimateAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue