Beispiel #1
0
    GameStateBehaviour CreateState(GameState state)
    {
        GameStateBehaviour behaviour = GameStateFactory.Create(state);

        behaviour.transform.parent = transform;

        return(behaviour);
    }
Beispiel #2
0
        public GameStateData RegisterGameStateData(string loginToken)
        {
            if (string.IsNullOrWhiteSpace(loginToken))
            {
                throw new NoLoginTokenException();
            }

            try
            {
                //TODO: Get game state from game
                return(GetGameStateByLoginToken(loginToken));
            }
            catch (GameStateNotFoundException gameStateNotFoundEx)
            {
                Console.WriteLine(gameStateNotFoundEx.Message);
                var player    = PlayerSpaceshipFactory.Create(loginToken);
                var gameState = GameStateFactory.Create(player);
                DataCache.Add(gameState);
                Console.WriteLine("added cache");
                return(gameState);
            }
        }
Beispiel #3
0
 public void SetupGame()
 {
     _gameStateMachine.RegisterState("CoreGame", _gameStateFactory.Create("CoreGame"));
 }