void HandleMiscInputs() { if (Input.GetButtonDown(GameConstants.BTN_RESET)) { God.GetSavior().ReloadCurrentLevel(); } equipRenderer.SetActive(this.currentlyEquipped != null); }
// Update is called once per frame void Update() { DoInitIfNeeded(); HandleMiscInputs(); HandleShowInventory(); if (!God.IsPaused()) { HandleUsing(); HandleMotion(); } HandleInteraction(); if (!God.GetSavior().SaveMode) { God.GetStats().incrementStat("player_movement", rb.velocity.magnitude * Time.deltaTime); } }
void TryMoveToNextLevel(Collider2D player) { Optional <Player> collidedPlayer = Optional <Player> .Of(player.gameObject.GetComponent <Player>()); Optional <Cat> theCat = God.GetCat(true); if (theCat.IsPresent() && collidedPlayer.IsPresent()) { Vector2 dist = theCat.Get().transform.position - collidedPlayer.Get().transform.position; if (dist.SqrMagnitude() < GameConstants.MAX_CAT_DIST_FOR_LEVEL_END) { // I know this is a bandaid, but it fixes a problem that occurs when you carry yarn into a scene that also has yarn in it GameObject[] toyBalls = GameObject.FindGameObjectsWithTag("DeleteOnTransition"); for (int i = 0; i < toyBalls.Length; i++) { // Debug.Log ("destroy ball"); // Debug.Log ("length" + (toyBalls [i]).GetComponent<ToyBall>().GetOwner ().Items.Count); if ((toyBalls [i]).GetComponent <ToyBall> ().GetOwner() != null) { (toyBalls [i]).GetComponent <ToyBall> ().GetOwner().Items.Remove(toyBalls [i].GetComponent <ToyBall> ()); } // Debug.Log ("new length" + (toyBalls [i]).GetComponent<ToyBall>().GetOwner ().Items.Count); Destroy(toyBalls [i]); } God.GetSavior().TransitionToNewLevel(LevelToLoad, true); } else { if (hintToBringCat) { God.ShowText(HintsList.HINT_TO_BRING_CAT); hintToBringCat = false; } } } }
private void ResetButtonOnClick() { God.GetSavior().ReloadCurrentLevel(); }
IEnumerator ResetLevel() { yield return(new WaitForSeconds(resetPause)); God.GetSavior().ReloadCurrentLevel(); }