// Update is called once per frame
        private IEnumerator Startup()
        {
            State = ProgramStateEnum.StartupScreen;

            // Wait for startup screen to finish
            startupScreen.Activate(State);
            logoObject.SetActive(true);
            while (startupScreen.IsActive)
            {
                yield return(null);
            }
            logoObject.SetActive(false);

            // See whether the player asked to quit
            switch (startupScreen.Result)
            {
            case ProgramStateEnum.Quitting:
                // Done!
                Application.Quit();
                yield break;

            case ProgramStateEnum.ChooseRoom:
            default:
                // Move forward to room scanning
                break;
            }

            // Room scanning!
            StartCoroutine(RoomScanning());

            // Room scanning will launch another loop, so break here
            yield break;
        }
        private IEnumerator Gameplay()
        {
            // Reset the old gameplay state
            //LanderGameplay.Instance.Reset();

            // Show the controls screen
            State = ProgramStateEnum.ControlsDisplay;
            // Wait for the player to dismiss
            controlsScreen.Activate(State);
            while (controlsScreen.IsActive)
            {
                yield return(null);
            }

            // Now the player will choose where to place the landing pad
            State = ProgramStateEnum.LandingPadPlacement;

            // Wait for landing pad placement to finish
            placementScreen.Activate(State);
            while (placementScreen.IsActive)
            {
                yield return(null);
            }

            State = ProgramStateEnum.Gameplay;
            // Launch gameplay screen and wait for the result
            gameplayScreen.Activate(State);
            while (gameplayScreen.IsActive)
            {
                yield return(null);
            }

            State = ProgramStateEnum.GameplayFinished;
            gameplayFinishedScreen.Activate(State);
            while (gameplayFinishedScreen.IsActive)
            {
                yield return(null);
            }

            // Launch another loop based on the player's choice
            switch (gameplayFinishedScreen.Result)
            {
            case ProgramStateEnum.StartupScreen:
                StartCoroutine(Startup());
                break;

            case ProgramStateEnum.ChooseRoom:
            default:
                StartCoroutine(Gameplay());
                break;
            }
            yield break;
        }
Esempio n. 3
0
        public void AddScreen(GameScreen screen)
        {
            screen.ScreenManager = this;
            screen.IsExiting = false;

            if (_isInitialized)
            {
                screen.Activate(false);
            }

            _screens.Add(screen);
        }
Esempio n. 4
0
        public void AddScreen(GameScreen screen, PlayerIndex?controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.ScreenManager     = this;
            screen.IsExiting         = false;

            // If we have a graphics device, we can begin to properly init
            if (isInitialized)
            {
                screen.Activate();
            }

            screens.Add(screen);
        }
        private IEnumerator RoomScanning()
        {
            // Choose which room scanning state we want
            // If we haven't chosen a room, scan or load a room
            if (RoomScanManager.Instance.CurrentRoom == RoomScanManager.RoomEnum.None)
            {
                // If we have saved rooms, let the player choose one
                if (RoomScanManager.Instance.HasSavedRooms)
                {
                    State = ProgramStateEnum.ScanOrLoadRoom;
                }
                else
                {
                    // Otherwise, just begin scan immediately
                    State = ProgramStateEnum.ScanRoom;
                }
            }
            else
            {
                // If we have chosen a room, let them continue or change
                State = ProgramStateEnum.ChooseRoom;
            }

            // Wait for room scan screen to finish
            roomScanScreen.Activate(State);
            while (roomScanScreen.IsActive)
            {
                yield return(null);
            }

            // Tell the environment generator to start placing rocks and stuff
            EnvironmentManager.Instance.GenerateDynamicEnvironment();

            // Gameplay!
            StartCoroutine(Gameplay());

            // Gameplay will launch another loop, so break here
            yield break;
        }
        /// <summary>
        /// Adds a new screen to the screen manager.
        /// </summary>
        public void AddScreen(GameScreen screen, System.Nullable<PlayerIndex> controllingPlayer)
        {
            screen.ControllingPlayer = controllingPlayer;
            screen.ScreenManager = this;
            screen.IsExiting = false;

            // If we have a graphics device, tell the screen to load content.
            if (isInitialized) {
            screen.Activate(false);
            }

            screens.Add(screen);

            // update the TouchPanel to respond to gestures this screen is interested in
            TouchPanel.EnabledGestures = screen.EnabledGestures;
        }