private void TryActions(SetAnimatorStateAction[] actions, Transform actor)
 {
     if (actions == null) return;
     foreach (SetAnimatorStateAction action in actions) {
         if (action != null && action.condition != null && action.condition.IsTrue(actor)) DoAction(action, actor);
     }
 }
 public void DoAction(SetAnimatorStateAction action, Transform actor)
 {
     if (action != null) {
         Transform target = Tools.Select(action.target, this.transform);
         Animator animator = target.GetComponentInChildren<Animator>();
         if (animator == null) {
             if (DialogueDebug.LogWarnings) Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimatorState() can't find Animator", new System.Object[] { DialogueDebug.Prefix, target.name }));
         } else {
             if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimatorState({2})", new System.Object[] { DialogueDebug.Prefix, target.name, action.stateName }));
             animator.CrossFade(action.stateName, action.crossFadeDuration);
         }
     }
 }
Exemplo n.º 3
0
 public void DoAction(SetAnimatorStateAction action, Transform actor)
 {
     if (action != null)
     {
         Transform target   = Tools.Select(action.target, this.transform);
         Animator  animator = target.GetComponentInChildren <Animator>();
         if (animator == null)
         {
             if (DialogueDebug.logWarnings)
             {
                 Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimatorState() can't find Animator", new System.Object[] { DialogueDebug.Prefix, target.name }));
             }
         }
         else
         {
             if (DialogueDebug.logInfo)
             {
                 Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimatorState({2})", new System.Object[] { DialogueDebug.Prefix, target.name, action.stateName }));
             }
             animator.CrossFade(action.stateName, action.crossFadeDuration);
         }
     }
 }