123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using UnityEngine;
- using System.Collections;
- public class TestAnimation : MonoBehaviour {
- Animator mAnimator = null;
- // Use this for initialization
- void Start () {
- mAnimator = GetComponentInChildren<Animator>();
- }
-
- // Update is called once per frame
- void Update()
- {
- AnimatorStateInfo stateinfo = this.mAnimator.GetCurrentAnimatorStateInfo(0);
- if (stateinfo.IsName("Appear") && stateinfo.normalizedTime >= 1.0f)
- {
- mAnimator.Play("Miss");
- }
- }
- void OnGUI()
- {
- if (GUI.Button(new Rect(10, 10, 100, 50), "appear"))
- {
- mAnimator.Play("Appear");
- }
- if (GUI.Button(new Rect(10, 70, 100, 100), "Idle"))
- {
- mAnimator.Play("Diss");
-
- }
- if (GUI.Button(new Rect(10, 130, 100, 100), "Stop"))
- {
- mAnimator.speed = 0;
- }
- if (GUI.Button(new Rect(10, 190, 100, 100), "Continue"))
- {
- mAnimator.speed = 1;
- }
- }
- }
|