Esempio n. 1
0
    public void OnCollisionEnter(Collision collision)
    {
        if (_enemyMotor.IsGrounded)
        {
            _enemyMotor.UpdateTransformToNavmesh = true;
            _enemyMotor.Warp(_transform.position);

            _enemyMotor.RigidBody.useGravity  = false;
            _enemyMotor.RigidBody.isKinematic = true;

            _enemyBehaviour.StopMovementAction();
        }
    }
Esempio n. 2
0
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (_playerController != null)
        {
            _playerController.SwitchState <NormalState>();
            _playerMotor.HasGravity = true;
            _animationsController.Climb(false);
            animator.applyRootMotion = false;
            _playerController        = null;
        }

        if (_enemyMotor != null)
        {
            _enemyMotor.RigidBody.isKinematic = true;
            _enemyMotor.ResetRigidbodyConstraints();
            _enemyMotor.UpdateTransformToNavmesh = true;
            _enemyMotor.Warp(_enemyMotor.transform.position);
            _animationsController.Climb(false);
            animator.applyRootMotion = false;
            _enemyBehaviour.StopMovementAction();
            _enemyMotor = null;
        }
    }