1862 {
1863 int gear;
1864
1865 if (newGear == -1)
1866 {
1868 }
1869 else
1870 {
1871 gear = newGear;
1872 }
1873
1874 if (LightIsOn())
1875 {
1876 if (!
m_LightsComponent.LightExist(
"Front") && m_HeadlightsState != CarHeadlightBulbsState.NONE)
1878
1880 {
1881 switch (m_HeadlightsState)
1882 {
1883 case CarHeadlightBulbsState.LEFT:
1885 break;
1886
1887 case CarHeadlightBulbsState.RIGHT:
1889 break;
1890
1891 case CarHeadlightBulbsState.BOTH:
1894
1895 vector local_pos_middle = (local_pos_left + local_pos_right) * 0.5;
1896 m_LightsComponent.AttachLightOnObject(
"Front", local_pos_middle, vector.Zero, VehicleLightMode.AGGREGATED);
1897 break;
1898
1899 default:
1901 }
1902 }
1903 }
1904 else
1905 {
1908 }
1909
1910
1911 switch (gear)
1912 {
1913 case CarGear.REVERSE:
1916 m_RearLightType = CarRearLightType.BRAKES_AND_REVERSE;
1917 else
1918 m_RearLightType = CarRearLightType.REVERSE_ONLY;
1919 break;
1920 default:
1922 m_RearLightType = CarRearLightType.BRAKES_ONLY;
1923 else
1924 m_RearLightType = CarRearLightType.NONE;
1925 }
1926
1927
1928
1929 if (!
m_LightsComponent.LightExist(
"Rear") && m_RearLightType != CarRearLightType.NONE && m_HeadlightsState != CarHeadlightBulbsState.NONE)
1930 {
1931 if (
EngineIsOn() || m_RearLightType == CarRearLightType.BRAKES_ONLY || m_RearLightType == CarRearLightType.BRAKES_AND_REVERSE)
1932 {
1935 }
1936 }
1937
1938
1939 if (
m_LightsComponent.LightExist(
"Rear") && m_RearLightType != CarRearLightType.NONE && m_HeadlightsState != CarHeadlightBulbsState.NONE)
1940 {
1941 switch (m_RearLightType)
1942 {
1943 case CarRearLightType.BRAKES_ONLY:
1944 m_LightsComponent.SetLightTypeAndMode(
"Rear", VehicleLightType.BRAKE, VehicleLightMode.SEGREGATED);
1945 break;
1946
1947 case CarRearLightType.REVERSE_ONLY:
1949 m_LightsComponent.SetLightTypeAndMode(
"Rear", VehicleLightType.REVERSE, VehicleLightMode.SEGREGATED);
1950 else
1952
1953 break;
1954
1955 case CarRearLightType.BRAKES_AND_REVERSE:
1957 m_LightsComponent.SetLightTypeAndMode(
"Rear", VehicleLightType.REVERSE_BRAKE, VehicleLightMode.AGGREGATED);
1958 else
1959 m_LightsComponent.SetLightTypeAndMode(
"Rear", VehicleLightType.BRAKE, VehicleLightMode.SEGREGATED);
1960
1961 break;
1962
1963 default:
1965 }
1966 }
1967 else
1968 {
1971 }
1972 }
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native int GetGear()
Returns the index of the future gear, -1 if there is no engine.
static string m_LeftHeadlightPoint
static string m_ReverseLightPoint
static string m_LeftHeadlightTargetPoint
static string m_RightHeadlightTargetPoint
ref VehicleLightsComponent m_LightsComponent
static string m_RightHeadlightPoint