Beispiel #1
0
    public void Update()
    {
        if (!gametimer.Running)
        {
            gametimertext.text = " ";
        }
        else
        {
            gametimertext.text = gametimer.SecondsLeft.ToString("0.");
        }
        //Player won or lose

        if (reqscore <= score && gametimer.Running)
        {
            win.SetActive(true);
            gameOver.Invoke();
            Time.timeScale = 1;
            gametimer.Stop();
            state = true;
        }
        else if (!gametimer.Running && !state)
        {
            lose.SetActive(true);
            gameOver.Invoke();
            Time.timeScale = 1;
            gametimer.Stop();
        }
    }
Beispiel #2
0
 public void CheckLoss(WhiteBloodCell wbc)
 {
     if (player.GetComponent <PlayerTemp> ().currentWhiteBloodCellCount > 150000)
     {
         gameOverEvent.Invoke(false);
     }
 }
Beispiel #3
0
 //Проверка команды
 private void CheckTeam(TeamController teamController)
 {
     if (teamController.IsCanContinue())
     {
         GameOverEvent?.Invoke(this, new GameEventArgs($"{teamController.Team.Name} team - 5 players are injured"));
     }
 }
Beispiel #4
0
 public static void GameOver()
 {
     if (GameOverEvent != null)
     {
         GameOverEvent.Invoke();
     }
 }
Beispiel #5
0
 public void GameOver()
 {
     gameActive = false;
     gameOverEvent.Invoke();
     Time.timeScale = 0;
     StopAllCoroutines();
 }
Beispiel #6
0
        public void GameOver()
        {
            isGameOver = true;
            GameOverEvent?.Invoke();

            Time.timeScale = 0f;
        }
Beispiel #7
0
    public void LoseLife(int amount)
    {
        currentNumOfLives -= amount;
        onHealthChangeEvent.Invoke(currentNumOfLives, true);

        if (currentNumOfLives <= 0)
        {
            Debug.Log("Game Over");
            onGameOverEvent.Invoke(true);

            StartCoroutine(OnGameOver());
        }
        else
        {
            StartCoroutine(StartTauntAnimation());
        }
    }
Beispiel #8
0
    public void GameOver()
    {
        // TODO: Reset Timescale on reload.

        Time.timeScale = 0f;

        GameOverEvent?.Invoke();
    }
Beispiel #9
0
    public void InvokeGameOverEvent()
    {
        gameIsOver = true;

        if (GameOverEvent != null)
        {
            GameOverEvent.Invoke();
        }
    }
Beispiel #10
0
 private void OnGameOver()
 {
     Destroy(gameBall);
     if (GameOverEvent != null)
     {
         score = scoreCounter.score;
         GameOverEvent.Invoke();
     }
 }
Beispiel #11
0
 //what to do when the game is lost
 void GameOver()
 {
     //end the game
     IsGameActive = false;
     //Reveal The Word
     WordToGuess.Reveal();
     // invoke the event only if someone listens to it (not Null)
     GameOverEvent?.Invoke(this, false);
 }
Beispiel #12
0
 // health support
 void ReduceHealth(int damage)
 {
     Debug.Log("reduce health: " + damage.ToString());
     health -= damage;
     if (health <= 0)
     {
         gameOverEvent.Invoke();
     }
 }
Beispiel #13
0
 private void GameOver()
 {
     Time.timeScale = 0;
     if (GameOverEvent != null)
     {
         GameOverEvent.Invoke();
     }
     enabled = false;
 }
Beispiel #14
0
        void OnLifeLost(int lifes)
        {
            if (lifes > 0)
            {
                return;
            }

            StopLevel();
            GameOverEvent?.Invoke(false);
        }
Beispiel #15
0
        public void OnGameOver()
        {
            Cursor.visible = true;
            StartCoroutine(Fade(Color.clear, new Color(0, 0, 0, 0.75f), 1));
            gameOverScoreUI.text = scoreUI.text;

            scoreUI.gameObject.SetActive(false);
            healthBar.transform.parent.gameObject.SetActive(false);
            gameOverUI.SetActive(true);

            gameOverEvent.Invoke();
        }
Beispiel #16
0
        private void OnRunnerDied(BaseRunner runner)
        {
            Runners.Remove(runner);
            KillAllRunners -= runner.Die;

            if (Runners.Count < 1)
            {
                GetTree().Paused = true;

                Reset();
                GameOverEvent?.Invoke();
            }
        }
Beispiel #17
0
        private void OnAlivePlayerUnitsChanged(int aliveUnitNo)
        {
            if (aliveUnitNo == 0)
            {
                if (onVictoryEvent != null)
                {
                    onVictoryEvent.Invoke();
                }
                _isGameRunning = false;

                playerWInEvent?.Invoke();
            }
        }
Beispiel #18
0
        private void OnAliveAIUnitsChanged(int aliveUnitNo)
        {
            if (aliveUnitNo == 0)
            {
                if (onDefeatEvent != null)
                {
                    onDefeatEvent.Invoke();
                }
                _isGameRunning = false;

                playerLoseEvent?.Invoke(); //
            }
        }
 public void KillPlayer()
 {
     lives.value--;
     if (lives.value == 0)
     {
         coins.value = _coinsAtLevelStart;
         DWInput.userInputEnabled = false;
         GameOverEvent?.Invoke();
     }
     else
     {
         SceneResetEvent?.Invoke();
     }
 }
Beispiel #20
0
    private void EnterGameState(GameState _state)
    {
        switch (_state)
        {
        case GameState.Shooting:
            ResetBallsShotData();
            m_inputManager.InputShotEvent       += OnPlayerShotInput;
            m_inputManager.InputMoveCameraEvent += OnMoveCameraInput;

            m_cameraManager.SmoothlyMoveToNewPositionWithAngle(0f);
            break;

        case GameState.ProcessingShot:
            break;

        case GameState.EndOfShotScoredPoint:
            ScoredPointEvent?.Invoke();

            //checking if Game is over
            if (ScoreManager.Instance)
            {
                if (ScoreManager.Instance.CurrentGameScore >= m_gameOverScoreToReach)
                {
                    SwitchGameState(GameState.GameOverScreen);
                }
            }
            else
            {
                Debug.LogError("Without a ScoreManager there will be no GameOver.");
            }
            break;

        case GameState.PreReplay:
            break;

        case GameState.ProcessingReplay:
            m_whiteBall.OnPlayerShot(m_lastShotData.shotPower, m_lastShotData.shotDirection);
            break;

        case GameState.GameOverScreen:
            GameOverEvent?.Invoke();
            break;

        default:
            break;
        }

        EnterStateEvent?.Invoke(_state);
    }
Beispiel #21
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Pumpkin"))
        {
            rbKnife.velocity = Vector3.zero;
            transform.parent = collision.transform;
            stuck            = true;

            Handheld.Vibrate();
        }

        else if (collision.gameObject.CompareTag("Knife"))
        {
            if (collision.gameObject.GetComponent <Knife>().stuck)
            {
                rbKnife.velocity = Vector3.zero;
                transform.parent = null;

                rbKnife.gravityScale = 10;
                gameObject.transform.Rotate(0, 0, 12);

                knifeCol = true;

                GameOverEvent.Invoke();

                Handheld.Vibrate();
            }
        }

        else if (collision.gameObject.CompareTag("KnifeInPum"))
        {
            if (collision.gameObject.GetComponent <Knife>().stuck)
            {
                rbKnife.velocity = Vector3.zero;
                transform.parent = null;

                rbKnife.gravityScale = 10;
                gameObject.transform.Rotate(0, 0, 12);

                knifeCol = true;

                GameOverEvent?.Invoke();

                Handheld.Vibrate();
            }
        }
    }
Beispiel #22
0
        public void Collide(Player player)          //Check if the player collides with itself.
        {
            if (collidables[player.snakeBody.First().X, player.snakeBody.First().Y] != null)
            {
                if (collidables[player.snakeBody.First().X, player.snakeBody.First().Y] is Player)
                {
                    player.Remove(this);

                    Player playerFromMatrix = (Player)collidables[player.snakeBody.First().X, player.snakeBody.First().Y];

                    if (playerFromMatrix.playerID != player.playerID)
                    {
                        playerFromMatrix.Score += 5;
                    }

                    if (Players.Count < 1)
                    {
                        GameOverEvent.Invoke(player.playerID);
                    }
                }
            }
        }
Beispiel #23
0
        private void TimerCallback(object sender, Timers.ElapsedEventArgs e)
        {
            ++timeGone;
            if (timeGone == matchTime)
            {
                string result;

                if (HomeManager.Team.TeamScore == GuestManager.Team.TeamScore)
                {
                    //Проверка на оставшееся дополнительное время
                    if (additionalTime != 0)
                    {
                        --additionalTime;
                        AdditionalTimeEvent();
                        return;
                    }
                    else
                    {
                        result = "Draw.";
                    }
                }
                else
                {
                    if (HomeManager.Team.TeamScore > GuestManager.Team.TeamScore)
                    {
                        result = "Home Team wins.";
                    }
                    else
                    {
                        result = "Guest Team wins";
                    }
                }
                GameOverEvent?.Invoke(this, new GameEventArgs($"Time left. {result}. Score <{HomeManager.Team.TeamScore} - {GuestManager.Team.TeamScore}>"));
                return;
            }
        }
 public void GameOver()
 {
     _gameOverScreen.SetActive(true);
     Time.timeScale = 0;
     GameOverEvent?.Invoke();
 }
Beispiel #25
0
 public static void GameOver()
 {
     RevealAllMines(false);
     GameOverEvent.Invoke();
 }
Beispiel #26
0
 public void GameOverEventCall()
 {
     GameOverEvent?.Invoke();
 }
Beispiel #27
0
 public override void OnEnter()
 {
     base.OnEnter();
     GameOverEvent.Invoke();
 }
Beispiel #28
0
 //wat to do when the game is won
 void WinGame()
 {
     IsGameActive = false;
     //invoke the event only if someone listens to it (not Null), pass true to indicate a win
     GameOverEvent?.Invoke(this, true);
 }
Beispiel #29
0
 public void RequestGameOverEvent()
 {
     GameOverEvent?.Invoke();
 }
 public void DoITTT()
 {
     OnGameOver.Invoke();
 }