MIF_E31230837/Assets/Script/EarthController.cs

32 lines
656 B
C#

using UnityEngine;
public class EarthController : MonoBehaviour
{
public Animator[] anim;
private bool isPlaying = false;
void Start()
{
foreach (Animator animator in anim)
{
animator.speed = 0;
}
}
public void JalankanAnimasi()
{
isPlaying = !isPlaying;
foreach (Animator animator in anim)
{
animator.speed = isPlaying ? 1 : 0;
if (isPlaying)
{
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
animator.Play(stateInfo.fullPathHash, 0, 0f);
}
}
}
}