Files
HauntedBloodlines/Assets/Scripts/Scripted Events/Spawn_Or_Animation_Trigger.cs
2025-05-29 22:31:40 +03:00

31 lines
798 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawn_Or_Animation_Trigger : MonoBehaviour
{
[SerializeField] private GameObject _objectToSpawn;
[SerializeField] private Animator _objectAnimator;
[SerializeField] private string _bool;
public bool DoAction;
public bool _hasAnimation;
private void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player")
{
_objectToSpawn.SetActive(true);
if (_hasAnimation)
{
_objectAnimator.SetBool(_bool, true);
}
if (DoAction)
{
GameManagerEarly.GetInstance().DoAction = true;
DoAction = false;
}
}
}
}