2021-04-15 16:10:58 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class Door : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private Animator _animator;
|
|
|
|
|
2021-04-21 17:42:11 +02:00
|
|
|
private bool _opened = false;
|
2021-04-15 16:10:58 +02:00
|
|
|
|
|
|
|
public void Open()
|
|
|
|
{
|
|
|
|
if (_opened) return;
|
|
|
|
|
|
|
|
// move door
|
|
|
|
_animator.Play("DoorUp", 0, 0);
|
|
|
|
_opened = true;
|
|
|
|
}
|
2021-04-21 17:42:11 +02:00
|
|
|
|
|
|
|
public void Close()
|
|
|
|
{
|
|
|
|
Debug.Log("Door closed");
|
|
|
|
if (!_opened) return;
|
|
|
|
Debug.Log("after if");
|
|
|
|
//move door
|
|
|
|
|
|
|
|
_animator.Play("DoorDown", 0, 0);
|
|
|
|
_opened = false;
|
|
|
|
}
|
2021-04-15 16:10:58 +02:00
|
|
|
}
|