IEnumerator PlayAnyAnimation(RSRMonoBehaviour targetObj, AnimObject.AnimationEnum thisAnimEnum, AnimObject.AnimationEnum targetAnimEnum) { //Debug.Log("Trying to play Animation " + thisAnimEnum.ToString() + " for object " + gameObject.ToString()); AnimObjectHolder aoh; if (_animController.TryGetAnimObjectHolder(thisAnimEnum, out aoh)) { //Debug.Log(thisAnimEnum.ToString() + " found for " + gameObject.ToString()); for (int i = 0; i < aoh.GetAnimObjects().Count; i++) { AnimObject ao = aoh.GetAnimObjects()[i]; if (ao.concurrent) { StartCoroutine(ao.Play(this, targetObj, targetAnimEnum)); } else { yield return(StartCoroutine(ao.Play(this, targetObj, targetAnimEnum))); } } } else { throw new System.NotImplementedException("PlayAnimation(" + targetObj.ToString() + ", " + thisAnimEnum.ToString() + ") --> Could not find Animation " + thisAnimEnum.ToString() + " for " + gameObject.ToString()); } }
public void PlayAnimation(AnimObject.AnimationEnum thisAnimEnum, RSRMonoBehaviour target, AnimObject.AnimationEnum targetAnimEnum) { if (_animController == null) { throw new System.NullReferenceException("PlayAnimation(" + target.ToString() + ", " + thisAnimEnum.ToString() + ") --> _animController null for " + gameObject.ToString()); } else { StartCoroutine(PlayAnyAnimation(target, thisAnimEnum, targetAnimEnum)); } }
/* * targetObj: in this case, the object that will be doing an animation * animEnum: Animation for targetObj to play */ public virtual IEnumerator PlayTarget(RSRMonoBehaviour targetObj, AnimObject.AnimationEnum animEnum) { RSRAnimationController targetAnimController = targetObj.GetComponent <RSRAnimationController>(); if (targetAnimController == null) { Debug.LogWarning("targetObj " + targetObj.ToString() + "does not have an AnimationController attached!"); yield break; } yield return(new WaitForSeconds(delayForTargetAnim)); //DELAY if (optionalTargetAnimationOverride == AnimationEnum.Default) { targetObj.PlayAnimation(animEnum); } else { targetObj.PlayAnimation(optionalTargetAnimationOverride); } }