예제 #1
0
    public void Act()
    {
        Quaternion currentRotation      = c_playerData.q_currentRotation;
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;

        float currentTurnSpeed     = c_turnData.f_currentTurnSpeed;
        float currentRealTurnSpeed = c_turnData.f_currentRealTurnSpeed;

        AccelerationCartridge.DecelerateAbs(ref currentTurnSpeed, c_turnData.f_turnResetSpeed);
        AccelerationCartridge.DecelerateAbs(ref currentRealTurnSpeed, c_turnData.f_turnResetSpeed);

        HandlingCartridge.Turn(Vector3.up, currentRealTurnSpeed * Time.fixedDeltaTime, ref currentRotation);
        HandlingCartridge.Turn(Vector3.up, currentTurnSpeed * Time.fixedDeltaTime, ref currentModelRotation);

        HandlingCartridge.AddTurnCorrection(Vector3.up, ref currentModelRotation, currentRotation, c_positionData.i_switchStance);

        c_positionData.q_currentModelRotation = currentModelRotation;
        c_playerData.q_currentRotation        = currentRotation;
        c_turnData.f_currentTurnSpeed         = currentTurnSpeed;
        c_turnData.f_currentRealTurnSpeed     = currentRealTurnSpeed;
    }
예제 #2
0
    public void Act()
    {
        Quaternion currentModelRotation = c_positionData.q_currentModelRotation;
        Quaternion currentRotation      = c_playerData.q_currentRotation;

        float currentSpeed         = c_playerData.f_currentSpeed;
        float currentTurnSpeed     = c_turnData.f_currentTurnSpeed;
        float currentRealTurnSpeed = c_turnData.f_currentRealTurnSpeed;
        float targetTurnAccel      = c_turnData.f_turnAcceleration * c_playerInputData.f_inputAxisLHoriz;
        float turnSpeedCap         = Mathf.Abs(c_turnData.f_turnTopSpeed * c_playerInputData.f_inputAxisLHoriz);

        float turnSign = Mathf.Sign(targetTurnAccel);

        AccelerationCartridge.CalculateInterpolatedAcceleration(out float currentTurnAccel,
                                                                targetTurnAccel,
                                                                turnSpeedCap * turnSign * Constants.NEGATIVE_ONE,
                                                                turnSpeedCap * turnSign,
                                                                currentTurnSpeed);

        AccelerationCartridge.AccelerateAbs(ref currentTurnSpeed, currentTurnAccel, turnSpeedCap);
        AccelerationCartridge.AccelerateAbs(ref currentRealTurnSpeed, currentTurnAccel, turnSpeedCap, c_turnData.f_currentSurfaceFactor);

        HandlingCartridge.Turn(Vector3.up, currentTurnSpeed * Time.fixedDeltaTime, ref currentModelRotation);
        HandlingCartridge.Turn(Vector3.up, currentRealTurnSpeed * Time.fixedDeltaTime, ref currentRotation);

        HandlingCartridge.AddTurnCorrection(Vector3.up, ref currentModelRotation, currentRotation, c_positionData.i_switchStance);

        AccelerationCartridge.Decelerate(ref currentSpeed,
                                         Mathf.Abs(currentRealTurnSpeed / c_turnData.f_turnTopSpeed) * c_turnData.f_turnSpeedDeceleration * Time.fixedDeltaTime);

        c_positionData.q_currentModelRotation = currentModelRotation;
        c_playerData.q_currentRotation        = currentRotation;
        c_turnData.f_currentTurnSpeed         = currentTurnSpeed;
        c_turnData.f_currentRealTurnSpeed     = currentRealTurnSpeed;
        c_playerData.f_currentSpeed           = currentSpeed;
    }