using UnityEngine;
public class YellowPanel : MonoBehaviour {
private int clickNum = 0;
private Animator animator;
// Use this for initialization
void Start () {
clickNum = 0;
animator = this.transform.GetComponent<Animator>();
}
/// <summary>
/// 当按钮 按下 执行的函数
/// </summary>
public void buttonClick()
{
clickNum = clickNum + 1;
animator.SetInteger("isMoving_int", clickNum);// 当按钮 按下1次 执行的函数
if (clickNum == 1)
{
//animator.Play("TestUI123");
//animator.SetInteger("isMoving_int",);
}
else if (clickNum == 2)
{
//animator.Play("TestUI123_");
clickNum = 0;
}
}
}
相关文章:
1.
[Unity][UGUI][Animation&Animator]Animator动画运动后固定物体位置
2.
3.
参考文章:
1.
Button Animation (Using Animator) - Unity 3D[Tutorial][C#]
2.
3.