private void ToggleLightsUI(int state) { lightsImage.color = state == 0 ? initColor : enabledColor; switch (state) { case 0: lightsImage.sprite = lightsStateSprites[0]; break; case 1: lightsImage.sprite = lightsStateSprites[0]; break; case 2: lightsImage.sprite = lightsStateSprites[1]; break; default: Debug.Log("Lights state out of range!!!"); break; } if (dash == null) { dash = FindObjectOfType <DashUIComponent>(); } dash?.SetDashLightsUI(lightsImage.color, lightsImage.sprite); }
private void ToggleWiperUI(int state) { wiperImage.color = state == 0 ? initColor : enabledColor; switch (state) { case 0: wiperImage.sprite = wiperStateSprites[0]; break; case 1: wiperImage.sprite = wiperStateSprites[1]; break; case 2: wiperImage.sprite = wiperStateSprites[2]; break; case 3: wiperImage.sprite = wiperStateSprites[3]; break; default: Debug.Log("Wiper state out of range!!!"); break; } if (dash == null) { dash = FindObjectOfType <DashUIComponent>(); } dash?.SetDashWiperUI(wiperImage.color, wiperImage.sprite); }
private void ToggleParkingBrakeUI(int state) { parkingBrakeImage.color = Convert.ToBoolean(state) ? enabledColor : initColor; if (dash == null) { dash = FindObjectOfType <DashUIComponent>(); } dash?.SetDashParkingBrakeUI(parkingBrakeImage.color); }
private void ToggleIgnitionUI(int state) { ignitionImage.color = Convert.ToBoolean(state) ? enabledColor : initColor; if (dash == null) { dash = FindObjectOfType <DashUIComponent>(); } dash?.SetDashIgnitionUI(ignitionImage.color); }
private void ToggleShiftUI(int state) { shiftImage.color = Convert.ToBoolean(state) ? enabledColor : disabledColor; shiftImage.sprite = Convert.ToBoolean(state) ? shiftStateSprites[0] : shiftStateSprites[1]; if (dash == null) { dash = FindObjectOfType <DashUIComponent>(); } dash?.SetDashShiftUI(shiftImage.color, shiftImage.sprite); }
private void OnEnable() { Missive.AddListener <DashStateMissive>(OnDashStateChange); dash = FindObjectOfType <DashUIComponent>(); }
private void OnDisable() { Missive.RemoveListener <DashStateMissive>(OnDashStateChange); dash = null; }