Scriptum/Assets/Scripts/Door/TriggerDoor.cs

34 lines
743 B
C#
Raw Normal View History

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;
Animator animator;
void Start(){
animator = GetComponent<Animator>();
}
void Update() {
if(detectedObjs.Count > 0) {
animator.SetBool(DoorOpenAnimatorParamName, true);
2023-01-05 14:19:56 +01:00
ableToOpen = true;
} else {
animator.SetBool(DoorOpenAnimatorParamName, false);
}
}
public void triggerDoor()
{
animator = GetComponent<Animator>();
animator.SetBool(DoorOpenAnimatorParamName, true);
}
}