private void TryActions(SetAnimationAction[] actions, Transform actor) { if (actions == null) return; foreach (SetAnimationAction action in actions) { if (action != null && action.condition != null && action.condition.IsTrue(actor)) DoAction(action, actor); } }
public void DoAction(SetAnimationAction action, Transform actor) { if (action != null) { Transform target = Tools.Select(action.target, this.transform); Animation animation = target.GetComponentInChildren<Animation>(); if (animation == null) { if (DialogueDebug.LogWarnings) Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimation() can't find Animation component", new System.Object[] { DialogueDebug.Prefix, target.name })); } else { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimation({2})", new System.Object[] { DialogueDebug.Prefix, target.name, action.animationClip })); animation.CrossFade(action.animationClip.name); } } }
public void DoAction(SetAnimationAction action, Transform actor) { if (action != null) { Transform target = Tools.Select(action.target, this.transform); Animation animation = target.GetComponentInChildren <Animation>(); if (animation == null) { if (DialogueDebug.LogWarnings) { Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimation() can't find Animation component", new System.Object[] { DialogueDebug.Prefix, target.name })); } } else { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Trigger: {1}.SetAnimation({2})", new System.Object[] { DialogueDebug.Prefix, target.name, action.animationClip })); } animation.CrossFade(action.animationClip.name); } } }