Exemplo n.º 1
0
    /// <summary>
    /// On Update, we make sure we have a controller and a live character, and if we do, we apply a force to it
    /// </summary>
    protected virtual void Update()
    {
        if (_controller == null)
        {
            return;
        }

        if (_character.ConditionState.CurrentState == CharacterStates.CharacterConditions.Dead)
        {
            _character  = null;
            _controller = null;
            return;
        }

        _controller.AddHorizontalForce(AddedForce.x);
        _controller.AddVerticalForce(Mathf.Sqrt(2f * AddedForce.y * -_controller.Parameters.Gravity));
    }