コード例 #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>();
    }
コード例 #4
0
    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));
 }