void Die () { if (dead) return; dead = true; deathPoint.enemiesRemaining--; kanvas.Scores (punkty); if (gameObject.name == "Motyl") { FinalS.SaveScores ("Punkty", kanvas.scoreNumber); GameObject boha = Resources.Load ("Bohaterka") as GameObject; boha = Instantiate (boha, transform.position, boha.transform.rotation) as GameObject; FinalS.TheEnd (); } Destroy (transform.parent.gameObject); }
void Update() { if (Input.GetKey(KeyCode.P)) { resetTimer += Time.deltaTime; if (resetTimer > 5) { FinalS.ResetScores(); } } if (currentHealth < startingHealth && currentHealth > 0) { currentHealth += healPerSecond * Time.deltaTime; } if (currentHealth > startingHealth) { currentHealth = startingHealth; } if (Input.GetKeyDown(KeyCode.O)) { menu = !menu; playing = !playing; } // Obracania gracza oraz broni. if (playing) { Turning(); float wheelInput = Input.GetAxisRaw("Mouse ScrollWheel"); if (wheelInput > 0) { EquipWeapon(1); } else if (wheelInput < 0) { EquipWeapon(-1); } celowniki.enabled = true; } else { celowniki.enabled = false; } if (equiping) { equipTime += Time.deltaTime; bronie.SetActive(true); if (equipTime >= 1) { equiping = false; bronie.SetActive(false); equipTime = 0; } } if (FinalS.theEnd) { FinalS.Update(); } if (isDead) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } }