void endGame(EndGameState endGameState)
    {
        if (endGameState == EndGameState.Defeat)
        {
            if (controllerType == "Xbox360Pad")
            {
                tutorialLabel.text = "Looks like you are going to have to try again. Just press the Redo button up in the left, or the Back button on your controller";
            }
            else
            {
                tutorialLabel.text = "Looks like you are going to have to try again. Just press the Redo button up in the left.";
            }

            //WriteMessage("Looks like you are going to have to try again",1.7f,0.25f,0f);
            //WriteMessage("Just press the Redo button up in the left",1.8f,0.25f,0f);
        }
        else
        {
            tutorialLabel.text = "You have killed them all. Very good, I think you'll like what's coming next.";

            //WriteMessage("You have killed them all",1.7f,0.25f,0f);
            //WriteMessage("Very good, I think you'll like what's coming next",1.8f,0.25f,0f);
            messageCount++;
        }
    }
Esempio n. 2
0
    void InitStateMachine()
    {
        _stateMachine = new StateMachine();

        var menu         = new StartMenuState(_startMenu, _gameUI, this);
        var p1           = new PlayerMoveState(_player1);
        var p2           = new PlayerMoveState(_player2);
        var checkEndGame = new CheckEndGameState(_checkEndGameProcessor);
        var endGame      = new EndGameState(_endGameMenu, _gameUI, _checkEndGameProcessor, _grid, _player1, _player2);

        _stateMachine.AddTransition(menu, p1, TimeToPlay());
        _stateMachine.AddTransition(p1, p2, SwitchToPlayer2());
        _stateMachine.AddTransition(p2, checkEndGame, SwitchToCheckEnd());
        _stateMachine.AddTransition(checkEndGame, p1, SwitchToPlayer1());
        _stateMachine.AddTransition(checkEndGame, endGame, EndGame());
        _stateMachine.AddTransition(endGame, p1, Restart());
        _stateMachine.AddTransition(endGame, menu, ToStartMenu());

        _stateMachine.AddAnyTransition(menu, ExitGame());

        _stateMachine.SetState(menu);
        //условия перехода
        Func <bool> TimeToPlay() => () => _startMenu._startGame;//начинаем игру из стартового меню
        Func <bool> SwitchToPlayer2() => () => _player1._endMove;
        Func <bool> SwitchToCheckEnd() => () => _player2._endMove;
        Func <bool> SwitchToPlayer1() => () => _checkEndGameProcessor.ContinueGame();
        Func <bool> EndGame() => () => !_checkEndGameProcessor.ContinueGame();; //ничья или ктото победил
        Func <bool> Restart() => () => _endGameMenu._restartGame;               //рестарт игры из экрана конца игры
        Func <bool> ToStartMenu() => () => _endGameMenu._mainMenu;              //переходим в стартовое меню из экрана конца игры
        Func <bool> ExitGame() => () => false;                                  //выход в стартовое меню из любого состояния
    }
Esempio n. 3
0
 public void levelIsCompleted(EndGameState state)
 {
     if (onEndGame != null)
     {
         onEndGame(state);
     }
 }
Esempio n. 4
0
        public override void Start()
        {
            EndGameState state = GameManager.Instance.endGameState;

            message.text = GetMessage(state);
            endgameDialogImage.sprite = GetImageSprite(state);
            endgameDialog.SetActive(true);
        }
Esempio n. 5
0
        public StateManager(MainGameState parent)
        {
            game = parent;

            mainMenuState = new MainMenuState(this);
            playingState  = new PlayingState(this);
            endGameState  = new EndGameState(this);
            currentState  = mainMenuState;
        }
Esempio n. 6
0
        public void StillGoing_ReturnFalseIfInEndState()
        {
            var gameState = new EndGameState();
            var game      = BuildGame(gameState: gameState);

            var result = game.StillGoing;

            Assert.False(result);
        }
Esempio n. 7
0
 void Awake()
 {
     startGameState  = new StartGameState(this);
     startTurnState  = new StartTurnState(this);
     playerTurnState = new PlayerTurnState(this);
     dealerTurnState = new DealerTurnState(this);
     endHandState    = new EndHandState(this);
     endGameState    = new EndGameState(this);
 }
Esempio n. 8
0
    public void SaveSession(EndGameState endGameState)
    {
        CurrentSession.SessionDate      = DateTime.Now.ToLongDateString();
        CurrentSession.HighestLevel     = hero.GetCurrentLevel();
        CurrentSession.WinOrLoss        = endGameState;
        CurrentSession.ExperienceGained = hero.GetCurrentXP();

        StatsManager.sessionKeeper.Sessions.Add(CurrentSession);
        StatsManager.SaveSessions();
    }
Esempio n. 9
0
 // Update is called once per frame
 public override void Unit_Self_Update()
 {
     if (healthValue <= 0)
     {
         Die();
         //end game here
         temp = new EndGameState();
         temp.EndGame();
     }
 }
Esempio n. 10
0
        public static void Initialize()
        {
            endGameState  = new EndGameState(initialState);
            moveSnekState = new MoveSnekState(endGameState);
            initialState  = new InitialState(moveSnekState);

            States.Add("InitialState", initialState);
            States.Add("MoveSnekState", moveSnekState);
            States.Add("EndGameState", endGameState);
            CurrentState = initialState;
        }
Esempio n. 11
0
 public EndGame(EndGameState endGameState)
 {
     Action = (ecs, config) =>
     {
         var endGameCommand = new EndGameCommand()
         {
             EndGameState = endGameState
         };
         ecs.EnqueueCommand(endGameCommand);
     };
 }
Esempio n. 12
0
    void InitStates()
    {
        cardSelectionState = new CardSelectionState(this);
        pairSelectionState = new PairSelectionState(this);
        memorizeCardsState = new MemorizeCardsState(this, 0.5f);
        matchingCardsState = new MatchingCardsState(this, 0.2f);
        pauseGameState     = new PauseGameState(this);
        endGameState       = new EndGameState(this);

        gameState = cardSelectionState;
    }
Esempio n. 13
0
        public EndGameStateTest()
        {
            gameMock = new Mock <IGame>();

            var serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock
            .Setup(x => x.GetService(It.IsAny <Type>()))
            .Returns(new EndedGameState(NullLogger <EndedGameState> .Instance));

            target = new EndGameState(serviceProviderMock.Object, NullLogger <EndGameState> .Instance);
        }
Esempio n. 14
0
        public Game()
        {
            Client   = new Client(this);
            Croupier = new Croupier(this, _rnd.Next(0, 3));

            SetupState         = new SetupState(this);
            StartState         = new StartState(this);
            GettingCardsState  = new GettingCardsState(this);
            ComparePointsState = new ComparePointsState(this);
            EndGameState       = new EndGameState(this);

            _currentState = SetupState;
        }
Esempio n. 15
0
        Sprite GetImageSprite(EndGameState state)
        {
            switch (state)
            {
            case EndGameState.Victory:
            case EndGameState.GreatVictory:
                return(victoryImage);

            case EndGameState.Lose:
            case EndGameState.GreatLose:
                return(loseImage);
            }
            return(null);
        }
Esempio n. 16
0
    private void UpdateGameLogic()
    {
        EndGameState gameState = this.endGame.GetGameState();

        if (gameState != EndGameState.None)
        {
            if (gameState == EndGameState.OnUpdate)
            {
                this.endGame.OnUpdate();
                this.bankRoll = EndGame.ff9endingGameBankroll;
            }
            else if (gameState == EndGameState.Finish)
            {
                this.endGame.Finish();
                this.Exit();
            }
        }
    }
Esempio n. 17
0
        string GetMessage(EndGameState state)
        {
            switch (state)
            {
            case EndGameState.Victory:
                return("THE VICTORY");

            case EndGameState.GreatVictory:
                return("THE GREAT VICTORY");

            case EndGameState.Lose:
                return("THE DEFEAT");

            case EndGameState.GreatLose:
                return("THE GREAT DEFEAT");
            }
            return("");
        }
Esempio n. 18
0
        private int RollOut(Move move)
        {
            GamesPlayed++;

            State.DoMove(move);
            int movesMade = 1;

            while (State.EndGameState(id) == EndGameState.None)
            {
                State.DoMove(Next().GetClone());
                movesMade++;
            }

            EndGameState endGameState = State.EndGameState(id);

            State.UndoMoves(movesMade);

            return((int)endGameState);
        }
Esempio n. 19
0
    void endGame(EndGameState endGameState)
    {
        if (endGameState == EndGameState.Defeat)
        {
            Debug.Log(endGameState);
            LevelGUI.levelGUI.WriteMessage("GAME OVER ", Screen.width / 2f, Screen.height / 2f, 0f, LevelGUI.sRed, true, 80);
            GameObject.Find("RTSCameraSoundtrack").GetComponent <CameraControl>().enabled = false;
            reload = true;
        }
        else
        {
            Debug.Log(endGameState);
            LevelGUI.levelGUI.WriteMessage("YOU ARE A GOD !!", Screen.width / 2f, Screen.height / 2f, 0f, LevelGUI.sBlue, true, 80);
            GameObject.Find("RTSCameraSoundtrack").GetComponent <CameraControl>().enabled = false;
            reload = false;
        }

        startCounting = true;
    }
Esempio n. 20
0
 public void ResetGame()
 {
     checkPoints = new List <Vector3>();
     _UI.StartSetUI();
     _PLAYER.Restart();
     holdingLightObject = false;
     isHolding          = false;
     onSpecialGround    = false;
     _timer             = maxTimerInSeconds;
     _energy            = maxEnergy;
     _cDTimer           = coolDown;
     onCD = false;
     _GAME.totalSoulNo = 0;
     //timerReturnSoul = 0;
     //timerFinish = 0;
     returnSouls = false;
     //Time.timeScale = 1;
     soulReturning = EndGameState.DEFAULT;
     returnSoul    = 0;
     finish        = 0;
 }
Esempio n. 21
0
    /// <summary>
    /// Updating the tile
    /// </summary>
    /// <param name="gameTime">The object used for reacting to timechanges</param>
    public override void Update(GameTime gameTime)
    {
        //Check if the player is in the ExitTile and if so, if they are pressing E to procceed
        Level level = parent.Parent as Level;

        foreach (GameObject obj in level.Objects)
        {
            if (obj != null)
            {
                if (obj.ID == "Player")
                {
                    if (obj.Position.X > Position.X - 100 && obj.Position.X < Position.X + 100 && obj.Position.Z > Position.Z - 100 && obj.Position.Z < Position.Z + 100)
                    {
                        isOnTile = true;
                        Player player = obj as Player;
                        if (player.EDown && !finalLevel)
                        {
                            foreach (Sound sound in MusicPlayer.SoundEffect)
                            {
                                if (sound.Name == "doorcreak")
                                {
                                    sound.PlaySound();
                                }
                            }
                            level.Completed = true;
                        }
                        else if (player.EDown && finalLevel)
                        {
                            EndGameState endGameState = GameEnvironment.GameStateManager.GetGameState("endGameState") as EndGameState;
                            GameEnvironment.GameStateManager.SwitchTo("endGameState");
                        }
                    }
                    else
                    {
                        isOnTile = false;
                    }
                }
            }
        }
    }
Esempio n. 22
0
    void SoulReturnCondition(EndGameState state)
    {
        soulReturning = state;
        switch (state)
        {
        case EndGameState.DEFAULT:
            GameEvents.ReportInteractHintShown(HintForInteraction.DEFAULT);
            break;

        case EndGameState.RETURNSOULS:
            returnSoul++;
            GameEvents.ReportInteractHintShown(HintForInteraction.RETURNSOULS);
            StartCoroutine(EndGameCounter(7f));
            break;

        case EndGameState.GOTODOOR:
            finish++;
            GameEvents.ReportInteractHintShown(HintForInteraction.FINISH);
            StartCoroutine(EndGameCounter(5f));
            break;
        }
    }
Esempio n. 23
0
 void Awake()
 {
     M_DelayBeforeLvlSwap = 30;
     PopUpMenu            = GameObject.Find("PopUpMenu").GetComponent <Transform>();
     CanvasStuff          = PopUpMenu.GetComponent <scr_CanvasStuff>();
     scaleUpwards         = true;
     activeButton         = null;
     OpenSurveyOnce       = true;
     m_BT           = BagType.def;
     Time.timeScale = 1;
     m_Camera       = Camera.main.GetComponent <scr_CameraScript>();
     m_EGS          = EndGameState.none;
     ISM            = GetComponent <scr_IngameSoundManager>();
     PE             = GetComponent <scr_PotionEffects>();
     FH             = GetComponent <scr_FileHandler>();
     if (m_bagAmount > 0 && !GameObject.FindGameObjectWithTag("bag"))
     {
         Instantiate(bag, m_bagSpawnPos.position, Quaternion.identity);
         bag.SetActive(true);
         m_bagAmount -= 1;
     }
     m_showEndGameMenu = false;
     m_DisplayOnce     = true;
 }
Esempio n. 24
0
 public void EndGame(EndGameState state)
 {
     playerScript.FillAmmo();
     //Application.LoadLevel(state.ToString());
     //ReleaseMouse();
 }
Esempio n. 25
0
 private void OnEndGame(EndGameState obj)
 {
     _endGame = true;
 }
Esempio n. 26
0
    private void ConstructStateMachine()
    {
        sm = new StateMachine <GameBool, GameTrigger>(verbose: false);

        GenerateLevelState generateLevelState = new GenerateLevelState(blackBoard);
        ReadGameFlowState  readGameFlowState  = new ReadGameFlowState(blackBoard);
        InstructionState   instructionState   = new InstructionState(blackBoard);
        LevelBeatenState   levelBeatenState   = new LevelBeatenState(blackBoard);
        CountDownState     countDownState     = new CountDownState(blackBoard);
        GameOverState      gameOverState      = new GameOverState(blackBoard);
        EndGameState       endGameState       = new EndGameState(blackBoard);
        LoadingState       loadingState       = new LoadingState(blackBoard);
        ConfigState        configState        = new ConfigState(blackBoard);
        DeathState         deathState         = new DeathState(blackBoard);
        MenuState          menuState          = new MenuState(blackBoard);
        PlayState          playState          = new PlayState(blackBoard);
        EmptyState         emptyState         = new EmptyState();

        sm.AddEntryState(emptyState);
        sm.AddState(generateLevelState);
        sm.AddState(readGameFlowState);
        sm.AddState(instructionState);
        sm.AddState(levelBeatenState);
        sm.AddState(countDownState);
        sm.AddState(gameOverState);
        sm.AddState(endGameState);
        sm.AddState(loadingState);
        sm.AddState(configState);
        sm.AddState(deathState);
        sm.AddState(menuState);
        sm.AddState(playState);

        // start by going to the loading
        sm.AddTransition(
            emptyState,
            loadingState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // loading state always goes to the menu state
        sm.AddTransition(
            loadingState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // menu to config
        sm.AddTransition(
            menuState,
            configState,
            sm.CreateTriggerCondition(GameTrigger.GotoConfig));

        // config back to menu
        sm.AddTransition(
            configState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.GotoMainMenu));

        // menu straight to game if the player has already seen the instructions
        sm.AddTransition(
            menuState,
            readGameFlowState,
            sm.CreateTriggerCondition(GameTrigger.GotoGame),
            sm.CreateBoolCondition(GameBool.HasSeenInstructions, true));

        // menu to instructions
        sm.AddTransition(
            menuState,
            instructionState,
            sm.CreateTriggerCondition(GameTrigger.GotoGame),
            sm.CreateBoolCondition(GameBool.HasSeenInstructions, false));

        // instruction to start game state
        sm.AddTransition(
            instructionState,
            readGameFlowState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // reading game to config to set up variables
        sm.AddTransition(
            readGameFlowState,
            configState,
            sm.CreateTriggerCondition(GameTrigger.SetUpConfig));

        // config back to read game flow
        sm.AddTransition(
            configState,
            readGameFlowState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // reading game to generating a level
        sm.AddTransition(
            readGameFlowState,
            generateLevelState,
            sm.CreateTriggerCondition(GameTrigger.GotoGame));

        // on generation fail, go back to main menu
        sm.AddTransition(
            generateLevelState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.GotoMainMenu));

        // generating game to countdown
        sm.AddTransition(
            generateLevelState,
            countDownState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // countdown to play state
        sm.AddTransition(
            countDownState,
            playState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // play state to death
        sm.AddTransition(
            playState,
            deathState,
            sm.CreateTriggerCondition(GameTrigger.PlayerDied));

        // death back to generating level
        sm.AddTransition(
            deathState,
            generateLevelState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // death state back to main menu
        sm.AddTransition(
            deathState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.GotoMainMenu));

        // play to level beaten
        sm.AddTransition(
            playState,
            levelBeatenState,
            sm.CreateTriggerCondition(GameTrigger.PlayerWon));

        // level beating to replay
        sm.AddTransition(
            levelBeatenState,
            generateLevelState,
            sm.CreateTriggerCondition(GameTrigger.ReplayLevel));

        // level beaten back to read game flow to figure out what is next
        sm.AddTransition(
            levelBeatenState,
            readGameFlowState,
            sm.CreateTriggerCondition(GameTrigger.NextState));

        // level beaten back to the main menu
        sm.AddTransition(
            levelBeatenState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.GotoMainMenu));

        // game is over since read game flow state can't find anything else
        sm.AddTransition(
            readGameFlowState,
            gameOverState,
            sm.CreateTriggerCondition(GameTrigger.GotoGameOver));

        // in the game over state, the only option is to go back to the main menu
        sm.AddTransition(
            gameOverState,
            menuState,
            sm.CreateTriggerCondition(GameTrigger.GotoMainMenu));
    }
Esempio n. 27
0
        private void Director_GameEnded(EndGameState endGameState, List <ITAlertPlayer> players)
        {
            switch (endGameState)
            {
            case EndGameState.Success:
                _endGameSuccessOverlay.SetActive(true);
                break;

            case EndGameState.Neutral:
                _endGameNeutralOverlay.SetActive(true);
                break;

            case EndGameState.Failure:
                _endGameFailureOverlay.SetActive(true);
                break;

            default:
                LogProxy.Error("Director ended game with unknown state");
                return;
            }
            _endGameOverlay.SetActive(true);

            if (_director.SimulationRoot.Scenario.Scoring != SimulationScenario.ScoringMode.None)
            {
                _teamSCoreOverlay.SetActive(true);
                if (_director.SimulationRoot.ECS.TryGetSystem <TeamScoringSystem>(out var teamScoringSystem))
                {
                    ShowEndGameScore(teamScoringSystem, players);
                    //var playerScore = teamScoringSystem.GetPlayerScores();
                    //var totalPlayerScore = playerScore.Sum(s => s.PublicScore);
                    //var multiplier = teamScoringSystem.SystemHealth.Average();
                    //var totalScore = Math.Round(totalPlayerScore * multiplier);

                    //_teamScoreText.text = totalPlayerScore + " x " + multiplier.ToString("0.0000") + " = " + totalScore;
                    _teamScoreText.text = teamScoringSystem.CumulativeScore.ToString("d5");
                }
            }
            _timerText.transform.parent.gameObject.SetActive(false);
            _itemPanel.SetActive(false);

            var gameContainer = GameObjectUtilities.FindGameObject("Game/Canvas");

            var canvasGroup = gameContainer.GetComponent <CanvasGroup>();

            canvasGroup.alpha          = 0.1f;
            canvasGroup.blocksRaycasts = false;
            foreach (var trail in gameContainer.GetComponentsInChildren <TrailRenderer>())
            {
                trail.startColor = new Color(trail.startColor.r, trail.startColor.g, trail.startColor.b, 0.25f);
                trail.endColor   = new Color(trail.startColor.r, trail.startColor.g, trail.startColor.b, 0.125f);
            }
            foreach (var blink in gameContainer.GetComponentsInChildren <BlinkBehaviour>())
            {
                var image = blink.GetComponent <Image>();
                if (image != null)
                {
                    blink.enabled = false;
                    image.color   = new Color(image.color.r, image.color.g, image.color.b, 0.625f);
                }
            }
        }
Esempio n. 28
0
 public void SetEndGameState(EndGameState state)
 {
     m_EGS = state;
 }
Esempio n. 29
0
 private void OnGameEnded(EndGameState obj, List <ITAlertPlayer> players)
 {
     PlayersGameEnded?.Invoke(obj, players);
 }
Esempio n. 30
0
 private void OnGameEnded(EndGameState obj)
 {
     GameEnded?.Invoke(obj);
 }