Пример #1
0
        void OnIdle(AnimatorAccess.StateInfo info, AnimatorAccess.LayerStatus status)
        {
            float random = Random.value;

            if (random > YawnThreshold)
            {
                // start yawning from time to time which will block input
                anim.SetYawnTrigger();
            }
            if (Time.realtimeSinceStartup - randomRotationTimestamp > randomRotationInterval)
            {
                // rotate after randomRotationInterval to random direction
                int currrentRotation = anim.GetRotate();
                int newRotation      = currrentRotation == 0 ? (int)Mathf.Sign((int)Random.Range(-1, 1)) : 0;
                anim.SetRotate(newRotation);
                randomRotationTimestamp = Time.realtimeSinceStartup;
            }
        }
Пример #2
0
 void LogStateChange(string method, AnimatorAccess.StateInfo info, AnimatorAccess.LayerStatus status)
 {
     UnityEngine.Debug.Log(string.Format("[t={0:0.00}] == '{1:-25}' callback: {2}, previous state was {3}", Time.realtimeSinceStartup, info.Name, method, anim.GetStateName(status.State.Previous)));
 }
Пример #3
0
 void OnEnterYawning(AnimatorAccess.StateInfo info, AnimatorAccess.LayerStatus status)
 {
     speed = 0f;
     audio.Play();
 }
Пример #4
0
 void OnAnyStateChangeDebug(AnimatorAccess.StateInfo info, AnimatorAccess.LayerStatus status)
 {
     LogStateChange("OnAnyStateChange", info, status);
 }