Beispiel #1
0
 private void GameIsLost()
 {
     //TODO: End Game State
     Debug.Log("[Field] GameOver");
     CheckWrongPlacedFlags();
     CheckMinesNotFlagged();
     OnGameLost?.Invoke();
 }
 public override void Decrease(int amount)
 {
     ModifyAmount(-amount);
     if (Amount <= 0)
     {
         Amount = 0;
         OnGameLost?.Invoke(null);
     }
 }
Beispiel #3
0
 void Start()
 {
     OnTitanSpawned += EventManager_OnTitanSpawned;
     OnTitanKilled  += EventManager_OnTitanKilled;
     OnRestart      += EventManager_OnRestart;
     OnUpdate       += EventManager_OnUpdate;
     OnGameWon      += EventManager_OnGameWon;
     OnGameLost     += EventManager_OnGameLost;
     OnPlayerKilled += EventManager_OnPlayerKilled;
 }
Beispiel #4
0
 private void OnBaseZeroHealth()
 {
     if (!gameCanFinish)
     {
         return;
     }
     if (_isFinished)
     {
         return;
     }
     OnGameLost?.Invoke();
     _isFinished = true;
 }
Beispiel #5
0
 private void FixedUpdate()
 {
     if (currentTemp < winTemp)
     {
         if (OnGameWon != null)
         {
             OnGameWon.Invoke();
         }
     }
     if (currentTemp > maxTemp)
     {
         if (OnGameLost != null)
         {
             OnGameLost.Invoke();
         }
     }
 }
Beispiel #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="user">User</param>
        /// <param name="gameOptions">Game options</param>
        internal GameManager(User user, GameOptions gameOptions)
        {
            this.user         = user;
            GameOptions       = gameOptions;
            Level             = gameOptions.StartingLevel;
            lastBlockStepTime = DateTime.Now;
            gameManagerThread = new Thread((that) =>
            {
                if (that is GameManager)
                {
                    GameManager game_manager = (GameManager)that;
                    while (game_manager.keepRunning)
                    {
                        EBlock block;
                        EBlockStepState step_state = BlockStep(out block);
                        switch (step_state)
                        {
                        case EBlockStepState.Nothing:
                            break;

                        case EBlockStepState.Move:
                            OnBlockMoved?.Invoke(block);
                            break;

                        case EBlockStepState.Land:
                            OnBlockLanded?.Invoke(block);
                            break;

                        case EBlockStepState.SelectNew:
                            OnNewBlockSelected?.Invoke(block);
                            break;

                        case EBlockStepState.Loose:
                            OnGameLost?.Invoke(block);
                            break;
                        }
                        Thread.Sleep(2);
                    }
                }
            });
            gameManagerThread.Start(this);
        }
Beispiel #7
0
 public void GameLost()
 {
     OnGameLost?.Invoke();
 }
Beispiel #8
0
 public void unsubscribe(OnGameLost func)
 {
     onGameLost -= func;
 }
Beispiel #9
0
 public void subscribe(OnGameLost func)
 {
     onGameLost += func;
 }