Пример #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         MenuController.ActiveMenu(Menu);
     }
 }
Пример #2
0
        public void Update()
        {
            if (!gameIsStart)
            {
                return;
            }

            if (gs.EndOfGame)
            {
                if (gs.players[0].PlayerLifeStock > gs.players[1].PlayerLifeStock)
                {
                    winnerId = 0;
                    Destroy(players[1].gameObject);
                }
                else if (gs.players[0].PlayerLifeStock < gs.players[1].PlayerLifeStock)
                {
                    winnerId = 1;
                    Destroy(players[0].gameObject);
                }
                else
                {
                    winnerId = -1;
                }

                gameIsStart = false;
                menuController.ActiveMenu(Menus.Menus.END_GAME_MENU);

                return;
            }

            SyncNumbersOfProjectiles();
            SyncProjectilesView();
            SyncPlayersView();
            SyncItemsView();
            SyncTimerView();

            GameStateRules.Step(ref gs, agent1.Act(ref gs, 0), agent2.Act(ref gs, 1));
            GameStateRules.UpdateItems(ref gs);
        }