예제 #1
0
 /// <summary>
 /// Moves the controller towards the next point
 /// </summary>
 protected virtual void MoveController()
 {
     if ((Target == null) || (NextWaypointIndex <= 0))
     {
         _characterMovement.SetMovement(Vector2.zero);
         return;
     }
     else
     {
         _direction     = (Waypoints[NextWaypointIndex] - this.transform.position).normalized;
         _newMovement.x = _direction.x;
         _newMovement.y = _direction.z;
         _characterMovement.SetMovement(_newMovement);
     }
 }
예제 #2
0
 /// <summary>
 /// Describes what happens when the weapon starts
 /// </summary>
 protected virtual void TurnWeaponOn()
 {
     TriggerWeaponStartFeedback();
     WeaponState.ChangeState(WeaponStates.WeaponStart);
     if ((_characterMovement != null) && (ModifyMovementWhileAttacking))
     {
         _movementMultiplierStorage = _characterMovement.MovementSpeedMultiplier;
         _characterMovement.MovementSpeedMultiplier = MovementMultiplier;
     }
     if (_comboWeapon != null)
     {
         _comboWeapon.WeaponStarted(this);
     }
     if (PreventAllMovementWhileInUse && (_characterMovement != null) && (_controller != null))
     {
         _characterMovement.SetMovement(Vector2.zero);
         _characterMovement.MovementForbidden = true;
     }
 }
예제 #3
0
        /// <summary>
        /// Moves the character towards the target if needed
        /// </summary>
        protected virtual void Move()
        {
            if (_brain.Target == null)
            {
                return;
            }

            _directionToTarget = _brain.Target.position - this.transform.position;
            _movementVector.x  = _directionToTarget.x;
            _movementVector.y  = _directionToTarget.z;
            _characterMovement.SetMovement(_movementVector);


            if (Mathf.Abs(this.transform.position.x - _brain.Target.position.x) < MinimumDistance)
            {
                _characterMovement.SetHorizontalMovement(0f);
            }

            if (Mathf.Abs(this.transform.position.z - _brain.Target.position.z) < MinimumDistance)
            {
                _characterMovement.SetVerticalMovement(0f);
            }
        }
 /// <summary>
 /// Moves the character
 /// </summary>
 protected virtual void Move()
 {
     _characterMovement.SetMovement(_direction);
 }