Exemplo n.º 1
0
 private void ToggleBrain(bool enabled)
 {
     if (IsTreeRunning && !enabled)
     {
         tree.StopBehaviour();
     }
     else if (!IsTreeRunning && enabled)
     {
         tree.StartBehaviour();
     }
 }
    void OnEnterState(AnimatorStateInfo info)
    {
        if (info.fullPathHash == mKnockbackState)
        {
            mAnimator.ResetTrigger("AttackTrigger");
        }
        else if (info.fullPathHash == mDeathState)
        {
            mBehaviourTreeOwner.StopBehaviour();
            Observable.Timer(TimeSpan.FromSeconds(3.0f)).Subscribe(_ =>
            {
                GameObject DeathEffectObj = Instantiate(DeathEffect, transform.position, Quaternion.identity) as GameObject;
                Destroy(DeathEffectObj, 1.0f);
                Destroy(gameObject);
            });
        }

        if (info.fullPathHash == mAttackState ||
            info.fullPathHash == mDeathState ||
            info.fullPathHash == mKnockbackState)
        {
            mCharacterController.SetMoveable(false);
        }
        else
        {
            mCharacterController.SetMoveable(true);
        }
    }