added UFO skywalk animation and bolt car teleport button

This commit is contained in:
2025-03-25 20:09:15 +02:00
parent 7ea187f9fd
commit e40106b45e
1036 changed files with 2552 additions and 43098 deletions

View File

@@ -0,0 +1,29 @@
using UnityEngine;
public class PlayAnimationOnTrigger : MonoBehaviour
{
[SerializeField] public Animator animator; // Reference to the Animator component
[SerializeField] public string animationName = "YourAnimation"; // Name of the animation to play
private void OnTriggerEnter(Collider other)
{
// Check if the animator is assigned
if (animator == null)
{
Debug.LogWarning("Animator not assigned!", this);
return;
}
// Check if the animation is already playing
if (animator.GetCurrentAnimatorStateInfo(0).IsName(animationName) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1)
{
Debug.Log("Animation is already playing.");
return;
}
// Play the animation
animator.Play(animationName, 0, 0f);
Debug.Log("Playing animation: " + animationName);
}
}