Scriptum/Assets/Scripts/Door/TriggerDoor.cs

34 lines
763 B
C#
Raw Permalink Normal View History

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