Elevators move players

This commit is contained in:
Marco 2025-03-06 11:34:45 +01:00
commit 2e0ad40f33
8 changed files with 156 additions and 93 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Cirno.Scripts.Enums;
using Godot;
@ -26,9 +27,27 @@ public partial class ElevatorProxy : Area2D, IActivable
// {
//
// }
public InteractionController CachedPlayer { get; private set; }
public void Activate(ActivationType activationType = ActivationType.Toggle)
{
EmitSignal(SignalName.Activated, (int)activationType);
}
private void _on_area_entered(Area2D area)
{
if (area is InteractionController player)
{
CachedPlayer = player;
}
}
private void _on_area_exited(Area2D area)
{
if (area is InteractionController player)
{
CachedPlayer = null;
}
}
}