Files
WhaleAdventure_VR/Assets/02_Scripts/MazeRoom/zepettoTrigger.cs

28 lines
589 B
C#

using UnityEngine;
using UnityEngine.VFX;
public class ZepettoTrigger : MonoBehaviour
{
public VisualEffect vfx;
public Animator zepettoAnimator;
public string animationName;
public float delayBeforeVFX;
private bool hasPlayed = false;
private void OnTriggerEnter(Collider other)
{
if (hasPlayed) return;
if (!other.CompareTag("Player")) return;
hasPlayed = true;
zepettoAnimator.Play(animationName);
Invoke("PlayVFX", delayBeforeVFX);
}
private void PlayVFX()
{
vfx.SendEvent("OnPlay");
}
}