50 lines
662 B
C#
50 lines
662 B
C#
using UnityEngine;
|
|
|
|
public class Demo_Animator_MooseBull : MonoBehaviour
|
|
{
|
|
private Animator anim;
|
|
|
|
private int i;
|
|
|
|
public int size = 10;
|
|
|
|
public bool rot;
|
|
|
|
private Vector3 startpose;
|
|
|
|
private void Start()
|
|
{
|
|
anim = GetComponent<Animator>();
|
|
startpose = base.transform.position;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (rot)
|
|
{
|
|
base.transform.Rotate(0f, 50f * Time.deltaTime, 0f);
|
|
}
|
|
anim.SetInteger("number", i);
|
|
}
|
|
|
|
public void NextAnimation()
|
|
{
|
|
if (i > size)
|
|
{
|
|
i = 0;
|
|
}
|
|
i++;
|
|
base.transform.position = startpose;
|
|
}
|
|
|
|
public void BackAnimation()
|
|
{
|
|
i--;
|
|
if (i < 0)
|
|
{
|
|
i = size;
|
|
}
|
|
base.transform.position = startpose;
|
|
}
|
|
}
|