Ejemplo n.º 1
0
    /*************************
     *******   SCORE   *******
     ************************/

    private IEnumerator DoUpdatePlayersSore(bool _isPlayerOneVictory)
    {
        yield return(new WaitForSeconds(1));

        scoreAnchor.SetActive(true);

        yield return(new WaitForSeconds(.5f));

        GameManager.PlayClipAtPoint(GameManager.I?.Scoresound, Camera.main.transform.position);
        int _score = _isPlayerOneVictory ? GameManager.I.PlayerOneScore : GameManager.I.PlayerTwoScore;

        if (_isPlayerOneVictory)
        {
            playerOneScore[_score - 1].SetTrigger("Activate");
        }
        else
        {
            playerTwoScore[_score - 1].SetTrigger("Activate");
        }

        if (_score == playerOneScore.Length)
        {
            GameManager.PlayClipAtPoint(_isPlayerOneVictory ? GameManager.I?.PlayerOneWin : GameManager.I?.PlayerTwoWin, Camera.main.transform.position);
        }

        yield return(new WaitForSeconds(1.5f));

        // Call game end of player victory
        if (_score == playerOneScore.Length)
        {
            OnEndGame?.Invoke(_isPlayerOneVictory);

            if (_isPlayerOneVictory)
            {
                playerOneVictory.SetActive(true);
            }
            else
            {
                playerTwoVictory.SetActive(true);
            }

            foreach (Animator _scoreAnim in playerOneScore)
            {
                _scoreAnim.SetTrigger("Reset");
            }
            foreach (Animator _scoreAnim in playerTwoScore)
            {
                _scoreAnim.SetTrigger("Reset");
            }

            GameManager.I?.PlayVictory();
            yield return(new WaitForSeconds(GameManager.I.Victory.length + 1));

            GameManager.I?.ReloadTuto();
        }
        else
        {
            GameManager.I?.LoadRandomLevel();
        }
    }
Ejemplo n.º 2
0
 public void CheckGoal(int laps)
 {
     if (laps >= MaxLaps)
     {
         OnEndGame?.Invoke();
     }
 }
Ejemplo n.º 3
0
 public void EndGame()
 {
     if (_isPlaying)
     {
         _isPlaying = false;
         OnEndGame?.Invoke();
         MenusController.Instance.Show(MenuType.ENDGAME);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// End game event
 /// </summary>
 private void EndGameEvent()
 {
     if (IsGameInProgress)
     {
         IsGameInProgress = false;
         IsGamePaused     = false;
         OnEndGame?.Invoke();
     }
 }
Ejemplo n.º 5
0
 public void EndGame()
 {
     OnEndGame?.Invoke();
     lastEndTime = Time.realtimeSinceStartup;
     if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("GameScene"))
     {
         SceneManager.LoadScene("MainMenu");
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Close
 /// </summary>
 public void Close()
 {
     // ...
     if (gameManager != null)
     {
         gameManager = null;
         OnEndGame?.Invoke();
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// New game started event
 /// </summary>
 /// <param name="startingHeight">Starting height</param>
 /// <param name="startingLevel">Starting level</param>
 /// <param name="linesPerLevel">Lines per level</param>
 /// <param name="levelIncrement">Level increment</param>
 /// <param name="linesPerSpecial">Lines per special</param>
 /// <param name="specialsAdded">Specials added</param>
 /// <param name="specialCapacity">Special capacity</param>
 /// <param name="blockFrequencies">Block frequencies</param>
 /// <param name="specialFrequencies">Special frequencies</param>
 /// <param name="displayAverageLevels">Display average levels</param>
 /// <param name="classicMode">Classic mode</param>
 private void NewGameStartedEvent(uint startingHeight, uint startingLevel, uint linesPerLevel, uint levelIncrement, uint linesPerSpecial, uint specialsAdded, uint specialCapacity, IReadOnlyList <EBlock> blockFrequencies, IReadOnlyList <ESpecial> specialFrequencies, bool displayAverageLevels, bool classicMode)
 {
     if (gameManager != null)
     {
         OnEndGame?.Invoke();
     }
     gameManager      = new GameManager(user, new GameOptions(startingHeight, startingLevel, linesPerLevel, levelIncrement, linesPerSpecial, specialsAdded, specialCapacity, blockFrequencies, specialFrequencies, displayAverageLevels, classicMode));
     IsGameInProgress = true;
     OnNewGameStarted?.Invoke(gameManager);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Ends the game.
 /// </summary>
 public static void EndGame()
 {
     try
     {
         State = GameState.GameOver;
         OnEndGame.Invoke(null, null);
     }
     catch
     {
     }
 }
Ejemplo n.º 9
0
 protected void OccurShapeDown()
 {
     if (leftTop[0, 0] < 0 && OnEndGame != null)
     {
         OnEndGame.Invoke();
     }
     else if (OnShapeDown != null)
     {
         OnShapeDown.Invoke();
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Stop game
        /// </summary>
        public bool StopGame()
        {
            bool ret = (gameManager != null);

            if (ret)
            {
                gameManager = null;
                OnEndGame?.Invoke();
            }
            return(ret);
        }
Ejemplo n.º 11
0
    private IEnumerator EndGameCoroutine()
    {
        yield return(new WaitUntil(() => _lastCard == null));

        IsBlockedControl = true;
        if (_health.CurrentHealth > 0)
        {
            _isWin = true;
        }
        OnEndGame?.Invoke(_isWin);
    }
Ejemplo n.º 12
0
 private void BackTitle()
 {
     IsGameEnd = true;
     DOTween.ToAlpha(
         () => _forground.color,
         (color) => _forground.color = color,
         1f,
         _fadeInForground).onComplete = () =>
     {
         _tweetCanvas.gameObject.SetActive(true);
         _thief.Kill();
         OnEndGame?.Invoke();
     };
 }
Ejemplo n.º 13
0
        private void Awake()
        {
            enemies.TimeBetweenWaves = JsonWorker.Deserialize <ConfigFile>("config.txt").timeBetweenWaves;

            _player = new Player();
            _player.SetStartHealth(startPlayerHealth);

            _player.OnPlayerDeath += () =>
            {
                enemies.Stop();
                OnEndGame?.Invoke(enemies.KilledEnemiesCount);

                Time.timeScale = 0;
            };
        }
Ejemplo n.º 14
0
        private void RightGuess(ValueTuple <int, int> paired)
        {
            allImages[paired.Item1].button.interactable = false;
            allImages[paired.Item2].button.interactable = false;

            allImages[paired.Item1].image.gameObject.SetActive(false);
            allImages[paired.Item2].image.gameObject.SetActive(false);
            currentlyGuessed += 2;
            if (currentlyGuessed >= allImages.Count)
            {
                var toStop = GameTimers.GetTimer(gameState.ToString());
                toStop.Stop();
                OnEndGame?.Invoke(true);
            }
        }
Ejemplo n.º 15
0
        public void AcceptUserAnswer(string userAnswer)
        {
            if (userAnswer == currentQuestion.Answer)
            {
                user.AddRightAnswer();
            }

            currentQuestionNumber++;

            if (IsEnd)
            {
                if (OnEndGame != null)
                {
                    OnEndGame.Invoke(this, EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Stop game
        /// </summary>
        /// <returns>"true" if successful, otherwise "false"</returns>
        public bool StopGame()
        {
            bool ret = (gameManager != null);

            if (ret)
            {
                OnEndGame?.Invoke();
                foreach (IUser user in users)
                {
                    if (user is ServerUser)
                    {
                        ((ServerUser)user).ServerConnection.SendWinlistMessageAsync(Winlist);
                    }
                }
                gameManager = null;
            }
            return(ret);
        }
Ejemplo n.º 17
0
        private void CheckWinCondition()
        {
            foreach (var foundation in foundations)
            {
                if (foundation.currentRank != CardRank.K)
                {
                    return;
                }
            }

            var totalTime = FindObjectOfType <GameTimer>().ElapsedTime;

            if (totalTime > BONUS_POINTS_TIMER_THRESHOLD)
            {
                score += (BONUS_POINTS_BASE / totalTime) * BONUS_POINTS_FACTOR;
            }
            OnEndGame?.Invoke();

            Debug.Log("[GameManager] Game Won..");
        }
Ejemplo n.º 18
0
    /// <summary>
    /// Sets the board and all the squares to empty
    /// </summary>
    public void CleanBoard()
    {
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                board[i, j]       = Marks.Empty;
                backupBoard[i, j] = Marks.Empty;
                squares[i, j].Set(Marks.Empty);
            }
        }

        emptySquares = 16;
        SelectFirstPlayer();
        EnableArrows?.Invoke();
        OnEndGame?.Invoke();
        hasShifted = false;
        isInGame   = true;
        winGamePanel.gameObject.SetActive(false);
    }
Ejemplo n.º 19
0
 public void GameOver()
 {
     OnEndGame?.Invoke();
 }
Ejemplo n.º 20
0
 public static void EndGame(bool isWin) => OnEndGame?.Invoke(isWin);
Ejemplo n.º 21
0
 private void ShowScoreScene()
 {
     OnEndGame?.Invoke();
     SceneManager.LoadScene((int)Scenes.ScoreScreen, LoadSceneMode.Additive);
 }
Ejemplo n.º 22
0
 private void EndGame()
 {
     noteSpace.gameObject.SetActive(false);
     musicList.gameObject.SetActive(true);
     OnEndGame?.Invoke();
 }
Ejemplo n.º 23
0
 public virtual void EndGame()
 {
     OnEndGame?.Invoke();
     window.writeln(">> Game ended");
     phase = Phases.ENDGAME;
 }
Ejemplo n.º 24
0
 public void EndOfGame(bool isWin)
 {
     OnEndGame?.Invoke(isWin);
 }
Ejemplo n.º 25
0
 public void StartEndGame()
 {
     endGame = true;
     OnEndGame?.Invoke(killCount);
 }
Ejemplo n.º 26
0
 public static void EndGame(BattleEntities.Player playerWinner)
 {
     OnEndGame?.Invoke(playerWinner);
 }
Ejemplo n.º 27
0
 public static void NewGame()
 {
     Init();
     OnEndGame?.Invoke();
 }
 public static void EndGame()
 {
     OnEndGame?.Invoke();
 }
 internal void OnEndGame_Trigger() => OnEndGame?.Handle(args: new object[] { SR.PlayerState }, unique: true);
Ejemplo n.º 30
0
 public void SendEndGame()
 {
     OnEndGame?.Invoke();
 }