mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 00:35:55 +00:00
Triggerable acid
This commit is contained in:
parent
e85a4afa3f
commit
796f70b69a
16 changed files with 1329 additions and 968 deletions
43
Scripts/Components/FSM/3DPlayer/PlayerAcidDeathModule.cs
Normal file
43
Scripts/Components/FSM/3DPlayer/PlayerAcidDeathModule.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM._3DPlayer;
|
||||
|
||||
public partial class PlayerAcidDeathModule : ModuleBase<PlayerState, CharacterBody3D>
|
||||
{
|
||||
private IStateMachine<PlayerState, CharacterBody3D> _stateMachine;
|
||||
private CharacterBody3D MainObject => _stateMachine.MainObject;
|
||||
|
||||
private bool _enabled = false;
|
||||
|
||||
public override void EnterState(PlayerState state)
|
||||
{
|
||||
_enabled = true;
|
||||
}
|
||||
|
||||
public override void ExitState(PlayerState state)
|
||||
{
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
public override void Init(IStateMachine<PlayerState, CharacterBody3D> machine)
|
||||
{
|
||||
_stateMachine = machine;
|
||||
}
|
||||
|
||||
public override void Process(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void PhysicsProcess(double delta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnAcidCollision(Area3D area)
|
||||
{
|
||||
if (!_enabled) return;
|
||||
GD.Print("Oh no acid");
|
||||
_stateMachine.SetState(PlayerState.Dead);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue