revival/game/Assets/Scripts/PressurePlate/Door.cs

32 lines
662 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
public class Door : MonoBehaviour
{
[SerializeField] private Animator _animator;
private bool _opened = false;
public void Open()
{
if (_opened) return;
// move door
_animator.Play("DoorUp", 0, 0);
_opened = true;
}
public void Close()
{
Debug.Log("Door closed");
if (!_opened) return;
Debug.Log("after if");
//move door
_animator.Play("DoorDown", 0, 0);
_opened = false;
}
}