コード例 #1
0
        // constructor adds Managers to the GameManager and sets state and direction
        public GameManager(LevelManager levelManager) {
            GameObject.OnDeathListener += DeathListener;
            LevelManager = levelManager;
            InputManager = LevelManager.InputManager;
            CollisionManager = new CollisionManager();
            SpawnManager = new SpawnManager();
            ScoreManager = new ScoreManager();

            // sets random start direction
            SetStartDirection();           
            OnDirectionChangedListener(CurrentDirection);

            // loops through collidables and randomizes positions on collisions
            CheckValidStartPositions();

            if (LevelManager.StartMenu != null) {
                GameState = EGameState.Init;
                LevelManager.StartMenu.Render();
            } else {
                GameState = EGameState.Running;
            }

            OnGameStateChangedListener(GameState);
            GameLoop();
        }
コード例 #2
0
        // constructor adds Managers to the GameManager and sets state and direction
        public GameManager(LevelManager levelManager) {
            GameObject.OnDeathListener += DeathListener;
            LevelManager = levelManager;
            InputManager = new InputManager();
            CollisionManager = new CollisionManager();
            SpawnManager = new SpawnManager();

            GameState = EGameState.Running;
            OnGameStateChangedListener(GameState);

            CurrentDirection = EDirection.South;
            OnDirectionChangedListener(CurrentDirection);

            GameLoop();
        }