private void Start() { lerpPause = platform_Pause.GetComponent <Lerp2Target>(); lerpPhysical = platform_Physical.GetComponent <Lerp2Target>(); lerpPause.Percentage = 0.0f; lerpPhysical.Percentage = 0.0f; Logicstatus = StartStopStatus.Park; }
///////////---COROUTINES---////////////// IEnumerator Park2Pause(Lerp2Target lerp) { Logicstatus = StartStopStatus.Transit; StartStopChanged.Invoke(Logicstatus); while (lerp.Percentage < 1) { lerp.Percentage += (1.0f / transitionTime) * Time.deltaTime; yield return(null); } lerp.Percentage = 1; Logicstatus = StartStopStatus.Pause; StartStopChanged.Invoke(Logicstatus); }
IEnumerator Motion2Pause(Lerp2Target lerp) { Logicstatus = StartStopStatus.Transit; StartStopChanged.Invoke(Logicstatus); CoR.SetActive(false); while (lerp.Percentage > 0) { lerp.Percentage -= (1.0f / transitionTime) * Time.deltaTime; yield return(null); } lerp.Percentage = 0; Logicstatus = StartStopStatus.Pause; StartStopChanged.Invoke(Logicstatus); }
IEnumerator Pause2Motion(Lerp2Target lerp) { Logicstatus = StartStopStatus.Transit; StartStopChanged.Invoke(Logicstatus); while (lerp.Percentage < 1) { lerp.Percentage += (1.0f / transitionTime) * Time.deltaTime; yield return(null); } lerp.Percentage = 1; CoR.SetActive(true); Logicstatus = StartStopStatus.Motion; StartStopChanged.Invoke(Logicstatus); }