private void Restart()
 {
     field             = null;
     playerCircle      = null;
     playerCross       = null;
     playerCurrentTurn = null;
     result            = null;
     playerSelected    = false;
 }
Example #2
0
 public SpawnSys(
     int floor,
     ISpawnConfig spawnConfig,
     IGameResult <EntityList> previousFloorResult
     )
 {
     FloorFactor         = spawnConfig.FloorFactor(floor);
     SpawnConfig         = spawnConfig;
     PreviousFloorResult = previousFloorResult;
 }
Example #3
0
 private static ShotDetails CreateShotHistory(IShot shot, IGameResult breakResult)
 {
     return(new ShotDetails
     {
         ShotResult = breakResult.Result,
         LastPlayedBall = shot.FirstTouchedBall,
         Player = shot.Player,
         Shot = shot
     });
 }
Example #4
0
        private GameEngine <EntityList> GetFloorDown(IGameResult <EntityList> result)
        {
            StopCurrentFloorEngine();
            if (CurrentFloor < FloorEngines.Count)
            {
                return(GetRestartFloorEngine(1, result));
            }

            return(CreateGameStage(result));
        }
Example #5
0
        public void RenderResult(IGameResult gameResult)
        {
            if (gameResult.IsDraw)
            {
                Console.WriteLine("Game was a draw");
                Console.WriteLine("");
                return;
            }

            Console.WriteLine("Game won by {0}", gameResult.Winner.Name);
            Console.WriteLine("");
        }
Example #6
0
 public virtual void EndGame(IGameResult <EntityList> gameResult, bool pauseBeforeQuit = false)
 {
     Result = gameResult;
     if (pauseBeforeQuit)
     {
         Pause = true;
     }
     else
     {
         Quit = true;
     }
 }
Example #7
0
        private GameEngine <EntityList> GetRestartFloorEngine(int floorMovement, IGameResult <EntityList> result)
        {
            var currentFloorEngine = CurrentFloorEngine;

            CurrentFloor += floorMovement;
            var nextFloorEngine = CurrentFloorEngine;

            nextFloorEngine.Game.Restart(result);
            nextFloorEngine.SetInputControls(currentFloorEngine.InputHandler);

            return(nextFloorEngine);
        }
        public async Task EndGame(GameInstance instance, IGameResult result)
        {
            instance.Result = result;
            Data.RemoveActiveGame(instance);

            await GameBroadcast(instance, Messages.GameOver());

            foreach (var c in instance.Connections)
            {
                c.Game = null;
            }
        }
Example #9
0
        private void EndGame(
            IGameResult <EntityList> gameresult, StairsComp stairsComp, bool pauseBeforeQuit = false
            )
        {
            // reset for next floor execution
            HasExitedStairs             = false;
            PlayerPositionComp.Position = stairsComp.Position.Add(BoardComp.TILE_SIZE / 2);

            gameresult.Data.Clear();
            gameresult.Data.Add(PlayerEntity.Id, PlayerEntity);

            Game.GameEvents.Add(stairsComp.GetGameEvent());
            Game.EndGame(gameresult, pauseBeforeQuit);
        }
Example #10
0
 private void Event_OnGameEnded(object sender, EventEmitter.GameResultEventArgs e)
 {
     StopGame();
     result = new GameResult(e.IsDraw, e.Winner);
     if (e.Winner != null && e.Winner.GetType().Equals(typeof(Player)))
     {
         score.PlayerWins();
     }
     if (e.Winner != null && e.Winner.GetType().Equals(typeof(PlayerAI)))
     {
         score.RobotWins();
     }
     Events.OnShowScore_Event();
 }
Example #11
0
        private void GameOnOnGameResult(IGameResult gameSucess)
        {
            _gamesRun++;
            WriteLog($"Game result:{gameSucess.Success} time:{gameSucess.ReactiontimeMillisseconds}");
            if (gameSucess.Success)
            {
                _pointSucess++;
                _pressTimesum += gameSucess.ReactiontimeMillisseconds;
            }
            else
            {
                _pointError++;
            }

            UpdateScoreScreen();
        }
Example #12
0
        private GameEngine <EntityList> CreateGameStage(
            IGameResult <EntityList> result = null,
            int?gameSeed = null
            )
        {
            LoadingScreenRenderer.Render();

            var isFirstStage = result == null;

            if (isFirstStage)
            {
                SaveGlobalConfig();
            }

            if (gameSeed.HasValue)
            {
                GameContext.SetSeed(gameSeed.Value);
            }

            var gameConfig = YamlParser.ParseFile <RogueskivGameConfig>(AppConfig.GameModeFilesPath, AppConfig.GameMode);

            gameConfig.GameFPS    = GameContext.GameFPS;
            gameConfig.GameSeed   = GameContext.GameSeed;
            gameConfig.FloorCount = AppConfig.FloorCount;

            if (FloorEngines.Count == 0)
            {
                UxContext.PlayMusic(gameConfig.GameMusicFilePath, gameConfig.GameMusicVolume);
            }

            CurrentFloor = FloorEngines.Count + 1;
            var game      = new RogueskivGame(GameStageCodes.Game, gameConfig, CurrentFloor, result, OnGameEnd);
            var renderer  = new RogueskivRenderer(UxContext, GameContext, game, AppConfig, gameConfig);
            var userInput = new RogueskivInputHandler(UxContext, game, renderer);
            var engine    = new GameEngine <EntityList>(GameContext, userInput, game, renderer);

            FloorEngines.Add(engine);

            return(engine);
        }
Example #13
0
        private GameEngine <EntityList> GetFloorUp(IGameResult <EntityList> result)
        {
            StopCurrentFloorEngine();

            return(GetRestartFloorEngine(-1, result));
        }
Example #14
0
 public virtual void Restart(IGameResult <EntityList> result)
 {
     Quit   = false;
     Result = default;
 }
Example #15
0
        public bool PostStats(IGameResult gameResult)
        {
            var result = this.httpClient.PostAsync($"/evolutions/{gameResult.AlgorithmId}/result", this.ConverToContent(gameResult)).Result;

            return(result.IsSuccessStatusCode);
        }
 public Task GameOver(IGameResult result)
 {
     return(_logic.EndGame(_game, result));
 }
Example #17
0
 public Game(IStoreData storeData, IRunTheGame runTheGame, IGameResult gameResult)
 {
     _storeData  = storeData;
     _runTheGame = runTheGame;
     _gameResult = gameResult;
 }