예제 #1
0
 protected void PropagateToChildren(e_AnimationType _animType)
 {
     foreach (var cAnimator in this.childrenCascadingAnimators)
     {
         cAnimator.RequestAnim(_animType);
     }
 }
예제 #2
0
    public void RequestAnim(e_AnimationType _animType)
    {
        if (HasAnim(_animType))
        {
            CancelCurAnim();
            PlayAnim(_animType);
        }

        // propagate animation request even if doesnt have the animation itself
        PropagateToChildren(_animType);
    }
예제 #3
0
    protected virtual void Start()
    {
        AssertPrerequisites();

        this.curAnim  = e_AnimationType.None;
        this.animator = GetComponent <Animator>();

        /*
         * this.childrenCascadingAnimators = GetComponentsInChildren<CascadingAnimator>().ToList();
         * this.childrenCascadingAnimators.Remove(this);
         */
        this.childrenCascadingAnimators = this.GetComponentsInDirectChildren <CascadingAnimator>();
    }
    protected override void PlayAnim(e_AnimationType _animType)
    {
        switch (_animType)
        {
        case e_AnimationType.Idle:              PlayIdleAnim();                 break;

        // if animTypes has _animType but switch doesnt call the corresponding func
        default:        LogErrorPlayAnim(_animType);    return;
        }

        this.curAnim = _animType;

        LogPlayAnim(_animType);
    }
예제 #5
0
 protected void LogCancelAnim(e_AnimationType _animType)
 {
     Debug.Log(this.gameObject.name + " cancel anim : " + _animType.ToString());
 }
예제 #6
0
 protected void LogPlayAnim(e_AnimationType _animType)
 {
     Debug.Log(this.gameObject.name + " plays anim : " + _animType.ToString());
 }
예제 #7
0
 protected void LogErrorPlayAnim(e_AnimationType _animType)
 {
     Debug.LogError("You tried to play the '" + _animType.ToString() + "' animation on the '" + this.gameObject.name + "' whereas its 'CascadingAnimator' component can't. \n" +
                    "You may have forgotten to call the corresponding function in the 'PlayAnim(e_AnimType)' switch.");
 }
예제 #8
0
 protected abstract void PlayAnim(e_AnimationType _animType);
예제 #9
0
 protected bool HasAnim(e_AnimationType _animType)
 {
     return(this.animationTypes.Contains(_animType));
 }