chill-jam-10-2024/scripts/Door.cs

39 lines
755 B
C#

using Godot;
using System;
public partial class Door : Node2D
{
[Export] public Door Exit;
private Interactable _interactable;
public void Enable()
{
_interactable.Enable();
}
public void Disable()
{
_interactable.Disable();
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_interactable = (Interactable)FindChild("Interactable");
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
private void _on_interactable_player_near_by(Player player)
{
player.InteractableObjects.Add(this);
}
private void _on_interactable_player_left(Player player)
{
player.InteractableObjects.Remove(this);
}
}