private IEnumerator TriggerLevelFinishCoroutine() { _score++; OnLevelFinish?.Invoke(); yield return(new WaitForSeconds(_timeUntilRewindInMs / 1000f)); OnRewindBegin?.Invoke(_rewindDurationInMs); //AudioSettings.Instance.BasePitch = -1f; // Does not work in web build... yield return(new WaitForSeconds(_rewindDurationInMs / 1000f)); OnRewindEnd?.Invoke(); AudioSettings.Instance.BasePitch = 1; StartMainLoop(); }
void OnCollisionEnter(Collision other) { if (inGame) { if (other.gameObject.tag == "Danger" && noDangers == false) { visuals.gameObject.SetActive(false); myRigidbody.isKinematic = true; myCollider.enabled = false; deathParticles.transform.position = other.contacts[0].point; //deathParticles.transform.rotation = new Quaternion(other.contacts[0].normal.x - 90, other.contacts[0].normal.y, other.contacts[0].normal.z, 0); deathParticles.Play(); deathFx?.Invoke(); if (GameSettings.sfxOn) { deathSound.SetActive(true); } Invoke("ResetBox", 1.2f); } if (other.gameObject.tag == "Finish") { Debug.Log("Level complete!"); levelFinish?.Invoke(); inGame = false; if (GameSettings.sfxOn) { other.transform.GetChild(0).gameObject.SetActive(true); } } if (other.gameObject.tag == "CheckPoint" && other.gameObject.GetComponent <CheckPoint>().flagged == false) { initialPos = other.transform.position; initialPos.y = other.transform.position.y + 1; other.gameObject.GetComponent <CheckPoint>().flagged = true; } if (other.gameObject.tag == "AntiBonus") { RemoveAllBonuses(); hit?.Invoke(other.contacts[0].point); } if (other.gameObject.tag == "Untagged") { hit?.Invoke(other.contacts[0].point); } } }
private void OnPlayerWin() { _source.PlayOneShot(ClipType.Win); OnLevelFinish?.Invoke(); _controller.TurnUIPageOn(PageType.Win, true, () => Time.timeScale = 0.0f); }
void FinishLevel() { CongratulateFinishStage(); OnLevelFinish.Invoke(); print("Level finished"); }