2022-12-10 02:24:32 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class TriggerDoor : DetectionZone
|
|
|
|
{
|
|
|
|
public string DoorOpenAnimatorParamName = "DoorOpen";
|
2023-01-05 14:19:56 +01:00
|
|
|
public static bool ableToOpen = false;
|
2023-01-07 00:39:19 +01:00
|
|
|
public static Animator animator;
|
2022-12-10 02:24:32 +01:00
|
|
|
|
|
|
|
void Start(){
|
|
|
|
animator = GetComponent<Animator>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Update() {
|
|
|
|
if(detectedObjs.Count > 0) {
|
2023-01-07 00:39:19 +01:00
|
|
|
//if (Input.GetKeyDown(KeyCode.E))
|
|
|
|
//{
|
|
|
|
animator.SetBool(DoorOpenAnimatorParamName, true);
|
2023-01-05 14:19:56 +01:00
|
|
|
ableToOpen = true;
|
2023-01-07 00:39:19 +01:00
|
|
|
//}
|
2022-12-10 02:24:32 +01:00
|
|
|
} else {
|
|
|
|
animator.SetBool(DoorOpenAnimatorParamName, false);
|
2023-01-07 00:39:19 +01:00
|
|
|
ableToOpen = false;
|
2022-12-10 02:24:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void triggerDoor()
|
|
|
|
{
|
|
|
|
animator = GetComponent<Animator>();
|
|
|
|
|
|
|
|
animator.SetBool(DoorOpenAnimatorParamName, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|