void PeformRestart(RestartAt restartAt) { //Debug.Log(string.Format("PeformRestart name={0} isLocalPlayer={1}", gameObject.name, isLocalPlayer)); crashed = false; if (restartAt == RestartAt.RestartAtStartingPos) { transform.position = startPos; transform.eulerAngles = startEulers; } else { Vector3 eulers = transform.eulerAngles; eulers.z = 0; transform.eulerAngles = eulers; } thrust = 0; if (droneRigidbody != null) { //Default no velocity droneRigidbody.velocity = Vector3.zero; droneRigidbody.angularVelocity = Vector3.zero; } }
public void SetRaceInfo(RaceInfo ri) { totalLaps = ri.totalLaps; countdownSec = ri.countdownSec; detectCrash = ri.detectCrash; crashTolerance = ri.crashTolerance; restartAt = ri.restartAt; }
public RaceInfo(int totalLaps, float countdownSec, bool detectCrash, float crashTolerance, RestartAt restartAt) { this.totalLaps = totalLaps; this.countdownSec = countdownSec; this.detectCrash = detectCrash; this.crashTolerance = crashTolerance; this.restartAt = restartAt; }
IEnumerator HandleRestart(bool autoRestart, RestartAt restartAt) { //Debug.Log(string.Format("HandleRestart name={0} isLocalPlayer={1}", gameObject.name, isLocalPlayer)); if (autoRestart == true) { yield return(new WaitForSeconds(PlayerPrefs.GetFloat(Constants.AutoRestartDelay))); } PeformRestart(restartAt); }
public void Restart(bool autoRestart, RestartAt restartAt) { //Debug.Log(string.Format("autoRestart={0} autoRestartDelay={1} restartAt={2}", autoRestart, RestartSettings.GetUnscaledAutoRestartDelay(), restartAt)); StartCoroutine(HandleRestart(autoRestart, restartAt)); }