Exemple #1
0
 public void force10Fail()
 {
     forcedResult = "Fail";
     forcedNum    = 0.15f;
     currState    = MainGameState.CardPick;
     nextGameState();
 }
Exemple #2
0
 public void force75Win()
 {
     forcedResult = "Pass";
     forcedNum    = 0.75f;
     currState    = MainGameState.CardPick;
     nextGameState();
 }
Exemple #3
0
        public Game1()
        {
            mPhysicsManager.InitialiseWorld();
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            MonoEngine.core.MainGameState mainGameState = new MonoEngine.core.MainGameState();
            mMainGameState = mainGameState;
            MonoEngine.core.SplashState splashScreenState = new MonoEngine.core.SplashState();

            MonoEngine.core.MainMenuState mainMenuState = new MonoEngine.core.MainMenuState();
            MonoEngine.core.State         gameOverState = new MonoEngine.core.State();
            MonoEngine.core.State         gameWinState  = new MonoEngine.core.State();

            MainGameFSM.Context = this;
            MainGameFSM.AddState(splashScreenState, "SPLASH");
            MainGameFSM.AddState(mainGameState, "MAINGAME");
            MainGameFSM.AddState(mainMenuState, "MAINMENU");
            MainGameFSM.AddState(gameOverState, "GAMEOVER");
            MainGameFSM.AddState(gameWinState, "GAMEWIN");

            MainGameFSM.ChangeState("SPLASH");



            // test.ChangeState("1");
        }
Exemple #4
0
        static MetaGame()
        {
            var mainMenuState = new MainMenuState(StateMachine, MainGame.Instance);

            StateMachine.States.Add(mainMenuState);

            var mainGameState = new MainGameState(StateMachine, MainGame.Instance);

            StateMachine.States.Add(mainGameState);

            if (Program.SkipIntro)
            {
                StateMachine.AddTransition(new Transition <GameState>("start", null, mainMenuState));
            }
            else
            {
                var borneGamesLogoState = new BorneGamesLogoState(StateMachine, MainGame.Instance);
                var titleState          = new TitleState(StateMachine, MainGame.Instance);
                StateMachine.States.Add(borneGamesLogoState);
                StateMachine.States.Add(titleState);

                StateMachine.AddTransition(new Transition <GameState>("start", null, borneGamesLogoState));
                StateMachine.AddTransition(new Transition <GameState>("next", borneGamesLogoState, titleState,
                                                                      Mode.PushPop));
                StateMachine.AddTransition(new Transition <GameState>("next", titleState, mainMenuState, Mode.PushPop));
            }

            StateMachine.AddTransition(new Transition <GameState>("start", mainMenuState, mainGameState, Mode.PushPop));

            StateMachine.AddTransition(new Transition <GameState>("exit", mainMenuState, null));
        }
Exemple #5
0
 void Start()
 {
     mainGameState = MainGameState.Playing;
     UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);
     uiTextDisplayTimer = uiTextDisplayDuration * 3; // leave instructions on screen for longer
     UpdateActivePowerUpUi();
 }
Exemple #6
0
        /// <summary>
        /// A helper method to switch to the options menu and provide the game state to return to afterwards (INCOMPLETE)
        /// </summary>
        public void SwitchToOptions()
        {
            returnFromOptions = CurrentState;
            CurrentState      = MainGameState.Options;
            IsMouseVisible    = true;
            CurrentState      = MainGameState.Pause;
            int height = GraphicsDevice.Viewport.Height;
            int width  = GraphicsDevice.Viewport.Width;

            //Values need to be adjusted; they are currently not going to look as intended
            buttons = new Button[6];
            Texture2D leftControl = allTextures["Button"];

            buttons[0] = new Button(leftControl, "LeftControl", new Rectangle(width / 2 - leftControl.Width / 2, height * 2 / 14 - leftControl.Height / 2, leftControl.Width, leftControl.Height));
            Texture2D rightControl = allTextures["Button"];

            buttons[1] = new Button(rightControl, "RightControl", new Rectangle(width / 2 - rightControl.Width / 2, height * 4 / 14 - rightControl.Height / 2, rightControl.Width, rightControl.Height));
            Texture2D jumpControl = allTextures["Button"];

            buttons[2] = new Button(jumpControl, "JumpControl", new Rectangle(width / 2 - jumpControl.Width / 2, height * 6 / 14 - jumpControl.Height / 2, jumpControl.Width, jumpControl.Height));
            Texture2D attackControl = allTextures["Button"];

            buttons[3] = new Button(attackControl, "AttackControl", new Rectangle(width / 2 - attackControl.Width / 2, height * 8 / 14 - attackControl.Height / 2, attackControl.Width, attackControl.Height));
            Texture2D pauseControl = allTextures["Button"];

            buttons[4] = new Button(pauseControl, "PauseControl", new Rectangle(width / 2 - pauseControl.Width / 2, height * 10 / 14 - pauseControl.Height / 2, pauseControl.Width, pauseControl.Height));
            Texture2D exitButton = allTextures["ExitButton"];

            buttons[5]        = new Button(exitButton, "ExitButton", new Rectangle(width / 2 - exitButton.Width / 2, height * 12 / 14 - exitButton.Height / 2, exitButton.Width, exitButton.Height));
            indexActiveButton = 0;
        }
Exemple #7
0
 public void forcePerfect()
 {
     forcedResult = "Perfect";
     forcedNum    = 2f;
     currState    = MainGameState.CardPick;
     nextGameState();
 }
Exemple #8
0
    void Update()
    {
        MainGameState ganeState = GameStateManager.Instance.State;

        switch (ganeState)
        {
        case MainGameState.PRE_LAUNCH:
            HandlePreLaunch();
            break;

        case MainGameState.LAUNCH_POSITIONING:
            HandleLaunchPositioning();
            break;

        case MainGameState.LAUNCH_AIMING:
            HandleLaunchAiming();
            break;

        case MainGameState.PUCK_DROPPING:
            HandlePuckDropping();
            break;

        case MainGameState.GAME_PAUSED:
            HandlePuckDropping();
            break;
        }
    }
Exemple #9
0
        public void Start()
        {
            //初始化所有状态机
            initGameSate                 = new InitGameSate();
            initGameSate.stateName       = "initGameSate";
            commentGameState             = new CommentGameState();
            commentGameState.stateName   = "commentGameState";
            contactGameState             = new ContactGameState();
            contactGameState.stateName   = "contactGameState";
            mainGameState                = new MainGameState();
            mainGameState.stateName      = "mainGameState";
            reFindingGameState           = new ReFindingGameState();
            reFindingGameState.stateName = "reFindingGameState";
            companyGameState             = new CompanyGameState();
            companyGameState.stateName   = "companyGameState";
            diyGameState                 = new DiyGameState();
            diyGameState.stateName       = "diyGameState";
            states.Add(initGameSate.stateName, initGameSate);
            states.Add(commentGameState.stateName, commentGameState);
            states.Add(contactGameState.stateName, contactGameState);
            states.Add(mainGameState.stateName, mainGameState);
            states.Add(reFindingGameState.stateName, reFindingGameState);
            states.Add(companyGameState.stateName, companyGameState);
            states.Add(diyGameState.stateName, diyGameState);

            thisState = states["initGameSate"];
            thisState.stateInit();
        }
Exemple #10
0
 void Awake()
 {
     SP = this;
     foundFish = 0;
     gameState = MainGameState.playing;
     totalFish = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
 }
Exemple #11
0
 private static Save CreateSaveObject(MainGameState gameState, SaveInformation.SaveType type)
 {
     return(new Save
     {
         GameState = gameState, Info = { Type = type },
         Screenshot = ScreenShotTaker.Instance.TakeScreenshot(),
     });
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        _MainGameState = GameplayObject.GetComponent<MainGameState> ();
        _CardManager = GameplayObject.GetComponent<CardManager> ();

        _NameText = GetComponentInChildren<Text> ();
        _CardsPanel = transform.FindChild ("Cards");
    }
Exemple #13
0
        public StateManager(MainGameState parent)
        {
            game = parent;

            mainMenuState = new MainMenuState(this);
            playingState  = new PlayingState(this);
            endGameState  = new EndGameState(this);
            currentState  = mainMenuState;
        }
Exemple #14
0
 public void ClearSaves()
 {
     PlayerPrefs.DeleteAll();
     PlayerPrefs.Save();
     currState = MainGameState.Week;
     week      = 1;
     showGameStateScreenUI(currState);
     updateSkybox();
 }
Exemple #15
0
 public void OnGamePause(PauseGameEvent pauseGameEvent)
 {
     Debug.Log($"GameStateManager handling PauseGameEvent. CurrentState={State}, Event={pauseGameEvent}");
     if (State == MainGameState.GAME_PAUSED)
     {
         throw new InvalidOperationException("PauseGameEvent cannot occur during GAME_PAUSED state");
     }
     unpausedState = State;
     State         = MainGameState.GAME_PAUSED;
 }
Exemple #16
0
    public void showGameStateScreenUI(MainGameState current)
    {
        // disable all
        chatScreen.SetActive(false);
        factionScreen.SetActive(false);
        cardChooserScreen.SetActive(false);
        mastermindScreen.SetActive(false);
        resultsScreen.SetActive(false);
        endingScreen.SetActive(false);
        // enable active one
        GameObject screen = null;

        switch (current)
        {
        case MainGameState.Weekend:
            weekImageSwapper.updateImage(false, week);
            chatScreen.GetComponent <DialogUI>().Run("Weekend", week);
            screen = chatScreen;
            break;

        case MainGameState.Week:
            weekImageSwapper.updateImage(true, week);
            chatScreen.GetComponent <DialogUI>().Run("Week", week);
            screen = chatScreen;
            break;

        case MainGameState.FactionPick:
            screen = factionScreen;
            break;

        case MainGameState.CardPick:
            screen = cardChooserScreen;
            break;

        case MainGameState.Mastermind:
            screen = mastermindScreen;
            break;

        case MainGameState.Ending:
            screen = endingScreen;
            break;

        case MainGameState.WeekResult:
        case MainGameState.WeekendResult:
        default:
            screen = resultsScreen;
            break;
        }
        screen.SetActive(true);
        if (shouldMoveCamera())
        {
            updateSkybox();
            MainCameraAnimator.SetTrigger("MoveCamera");
        }
    }
Exemple #17
0
        private void Restart()
        {
            playerHP        = 100;
            player.position = new MFVector(0.0f, 0.0f);
            player.Spawn();
            state = MainGameState.Running;
            GameStateEventArgs args = new GameStateEventArgs();

            args.state = state;
            OnEventGameState(this, args);
        }
        public TowerManager(MainGameState p)
        {
            towers  = new List <Tower>();
            bullets = new List <Bullet>();

            parent = p;

            towerTypes    = new Tower[2];
            towerTypes[0] = new Tower(new Vector2(0, 0), 1000, 1, 0, 100.0f);
            towerTypes[1] = new Tower(new Vector2(0, 0), 100, 2, 1, 300.0f);
        }
Exemple #19
0
    private static void InternalSaveHelper(SaveInformation.SaveType type, MainGameState gameState,
                                           Action <Save> copyInfoToSave, Func <Node> stateRoot, string saveName = null)
    {
        new InProgressSave(type, stateRoot, data =>
                           CreateSaveObject(gameState, data.Type),
                           (inProgress, save) =>
        {
            copyInfoToSave.Invoke(save);

            PerformSave(inProgress, save);
        }, saveName).Start();
    }
Exemple #20
0
    IEnumerator InitiateGame()
    {
        Wave  = 1;
        state = MainGameState.PlatformGame;

        SFXMan.sfx_StartGame.Play();
        AnimateLogo();
        yield return(new WaitForSeconds(3));

        SceneManager.LoadScene("CardMemtris");
        //		Application.LoadLevel ("PlatformScene");
    }
Exemple #21
0
 // Start is called before the first frame update
 void Start()
 {
     if (CanLoad)
     {
         Load();
     }
     else
     {
         currState = MainGameState.Week;
     }
     showGameStateScreenUI(currState);
     updateSkybox();
 }
Exemple #22
0
    private void GameOverLose()
    {
        mainGameState = MainGameState.GameOver;

        uiText.text        = "GAME OVER";
        uiSubtext.text     = "Press Space to Restart";
        uiTextDisplayTimer = Mathf.Infinity;

        foreach (GameObject go in EventSystemListeners.main.listeners)
        {
            ExecuteEvents.Execute <IMainGameEvents> (go, null, (x, y) => x.OnGameLost());
        }
    }
Exemple #23
0
        /// <summary>
        /// A helper method that initializes the victory state when called
        /// </summary>
        public void SwitchToVictory()
        {
            CurrentState   = MainGameState.Victory;
            IsMouseVisible = true;
            int height = GraphicsDevice.Viewport.Height;
            int width  = GraphicsDevice.Viewport.Width;

            buttons = new Button[1];
            Texture2D exitButton = allTextures["ExitButton"];

            buttons[0]        = new Button(exitButton, "ExitButton", new Rectangle(width / 2 - exitButton.Width / 2, height * 6 / 10 - exitButton.Height / 2, exitButton.Width, exitButton.Height));
            indexActiveButton = 0;
        }
Exemple #24
0
    void Update()
    {
        MainGameState gameState = GameStateManager.Instance.State;

        if (!gameState.IsGamePaused() && Input.GetButtonDown(gameSettings.buyPowerUp))
        {
            if (CanAffordCharge(gameSettings.powerUpCost))
            {
                ChargePlayer(gameSettings.powerUpCost);
                EventManager.Instance.NotifyListeners(new BuyPowerUpEvent());
            }
        }
    }
    public PackedScene LoadScene(MainGameState state)
    {
        switch (state)
        {
        case MainGameState.MicrobeStage:
            return(LoadScene("res://src/microbe_stage/MicrobeStage.tscn"));

        case MainGameState.MicrobeEditor:
            return(LoadScene("res://src/microbe_stage/editor/MicrobeEditor.tscn"));

        default:
            throw new ArgumentException("unknown scene path for given game state");
        }
    }
Exemple #26
0
        private void GameOver()
        {
            foreach (MFBullet b in listBullet)
            {
                b.Destroy();
            }
            listBullet.Clear();
            player.Destroy();
            state = MainGameState.GameOver;
            GameStateEventArgs args = new GameStateEventArgs();

            args.state = state;
            OnEventGameState(this, args);
        }
Exemple #27
0
        /// <summary>
        /// A helper method meant to start the game
        /// </summary>
        public void StartGame()
        {
            IsMouseVisible = false;
            CurrentState   = MainGameState.InGame;
            // Create the player in the first map & add it to the world
            Point spawn = new Point(2, 20);

            player             = new Player(spawn.X * 64, spawn.Y * 64, currentWorld.QuadTree);
            mainDisplay        = new Display(GraphicsDevice, player);
            player.Texture     = allTextures["ParkaDude"];
            player.WalkTexture = allTextures["PenPenWalking"];
            World.Current      = maps["Tutorial1"];
            //   tracks["Electown"].Start();
            ChangeMap();
        }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        InstructionsPanel = transform.Find("Instructions").gameObject;
        OptionsPanel      = transform.Find("Options").gameObject;


        state = MainGameState.StartMenu;
        Wave  = 1;

        SFXMan.PlayAsSong(SFXMan.sng_StartMenuSong);

        logo = transform.Find("Logo").gameObject;
        musicVolumeSlider = transform.Find("Options/MusicVolume").GetComponent <Slider>();
        sfxVolumeSlider   = transform.Find("Options/SfxVolume").GetComponent <Slider>();
    }
Exemple #29
0
    private void GameOverWin()
    {
        mainGameState = MainGameState.GameOver;

        // UI
        uiText.text        = "LEVEL COMPLETE";
        uiSubtext.text     = "Press Space to Restart";
        uiTextDisplayTimer = Mathf.Infinity;  // never fade this

        // Send message to any listeners
        foreach (GameObject go in EventSystemListeners.main.listeners)
        {
            ExecuteEvents.Execute <IMainGameEvents>(go, null, (x, y) => x.OnGameWon());
        }
    }
Exemple #30
0
        /// <summary>
        /// A helper method that will intialize the pause menu whenever it is called
        /// </summary>
        public void SwitchToPauseMenu()
        {
            IsMouseVisible = true;
            CurrentState   = MainGameState.Pause;
            int height = GraphicsDevice.Viewport.Height;
            int width  = GraphicsDevice.Viewport.Width;

            buttons = new Button[2];
            Texture2D resumeButton = allTextures["ResumeButton"];

            buttons[0] = new Button(resumeButton, "ResumeButton", new Rectangle(width / 2 - resumeButton.Width / 2, height * 6 / 10 - resumeButton.Height / 2, resumeButton.Width, resumeButton.Height));
            Texture2D mainMenuButton = allTextures["MainMenuButton"];

            buttons[1]        = new Button(mainMenuButton, "MainMenuButton", new Rectangle(width / 2 - mainMenuButton.Width / 2, height * 3 / 4 - mainMenuButton.Height / 2, mainMenuButton.Width, mainMenuButton.Height));
            indexActiveButton = 0;
        }
Exemple #31
0
        /// <summary>
        /// A helper method that will initialize the main menu whenever it is called
        /// </summary>
        public void SwitchToMainMenu()
        {
            Soundtrack.Stop();
            IsMouseVisible = true;
            CurrentState   = MainGameState.Menu;
            int height = GraphicsDevice.Viewport.Height;
            int width  = GraphicsDevice.Viewport.Width;

            buttons = new Button[2];
            Texture2D startButton = allTextures["StartButton"];

            buttons[0] = new Button(startButton, "StartButton", new Rectangle(width / 2 - startButton.Width / 2, height * 6 / 10 - startButton.Height / 2, startButton.Width, startButton.Height));
            Texture2D exitButton = allTextures["ExitButton"];

            buttons[1]        = new Button(exitButton, "ExitButton", new Rectangle(width / 2 - exitButton.Width / 2, height * 3 / 4 - exitButton.Height / 2, exitButton.Width, exitButton.Height));
            indexActiveButton = 0;
        }
Exemple #32
0
 // load from playerprefs
 public void Load()
 {
     if (!CanLoad)
     {
         throw new InvalidOperationException("There is no save data.");
     }
     // set stone cards
     for (int i = 0; i < cards.Count; i++)
     {
         Destroy(cards[i].gameObject);
         cards.RemoveAt(i);
         i--;
     }
     string[] cardStrs = PlayerPrefs.GetString("cards").Split(';');
     if (cardStrs[0] != "")
     {
         List <Card> dummies = new List <Card>();
         for (int i = 0; i < cardStrs.Length; i++)
         {
             dummies.Add(new Card(Card.Variant.Time));
         }
         cards.AddRange(cardChooserScreen.GetComponent <RuneChoiceScreen>().AddRunes(dummies));
         for (int i = 0; i < cards.Count; i++)
         {
             cards[i].FromSaveString(cardStrs[i]);
         }
     }
     // set game state
     week      = PlayerPrefs.GetInt("week");
     currState = (MainGameState)Enum.Parse(typeof(MainGameState), PlayerPrefs.GetString("state"));
     // set faction choices
     foreach (Faction f in Enum.GetValues(typeof(Faction)))
     {
         factionChoices[f.ToString()] = PlayerPrefs.GetInt($"factionChoices{f}");
     }
     // set selected card or faction
     faction = PlayerPrefs.GetString("faction");
     card    = null;
     if (PlayerPrefs.GetString("card") != "")
     {
         card = new Card(Card.Variant.Time, 0f);
         card.FromSaveString(PlayerPrefs.GetString("card"));
     }
 }
Exemple #33
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MainGameState.lost;
 }
Exemple #34
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MainGameState.won;
 }
Exemple #35
0
 // Use this for initialization
 void Start()
 {
     _MainGameState = GameStateObject.GetComponent<MainGameState> ();
     _InternalPhase = GameFlowPhase.EndPhase;
 }
Exemple #36
0
    // Use this for initialization
    void Start()
    {
        _GameState = GamePlayObj.GetComponent<MainGameState> ();
        _GameFlow = GetComponent<GameFlowControl> ();
        _Canvas = transform.FindChild ("MenuCanvas");

        _CardManager = GamePlayObj.GetComponent<CardManager> ();
        _PlaceholderLibrary = gameObject.AddComponent<PlaceholderLibrary> ();

        Transform debugView = _Canvas.FindChild ("DebugView");
        Debug.Assert (debugView);
        if (debugView) {
            debugView.gameObject.SetActive(false);
        }
    }