27 lines
535 B
C#
27 lines
535 B
C#
using Godot;
|
|
|
|
public partial class Door : Node2D
|
|
{
|
|
private AnimatedSprite2D _animatedSprite2D;
|
|
private CollisionShape2D _collisionShape2D;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_animatedSprite2D = (AnimatedSprite2D)FindChild("AnimatedSprite2D");
|
|
_collisionShape2D = (CollisionShape2D)FindChild("CollisionShape2D");
|
|
|
|
Close();
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
_animatedSprite2D.Play("close");
|
|
_collisionShape2D.Disabled = false;
|
|
}
|
|
|
|
public void Open()
|
|
{
|
|
_animatedSprite2D.Play("open");
|
|
_collisionShape2D.Disabled = true;
|
|
}
|
|
}
|