public void IncreaseRewindValue() { if (SceneManager.GetActiveScene().name == "Play") { if (Rewind < 3) { Rewind++; } SliderRewind.value = Rewind; rewindCounter.text = Rewind.ToString() + "/3"; } }
protected void Start() { hasShield = true; isRewinding = false; rocketCounter = 0; fps = 60; RewindSecondsLimit = 3; Health = 100; Rewind = 0; RewindSeconds = 3; FrameCounter = 1; if (SceneManager.GetActiveScene().name == "Play") { rocketCounterText.text = rocketCounter.ToString(); rewindCounter.text = Rewind.ToString() + "/3"; } }
IEnumerator rewindCourtine() { int counter = 0; int SpareCounter = 0; gameObject.GetComponent <Rigidbody2D>().velocity = new Vector2(0.0f, 0.0f); while (counter < 60) { if (oldDataList.Count - counter - 1 >= 0) { this.Health = oldDataList[oldDataList.Count - counter - 1].oldHealth; this.transform.position = oldDataList[oldDataList.Count - counter - 1].OldPosition; this.transform.rotation = oldDataList[oldDataList.Count - counter - 1].OldRotation; if (SceneManager.GetActiveScene().name == "Play") { SliderHealth.value = Health; } } else { this.Health = SpareData[SpareData.Count - SpareCounter - 1].oldHealth; this.transform.position = SpareData[SpareData.Count - SpareCounter - 1].OldPosition; this.transform.rotation = SpareData[SpareData.Count - SpareCounter - 1].OldRotation; if (SceneManager.GetActiveScene().name == "Play") { SliderHealth.value = Health; } SpareCounter++; } counter++; yield return(new WaitForSeconds(0)); } this.gameObject.GetComponent <PlayerController>().SetPlayerActive(); Rewind = 0; if (SceneManager.GetActiveScene().name == "Play") { SliderRewind.value = Rewind; rewindCounter.text = Rewind.ToString() + "/3"; } isRewinding = false; }