Ejemplo n.º 1
0
    public override Vector3 Update(MovingEntityBase me)
    {
        float   input_forward = Input.GetAxis(controls.forward);
        float   input_right   = Input.GetAxis(controls.right);
        Vector3 MoveDirection = Vector3.zero;

        if (input_forward != 0 || input_right != 0)
        {
            Vector3 currentRight, currentMoveForward;
            if (pc.gravityApplication == MovingEntity.GravityState.useGravity)
            {
                GetMoveVectors(pc.GroundNormal /*isStableOnGround?GroundNormal:GetUpOrientation()*/, out currentMoveForward, out currentRight);
            }
            else
            {
                currentMoveForward = camHandle.forward; currentRight = camHandle.right;
            }
            MoveDirection = (currentRight * input_right) + (currentMoveForward * input_forward);
            MoveDirection.Normalize();
        }
        else if (AutoSlowdown)
        {
            me.IsBrakeOn = true;
        }
        pc.jump.SecondsToPressJump = Input.GetButton(controls.jump)?1:0;
        if (!pc.AutomaticallyTurnToFaceLookDirection)
        {
            if (pc.gravityApplication != MovingEntity.GravityState.none)
            {
                pc.UpdateFacing();
            }
            else
            {
                pc.TurnToFace(myCamera.transform.forward, myCamera.transform.up);
            }
        }
        return(MoveDirection);
    }