private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Ennemie") { End.GameOver(); } }
private string MakeATurn(int userXint) { //1. IF reached the top if (Settings.YCoordinate[userXint - 1] < 0) { //The column is full return("reload"); } Settings.Board[Settings.YCoordinate[userXint - 1], userXint - 1] = Settings.IsPlayerOne ? CellState.X : CellState.O; Settings.NumTurns++; //IF win condition was fulfilled if (EndGame.GameOver(userXint, Settings)) { GameOver = true; return("reload"); } //IF board is full if (Settings.NumTurns == Settings.BoardHeight * Settings.BoardWidth) { FullBoard = true; return("reload"); } // IF not change player, save state and let's continue Settings.YCoordinate[userXint - 1]--; Settings.IsPlayerOne = !Settings.IsPlayerOne; RuntimeData.GameSettings = Settings; return("OK"); }
void Kill() { deathExplosion.Play(); deathExplosionSound.Play(); GetComponent <Collider2D>().enabled = false; GetComponentInChildren <SpriteRenderer>().gameObject.SetActive(false); enabled = false; projectile.gameObject.SetActive(false); EndGame.GameOver(); }
private void GameOver(EndGame.GameResult result) { gameOver = true; endGameButton.GameOver(result); //clear unset tiles, in case player has hit one before this was called foreach (GameTile tile in tiles) { if (!tile.set) { tile.ClearTile(); } } }
// Update is called once per frame void Update() { if (timerActive == true) { //-Time.deltaTime jer 60fps nekad zna biti varijabilan zbog rada CPU-a currentTime = currentTime - Time.deltaTime; if (currentTime <= 0) { StopTimer(); EndGame endGameScript = GameObject.Find("FloorExit").GetComponent <EndGame>(); endGameScript.GameOver("Time's Up!"); } } TimeSpan time = TimeSpan.FromSeconds(currentTime); currentTimeText.text = time.Minutes.ToString() + ":" + time.Seconds.ToString(); }