예제 #1
0
    private void CapSpeed()
    {
        float speed = m_Rigidbody.velocity.magnitude;

        switch (m_SpeedType)
        {
        case SpeedType.MPH:

            speed *= 2.23693629f;
            if (speed > m_Topspeed)
            {
                m_Rigidbody.velocity = (m_Topspeed / 2.23693629f) * m_Rigidbody.velocity.normalized;
            }
            break;

        case SpeedType.KPH:
            speed *= 3.6f;
            if (speed > m_Topspeed)
            {
                m_Rigidbody.velocity = (m_Topspeed / 3.6f) * m_Rigidbody.velocity.normalized;
            }
            break;
        }

        if (speedText != null)
        {
            speedText.text = Mathf.Round(speed) + " " + m_SpeedType.ToString();
        }
    }
 public void UpdateSpeedometer(float v, VehicleType vehicleType, SpeedType dt = SpeedType.KPH)
 {
     if (vehicleType == VehicleType.Car)
     {
         SpeedometerText.text = v.ToString("000") + "\n<size=16>" + dt.ToString() + "/h</size>";
     }
     else if (vehicleType == VehicleType.Jet)
     {
         SpeedometerText.text = v.ToString("000") + "\n<size=16> KMT/h</size>";
     }
 }
 public bool Search(string str)
 {
     if (WorldID.ToString().Contains(str) || PathID.ToString().Contains(str) || PathIDType.ToString().Contains(str) ||
         PatrolType.ToString().Contains(str) || SpeedType.ToString().Contains(str))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }