Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public PixelEaterGame()
        {
            this.Window.Title = "Pixel Eater Project";
            this.graphics     = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth  = PixelEaterGame.WindowWidth;
            this.graphics.PreferredBackBufferHeight = PixelEaterGame.WindowHeigth;
            this.graphics.IsFullScreen = false;
            this.graphics.ApplyChanges();
            Content.RootDirectory = "Content";

            GameState           = GameState.WelcomeScreen;
            this.welcomeScreen  = new WelcomeScreen(this);
            this.gameplayScreen = new GameplayScreen(this, this.ShowGameOverScreen);
            this.gameoverScreen = new GameOverScreen(this);
        }
Exemplo n.º 2
0
 public void GoDownFloor()
 {
     if (CustomRun.instance.IsLastFloor(floorManager.CurrentFloorNumber))
     {
         SaveGameSystem.instance?.DeleteGame();
         GameOverScreen.PlayerWon();
         return;
     }
     if (!LoadingNewFloor)
     {
         LoadingNewFloor = true;
         AudioManager.PlayNextFloor();
         StartCoroutine(LoadNewFloorCoroutine());
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            textureManager = new TextureManager(this.Content);
            audioManager   = new AudioManager(this.Content);

            mSplashScreen   = new SplashScreen(this.Content, new EventHandler(ControllerDetectScreenEvent));
            mMenuScreen     = new MenuScreen(this.Content, new EventHandler(MenuScreenEvent));
            mGameScreen     = new GameScreen(this.Content, new EventHandler(GameScreenEvent));
            mGameOverScreen = new GameOverScreen(this.Content, new EventHandler(GameOverScreenEvent));

            mCurrentScreen = mMenuScreen;
        }
Exemplo n.º 4
0
 //Initialize after each another rebirth
 public void NextPlay()
 {
     IsGameOver = false;
     GameOverScreen.SetActive(false);
     cam.backgroundColor = Random.ColorHSV();
     StartButton.gameObject.SetActive(true);
     ShopButton.gameObject.SetActive(true);
     Logo.gameObject.SetActive(true);
     Hits = 0;
     enemies.StartCoroutine(enemies.Generate());
     if (!StartButton.IsActive() || !ShopButton.IsActive())
     {
         this.gameObject.SetActive(true);
     }
 }
Exemplo n.º 5
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            sfxButtonPress  = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);
            sfxHit          = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);

            _font = Content.Load <SpriteFont>("MyFont");

            spriteSheetTexture = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);

            _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInTexture.SetData(new Color[] { Color.White });

            trex           = new Trex(spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - Trex.TREX_DEF_SPRITE_HEIGHT), sfxButtonPress, GraphicsDevice);
            trex.DrawOrder = 10;

            trex.JumpComplete += TrexJumpComplete;
            trex.Died         += TrexDied;

            _scoreBoard = new ScoreBoard(spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), trex, sfxScoreReached);

            _inputController = new InputController(trex);

            _groundManager = new GroundManager(spriteSheetTexture, _entityManager, trex);

            _obstacleManager = new ObstacleManager(_entityManager, trex, _scoreBoard, spriteSheetTexture, GraphicsDevice);

            _backroundManager = new BackGroundManager(spriteSheetTexture, _entityManager, trex);

            _gameOverScreen = new GameOverScreen(
                spriteSheetTexture,
                new Vector2(
                    (WINDOW_WIDTH - GameOverScreen.GAME_OVER_TEXTURE_WIDTH) / 2,
                    (WINDOW_HEIGHT - GameOverScreen.GAME_OVER_TEXTURE_HEIGHT) / 3
                    ),
                this
                );

            _entityManager.AddEntity(trex);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_obstacleManager);
            _entityManager.AddEntity(_gameOverScreen);
            _entityManager.AddEntity(_backroundManager);
        }
Exemplo n.º 6
0
        public DnK()
        {
            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = Config.Resolution.X,
                PreferredBackBufferHeight = Config.Resolution.Y
            };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y);

            IsMouseVisible = true;

            Graphics.IsFullScreen = Config.FullScreen;

            Graphics.SynchronizeWithVerticalRetrace = true;

            // Pass through the FPS capping (60 FPS)
            if (!Config.FpsCapping)
            {
                IsFixedTimeStep = false;
                Graphics.SynchronizeWithVerticalRetrace = false;
            }

            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            _stateManager = new GameStateManager(this);
            Components.Add(_stateManager);

            // Screens
            TitleScreen             = new TitleScreen(this, _stateManager);
            GameConfigurationScreen = new GameConfigurationScreen(this, _stateManager);
            GameplayScreen          = new GameplayScreen(this, _stateManager);
            LeaderboardScreen       = new LeaderboardScreen(this, _stateManager);
            ImprovementScreen       = new ImprovementScreen(this, _stateManager);
            GameOverScreen          = new GameOverScreen(this, _stateManager);
            OptionsScreen           = new OptionsScreen(this, _stateManager);
            KeyboardInputsScreen    = new KeyboardInputsScreen(this, _stateManager);
            GamepadInputsScreen     = new GamepadInputsScreen(this, _stateManager);

            _stateManager.ChangeState(TitleScreen);

            // FPS
            Components.Add(new FrameRateCounter(this));
        }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        // For demonstration purposes...
        if (!recipesSet)
        {
            NextRecipe(0);
            NextRecipe(1);
            NextRecipe(2);
            recipesSet = true;
        }

        if (gameTimer.IsExpired())
        {
            GameOverScreen.GameOver(score);
        }
    }
Exemplo n.º 8
0
        public void LoadGameOver(int highscore)
        {
            _gameoverscreen = null;

            _gameoverscreen = new GameOverScreen();

            _gameoverscreen.AddTexture
            (
                _tstorage["map"],
                new Vector2(0, 0)
            );

            _gameoverscreen.AddButton(new Button
                                      (
                                          _tstorage["exit2"],
                                          new Vector2(1020, 700),
                                          400, 110,
                                          CGameState.Quit
                                      ));

            _gameoverscreen.AddButton(new Button
                                      (
                                          _tstorage["tryagain"],
                                          new Vector2(500, 698),
                                          400, 110,
                                          CGameState.StartGame
                                      ));

            _gameoverscreen.AddTexture
            (
                _tstorage["highscore"],
                new Vector2(555, 500)
            );

            _gameoverscreen.AddTexture
            (
                _tstorage["gameover"],
                new Vector2(560, 200)
            );

            _gameoverscreen.AddText
            (
                _fstorage["gameover_font"],
                new Vector2(990, 510),
                highscore.ToString()
            );
        }
Exemplo n.º 9
0
    void CleanLists()
    {
        _listRoamers.RemoveAll(item => item == null);
        _listChasers.RemoveAll(item => item == null);
        _listSpitters.RemoveAll(item => item == null);
        Debug.Log("Count: " + (_listRoamers.Count + _listChasers.Count + _listSpitters.Count) + ", BossDead: " + _bossDead);
        if (_bossDead && (_listRoamers.Count + _listChasers.Count + _listSpitters.Count) <= 0)
        {
            Debug.Log("Passed");

            if (gameOverScreen != null)
            {
                gameOverScreen.Win();
                gameOverScreen = null;
            }
        }
    }
Exemplo n.º 10
0
        // ============================================================================
        //						    ***** GAME MANAGEMENT *****
        // ============================================================================
        /// <summary>
        /// Load en premier le fichier de localization anglais pour les traductions+ abonnement d'event (ne pas oublier de les remove dans OnDestroy)
        /// </summary>
        protected void Start()
        {
            //Localization
            LocalizationManager.LoadLocalizedText(Path.Combine(settings.LocalizationFolderName, settings.LocalizationEnFileName));

            //Sound
            PlayUIMusic();

            //Event
            uiManager.OnLoadFinish += UIManager_OnLoadFinish;

            LevelSelector.Instance.OnPlay           += LevelSelector_OnPlay;
            LevelSelector.Instance.OnDailyQuestPlay += LevelSelector_OnDailyQuestPlay;

            PauseScreen lPauseScreen = PauseScreen.Instance;

            lPauseScreen.OnResume     += PauseSreen_OnResume;
            lPauseScreen.OnLeaveLevel += PauseScreen_OnLeaveLevel;

            Hud lHud = Hud.Instance;

            lHud.OnPause += Hud_OnPause;

            WinScreen.Instance.OnNext += WinScreen_Next;

            GameOverScreen lGameOverScreen = GameOverScreen.Instance;

            lGameOverScreen.OnNext   += GameOver_Next;
            lGameOverScreen.OnReplay += GameOver_OnReplay;

            Options lOptions = Options.Instance;

            lOptions.OnMusicVolume += Options_OnMusicVolume;
            lOptions.OnSFXVolume   += Options_OnSFXVolume;

            SelectionSquad selectionSquad = SelectionSquad.Instance;

            selectionSquad.OnPlay += SelectionSquad_OnPlay;
            selectionSquad.OnBack += SelectionSquad_OnBack;

            //Loading
            loader.LoadSceneAsync(settings.MainSceneName, true);
            loader.OnPreloadDone += StartMain;

            KPIManager.InitKPI();
        }
Exemplo n.º 11
0
        private void SetupScreens()
        {
            _homeScreen = HomeScreen.Instance;
            _homeScreen.Initialize(Content);

            _cinematicScreen = CinematicScreen.Instance;
            _cinematicScreen.Initialize(Content);

            _instructionScreen = InstructionScreen.Instance;
            _instructionScreen.Initialize(Content);

            _mainScreen = MainScreen.Instance;
            _mainScreen.Initialize(Content);

            _gameOverScreen = GameOverScreen.Instance;
            _gameOverScreen.Initialize(Content);
        }
Exemplo n.º 12
0
    // refresh all boxes and lines, and local score
    public override void NewGame()
    {
        FirstScore  = 0;
        SecondScore = 0;

        GameOverScreen.SetActive(false);
        MyHUD.SetActive(true);

        foreach (S_Box b in MyBoxes)
        {
            b.Refresh();
        }

        foreach (S_Line l in MyLines)
        {
            l.HardOccupy(false);
        }
    }
Exemplo n.º 13
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            MenuScreen          = new MenuScreen(this);
            MenuScreen.IsActive = true;

            LevelScreen1   = new LevelScreen1(this);
            LevelScreen2   = new LevelScreen2(this);
            EndScreen      = new EndScreen(this);
            GameOverScreen = new GameOverScreen(this);

            screens.Add(LevelScreen1);
            screens.Add(LevelScreen2);
            screens.Add(MenuScreen);
            screens.Add(EndScreen);
            screens.Add(GameOverScreen);
        }
Exemplo n.º 14
0
    //Implements death after falling for too long
    public IEnumerator DeadByFall()
    {
        if (IsFalling() && !Jump())
        {
            yield return(new WaitForSeconds(1.5f));

            CloudsDestroyer();
            EnemiesDestroyer();
            IsGameOver = true;
            PointsForGameOverScreen         = CurrentPoints;
            cam.gameObject.transform.parent = null;
            cam.transform.position          = new Vector2(0f, 0f);
            this.gameObject.SetActive(false);
            gameObject.transform.position = new Vector3(0.0f, -4.3f, 0.0f);
            enemies.StopAllCoroutines();
            CurrentPointsText.canvasRenderer.gameObject.SetActive(false);
            CloudsGenerator.transform.position  = new Vector2(0f, 2f);
            EnemiesGenerator.transform.position = new Vector2(0f, 2f);
            if (PlayerPrefs.HasKey("All points"))
            {
                Points = CurrentPoints + PlayerPrefs.GetInt("All points");
            }
            else
            {
                Debug.Log("Error, no key");
            }
            PlayerPrefs.SetInt("All points", Points);
            sm.points     = Points;
            CurrentPoints = 0;
            Hits          = 0;
            DiedByFall    = true;

            int range = Random.Range(0, 2);
            if (range == 1)
            {
                ShowAd();
            }

            if (IsGameOver)
            {
                GameOverScreen.SetActive(true);
            }
        }
    }
        protected override void LoadContent()
        {
            ressource.loadcontent(Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);

            gameover = new GameOverScreen(this, spriteBatch, ressource.ecriture, ressource.gameover);
            Components.Add(gameover);
            gameover.hide();

            edm = new EDM(this, spriteBatch);
            Components.Add(edm);
            edm.hide();

            pause = new menudepause(this, spriteBatch, ressource.ecriture, ressource.pixel);
            Components.Add(pause);
            pause.hide();

            menu = new menu(this, spriteBatch, Content.Load<SpriteFont>("SpriteFont"), ressource.templar);
            Components.Add(menu);
            menu.hide();

            menudujeu = new menudujeu(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.th);
            Components.Add(menudujeu);
            menudujeu.hide();

            option = new option(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.option);
            Components.Add(option);
            option.hide();

            main = new gamemain(this, spriteBatch, activeScreen);
            Components.Add(main);
            main.hide();

            activeScreen = menu;
            activeScreen.Show();

            MediaPlayer.Play(ressource.menu);
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0;

            SoundEffect.MasterVolume = 0.05f;

            ecran = false;
        }
Exemplo n.º 16
0
 public void ShowFinishLevel(int coinsCollected, float elapsedTime)
 {
     foreach (BaseClassScreen screen in screens)
     {
         if (screen.ScreenId == "Levelcompleted_Screen")
         {
             screen.OpenWindow();
             GameOverScreen gameOverScreen = (GameOverScreen)screen;
             if (gameOverScreen != null)
             {
                 gameOverScreen.SetStats(coinsCollected, elapsedTime);
             }
         }
         else
         {
             screen.CloseWindow();
         }
     }
 }
Exemplo n.º 17
0
 public void GameOver()
 {
     TurnText.text      = "Game Over";
     p1But.interactable = false;
     p2But.interactable = false;
     if (cardMan.p1Cards.Count > cardMan.p2Cards.Count)
     {
         GameOverText.text = "Player 1 Wins!";
     }
     else if (cardMan.p1Cards.Count < cardMan.p2Cards.Count)
     {
         GameOverText.text = "Player 2 Wins!";
     }
     else if (cardMan.p1Cards.Count == cardMan.p2Cards.Count)
     {
         GameOverText.text = "Game Draw!";
     }
     GameOverScreen.SetActive(true);
 }
Exemplo n.º 18
0
        public static void Main()
        {
            Console.BufferHeight  = Console.WindowHeight = 30;
            Console.BufferWidth   = Console.WindowWidth = 70;
            Console.CursorVisible = false;

            // Infinite loop allows for multiple game sessions
            while (true)
            {
                IEngine startScreen = new StartScreen();
                startScreen.Run();

                IEngine gameEngine = new GameEngine(scoreContainer);
                gameEngine.Run();

                IEngine gameOverScreeen = new GameOverScreen(scoreContainer);
                gameOverScreeen.Run();
            }
        }
Exemplo n.º 19
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _sfxButtonPress  = Content.Load <SoundEffect>(ASSET_NAME_SFX_BUTTON_PRESS);
            _sfxHit          = Content.Load <SoundEffect>(ASSET_NAME_SFX_HIT);
            _sfxScoreReached = Content.Load <SoundEffect>(ASSET_NAME_SFX_SCORE_REACHED);

            _spriteSheetTexture  = Content.Load <Texture2D>(ASSET_NAME_SPRITESHEET);
            _invertedSpriteSheet = _spriteSheetTexture.InvertColors(Color.Transparent);

            _fadeInTexture = new Texture2D(GraphicsDevice, 1, 1);
            _fadeInTexture.SetData(new Color[] { Color.White });

            _trex               = new Trex(_spriteSheetTexture, new Vector2(TREX_START_POS_X, TREX_START_POS_Y - Trex.TREX_DEFAULT_SPRITE_HEIGHT), _sfxButtonPress);
            _trex.DrawOrder     = 100;
            _trex.JumpComplete += trex_JumpComplete;
            _trex.Died         += trex_Died;

            _scoreBoard = new ScoreBoard(_spriteSheetTexture, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _trex, _sfxScoreReached);
            //_scoreBoard.Score = 498;
            //_scoreBoard.HighScore = 12345;

            _inputController = new InputController(_trex);

            _groundManager   = new GroundManager(_spriteSheetTexture, _entityManager, _trex);
            _obstacleManager = new ObstacleManager(_entityManager, _trex, _scoreBoard, _spriteSheetTexture);
            _skyManager      = new SkyManager(_trex, _spriteSheetTexture, _invertedSpriteSheet, _entityManager, _scoreBoard);

            _gameOverScreen          = new GameOverScreen(_spriteSheetTexture, this);
            _gameOverScreen.Position = new Vector2(WINDOW_WIDTH / 2 - GameOverScreen.GAME_OVER_SPRITE_WIDTH / 2, WINDOW_HEIGHT / 2 - 30);

            _entityManager.AddEntity(_trex);
            _entityManager.AddEntity(_groundManager);
            _entityManager.AddEntity(_scoreBoard);
            _entityManager.AddEntity(_obstacleManager);
            _entityManager.AddEntity(_gameOverScreen);
            _entityManager.AddEntity(_skyManager);

            _groundManager.Initialize();

            LoadSaveState();
        }
Exemplo n.º 20
0
        /*
         * Método: private void GameIsOver()
         *
         * Función: finalizar juego
         *
         * Descripción: Verifica si el juego ha terminado, ya sea con una victoria
         * o con una derrota. Si el juego ha terminado, guarda la puntuación final
         * del jugador y detiene el reloj de actualizaciones del juego.
         */
        private void GameIsOver()
        {
            if (GameData.gameOver)
            {
                GameData.gameStart = false;
                //el jugador ha ganado
                if (GameData.victory)
                {
                    /*Aplicar multiplier basado en el tiempo que tomo para completar
                     * el juego y las vidas restantes del jugador.*/
                    score        += (score * 10 / time) * hp;
                    txtScore.Text = "SCORE: " + score;

                    VictoryScreen.BackgroundImage       = Resources.VictoryImg;
                    VictoryScreen.BackgroundImageLayout = ImageLayout.Stretch;
                    VictoryScreen.Height = (int)(Height * 0.65);
                    VictoryScreen.Width  = (int)(Width * 0.80);
                    VictoryScreen.Top    = (int)(Height * 0.20);
                    VictoryScreen.Left   = (int)(Width * 0.08);
                    VictoryScreen.Show();
                }
                //el jugador ha perdido
                else
                {
                    GameOverScreen.BackgroundImage       = Resources.GameOverImg;
                    GameOverScreen.BackgroundImageLayout = ImageLayout.Stretch;
                    GameOverScreen.Height = (int)(Height * 0.5);
                    GameOverScreen.Width  = (int)(Width * 0.8);
                    GameOverScreen.Top    = (int)(Height * 0.25);
                    GameOverScreen.Left   = (int)(Width * 0.08);
                    GameOverScreen.Show();
                }

                //detener relojes
                secondsTimer.Stop();
                gameTimer.Stop();

                //guardar puntuación
                Score s = new Score(score, playahata.username);
                ScoreDAO.AddScore(s);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Global.Pixel = new Texture2D(GraphicsDevice, 1, 1);
            Global.Pixel.SetData <Color>(new Color[] { Color.White });

            HighScoreControl.Images = new System.Collections.Generic.Dictionary <ControlTypes, Texture2D>();
            HighScoreControl.Images.Add(ControlTypes.Tap, Content.Load <Texture2D>("Screen Images/Tap Asset"));
            HighScoreControl.Images.Add(ControlTypes.Swipe, Content.Load <Texture2D>("Screen Images/Swipe Asset"));

            TitleScreen         titleScreen     = new TitleScreen(GraphicsDevice, 1080, 1920);
            GameScreen          gameScreen      = new GameScreen(GraphicsDevice, 1080, 1920);
            GameOverScreen      gameOverScreen  = new GameOverScreen(GraphicsDevice, 1080, 1920);
            OptionScreen        optionScreen    = new OptionScreen(GraphicsDevice, 1080, 1920);
            ControlSelectScreen controlScreen   = new ControlSelectScreen(GraphicsDevice, 1080, 1920);
            StatScreen          highScoreScreen = new StatScreen(GraphicsDevice, 1080, 1920);

            ScreenManager.Add(gameScreen);
            ScreenManager.Add(titleScreen);
            ScreenManager.Add(optionScreen);
            ScreenManager.Add(controlScreen);
            ScreenManager.Add(highScoreScreen);
            ScreenManager.Add(gameOverScreen);

            ScreenManager.Load(Content);


            Global.ElapsedGameTime = TimeSpan.Zero;

            Vector2 currentScale = new Vector2(GraphicsDevice.Viewport.Width / 1080f, GraphicsDevice.Viewport.Height / 1920f);

#if WINDOWS
            MouseManager.Instance.Scale = currentScale;
#else
            //Global.ShowAds(true);
#endif

            ScreenManager.Scale(currentScale);
            ScreenManager.MainScreen = "Title";
        }
Exemplo n.º 22
0
        public Invaders()
        {
            m_Graphics            = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            InputManager      inputManager      = new InputManager(this);
            ScreensMananger   screensManager    = new ScreensMananger(this);
            MenuMananger      menuManager       = new MenuMananger(this);
            SoundManager      soundManager      = new SoundManager(this);
            CollisionsManager collisionsManager = new CollisionsManager(this);
            GameManager       gameManager       = new GameManager(this);
            MenuScreen        menuScreen        = new MenuScreen(this);
            GameOverScreen    gameOverScreen;
            WelcomeScreen     welcomeScreen;

            menuScreen.Graphics       = m_Graphics;
            gameOverScreen            = new GameOverScreen(this);
            welcomeScreen             = new WelcomeScreen(this);
            gameOverScreen.MenuScreen = welcomeScreen.MenuScreen = menuScreen;
            screensManager.Push(gameOverScreen);
            screensManager.SetCurrentItem(welcomeScreen);
        }
Exemplo n.º 23
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            GameContent.Initialize(Content);

            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _introScreen   = new IntroScreen(this);
            _mainMenu      = new TitleScreen(this);
            _credits       = new CreditsScreen(this);
            _gameOver      = new GameOverScreen(this);
            _options       = new OptionsScreen(this);
            _loadscreen    = new LoadScreen(this);
            _savescreen    = new SaveScreen(this);
            _loadingScreen = new LoadingScreen(this);
            _howToPlay     = new HowToPlay(this);

            GameStateManager.Parent = this;

            //System.Threading.ThreadPool.QueueUserWorkItem(LoadContentAsync);
        }
Exemplo n.º 24
0
        public Game1()
        {
            _graphics       = new GraphicsDeviceManager(this);
            ScreenRectangle = new Rectangle(
                0,
                0,
                ScreenWidth,
                ScreenHeight);
            IsMouseVisible = true;

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            _gameStateManager = new GameStateManager(this);
            Components.Add(_gameStateManager);

            _ = new TextureManager();

            TitleScreen              = new TitleScreen(this, _gameStateManager);
            StartMenuScreen          = new StartMenuScreen(this, _gameStateManager);
            GamePlayScreen           = new GamePlayScreen(this, _gameStateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _gameStateManager);
            SkillScreen              = new SkillScreen(this, _gameStateManager);
            LoadGameScreen           = new LoadGameScreen(this, _gameStateManager);
            ConversationScreen       = new ConversationScreen(this, _gameStateManager);
            ShopScreen         = new ShopState(this, _gameStateManager);
            InventoryScreen    = new InventoryScreen(this, _gameStateManager);
            CombatScreen       = new CombatScreen(this, _gameStateManager);
            GameOverScreen     = new GameOverScreen(this, _gameStateManager);
            LootScreen         = new LootScreen(this, _gameStateManager);
            StatsScreen        = new StatsScreen(this, _gameStateManager);
            LevelScreen        = new LevelScreen(this, _gameStateManager);
            QuestCompleteState = new QuestCompleteState(this, _gameStateManager);

            _gameStateManager.ChangeState(TitleScreen);

            IsFixedTimeStep = false;
            _graphics.SynchronizeWithVerticalRetrace = false;
        }
Exemplo n.º 25
0
        public static void changeScreen(UserControl current, string next)
        {
            //tmp is set to the form that this control is on
            Form tmp = current.FindForm();

            tmp.Controls.Remove(current);
            UserControl ns = null;

            switch (next)
            {
            case "GameScreen":
                ns = new GameScreen();
                break;

            case "InstructionScreen":
                ns = new InstructionScreen();
                break;

            case "MenuScreen":
                ns = new MenuScreen();
                break;

            case "OptionScreen":
                ns = new OptionScreen();
                break;

            case "ScoreScreen":
                ns = new ScoreScreen();
                break;

            case "GameOverScreen":
                ns = new GameOverScreen();
                break;
            }

            ns.Size     = new Size(controlWidth, controlHeight);
            ns.Location = startCentre;
            tmp.Controls.Add(ns);
            ns.Focus();
        }
Exemplo n.º 26
0
    void ShowGameOver(bool didWolfWin)
    {
        isGameOver = true;
        GameOverScreen goScreen = new GameOverScreen(didWolfWin);

        Debug.Log("Game over! wolf won?" + didWolfWin);

        if (didWolfWin)
        {
            FXPlayer.WolfWin();
        }
        else
        {
            FXPlayer.VillWin();
        }

        AddChild(goScreen);
        goScreen.alpha = 0.0f;
        goScreen.scale = 0.4f;
        Go.to(goScreen, 0.5f, new TweenConfig().alpha(1.0f).setDelay(0.5f));
        Go.to(goScreen, 0.5f, new TweenConfig().scaleXY(1.0f).setDelay(0.5f).backOut());
    }
Exemplo n.º 27
0
 void CheckFights()
 {
     if (Steps == 0)
     {
         bs = new BattleScreen();
         bs.Run();
         if (Mcharacter.ActualLife == 0)
         {
             if (CanFight)
             {
                 go = new GameOverScreen();
                 go.Run();
                 finished = true;
             }
             else
             {
                 Steps = RandomSteps();
             }
         }
         Steps = RandomSteps();
     }
 }
Exemplo n.º 28
0
    // Applies incoming damage
    public override int TakeDamage(Vector2Int locationOfAttack, int damage)
    {
        int oldHealth = Health;

        if (damage >= 0) // Damage
        {
            // Do we have defense?
            if (statusEffects.TryGetValue(BattleManager.StatusEffectEnum.defense, out StatusEffectDataHolder val))
            {
                int oldDamage = damage;
                damage -= val.EffectValue;
                ApplyStatusEffect(BattleManager.StatusEffectEnum.defense, -1 * oldDamage); // Deal damage to defense
            }

            if (damage > 0)
            {
                AudioManager.PlayPlayerHit();
                Splatter.Play(locationOfAttack);
                StartCoroutine(HitColoration());
                Health -= damage;
            }
        }
        else // healing
        {
            Health -= damage;
            if (Health > maxHealth)
            {
                Health = maxHealth;
            }
        }

        if (Health <= 0)
        {
            SaveGameSystem.instance?.DeleteGame();
            GameOverScreen.PlayerDeath();
        }

        return(oldHealth - Health);
    }
Exemplo n.º 29
0
        private void OnValidate()
        {
            if (!_gameScreen)
            {
                _gameScreen = FindObjectOfType <GameScreen>();
            }

            if (!_pauseScreen)
            {
                _pauseScreen = FindObjectOfType <PauseScreen>();
            }

            if (!_waitingScreen)
            {
                _waitingScreen = FindObjectOfType <WaitingStartScreen>();
            }

            if (!_gameOverScreen)
            {
                _gameOverScreen = FindObjectOfType <GameOverScreen>();
            }
        }
Exemplo n.º 30
0
        public HangManGame(IWordList wordList)
        {
            // DATA
            allTheWords      = wordList;
            currentWord      = new Word(allTheWords.PickRandomWord());
            hangingMan       = new HangingMan();
            incorrectGuesses = new HashSet <string>();

            // CONTROLS
            incorrectGuessesControl = new IncorrectGuessesControl();

            currentWordControl = new CurrentWordControl();
            currentWordControl.ChangeDisplayedWord(currentWord.GetWord());

            nextGuessControl = new ValueView <char>("Enter your next guess: ")
            {
                TypeConversionErrorMessage = "Please enter only a single letter."
            };

            hangManControl = new HangManControl(hangingMan);
            gameOverScreen = new GameOverScreen();
        }
Exemplo n.º 31
0
 //Implements death after collision
 public void DeadByCollision(Collision2D col)
 {
     Hits++;
     if (Hits == 2 || this.gameObject.transform.position.y <= -4.5f || col.gameObject.tag == "Enemy")
     {
         //Gamepley stuff
         IsGameOver = true;
         PointsForGameOverScreen         = CurrentPoints;
         gameObject.transform.position   = new Vector3(0.0f, -4.3f, 0.0f);
         cam.gameObject.transform.parent = null;
         cam.gameObject.SetActive(true);
         gameObject.SetActive(false);
         enemies.StopAllCoroutines();
         CloudsGenerator.transform.position  = new Vector2(0f, 2f);
         EnemiesGenerator.transform.position = new Vector2(0f, 2f);
         cam.transform.position = new Vector2(0f, 0f);
         Hits = 0;
         CloudsDestroyer();
         EnemiesDestroyer();
         //Saving stuff
         if (PlayerPrefs.HasKey("All points"))
         {
             Points = CurrentPoints + PlayerPrefs.GetInt("All points");
         }
         else
         {
             Debug.Log("error, no key");
         }
         PlayerPrefs.SetInt("All points", Points);
         sm.points     = Points;
         CurrentPoints = 0;
         //UI stuff
         CurrentPointsText.canvasRenderer.gameObject.SetActive(false);
         if (IsGameOver)
         {
             GameOverScreen.SetActive(true);
         }
     }
 }
Exemplo n.º 32
0
 /// <summary>
 /// shows the gameover screen.
 /// </summary>
 private void gameOver()
 {
     if (_lives <= 0) {
         GameOverScreen gameOver = new GameOverScreen ("you ran out of lives", _currentLevel);
         game.AddChild (gameOver);
     }
     if (_time <= 0) {
         GameOverScreen gameOver = new GameOverScreen ("you ran out of time", _currentLevel);
         game.AddChild (gameOver);
     }
     Destroy ();
 }
Exemplo n.º 33
0
    void Start()
    {
        timerText = GameObject.Find("WaveTimeUI").GetComponent<Text>();
        kidText = GameObject.Find("GirlCount").GetComponent<Text>();
        momText = GameObject.Find("MomCount").GetComponent<Text>();
        dadText = GameObject.Find("DadCount").GetComponent<Text>();
        GO = GameObject.Find("gameover").GetComponent<GameOverScreen>();
        winScreen = GameObject.Find("WinScreen").GetComponent<GameOverScreen>();
        flameHealth = GameObject.Find("SkullFlame").GetComponent<Image>();
        Ready = GameObject.Find("Ready").GetComponent<Image>();
        Wave = GameObject.Find("Wave").GetComponent<Image>();
        waveNumber = GameObject.Find("waveNumber").GetComponent<Image>();
        readyNumber = GameObject.Find("readyNumber").GetComponent<Image>();
        source = GetComponent<AudioSource>();
        ms = GameObject.Find("MainSpawn").GetComponentInChildren<spawnAI>();
        ks = GameObject.Find("KitchenSpawn").GetComponentInChildren<spawnAI>();
        ws = GameObject.Find("WindowSpawn").GetComponentInChildren<spawnAI>();
        bs = GameObject.Find("BathroomSpawn").GetComponentInChildren<spawnAI>();
        Ghoul = GameObject.Find("Player").GetComponent<player>();
        stopTimeUI = GameObject.Find("timePower").GetComponent<Image>();
        speedUI = GameObject.Find("speedPower").GetComponent<Image>();
        roomScareUI = GameObject.Find("scarePower").GetComponent<Image>();
        mainCam = GameObject.Find("Camera").GetComponent<Cam>();

        score = 0;
        waveCount = -1;
        totalWaves = 10;
        momWait = 0;
        dadWait = 0;
        timing = true;

        timer = -wavePrepTime;
        waveTimer = timer;
        kitchenTimer = timer;
        mainTimer = timer;
        windowTimer = timer;
        bathroomTimer = timer;
        currSpawn = 0;

        roomScareCurrent = 0;

        stopTimeCurrent = 0;

        speedCurrent = 0;

        speedUI.fillAmount = (float)speedCurrent / (float)speedMax;
        roomScareUI.fillAmount = (float)roomScareCurrent / (float)roomScareMax;
        stopTimeUI.fillAmount = (float)stopTimeCurrent / (float)stopTimeMax;

        fast = false;

        if (GameModeControl.mode == 2)
            Time.timeScale = speedMod;
        else
            Time.timeScale = 1;

        totalWaves = 10;

        populateEnemy(GameModeControl.mode);

        num = new Sprite[10];
        numDesat = new Sprite[10];

        for(int i = 0; i < 10; i++)
        {
            num[i] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (i+1));
            numDesat[i] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (i+1) + "desat");

        }

        //num[0] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (1));
        //numDesat[0] = Resources.Load<Sprite>("WaveUI/WaveUI/" + (1) + "desat");

        spawnNextWave();
    }
Exemplo n.º 34
0
	// Use this for initialization
	void Start () {
		lives = GameObject.Find ("Lives").GetComponent<Text>();
		lives_left = tot_lives;
		GO = GameObject.Find ("gameover").GetComponent<GameOverScreen>();
	}
Exemplo n.º 35
0
	void Start() {
		instance = this;
	}
Exemplo n.º 36
0
 /// <summary>
 /// Eindigt het spel,
 /// een spel hoort te eindigen,
 /// hierin sluit hij het spel
 /// </summary>
 public void EndGame()
 {
     MediaPlayer.Stop();
     // Misschien een 'speel opnieuw' knopje?
     screen_gameover = new GameOverScreen(this);
     currentGameState = GameState.GameOverScreen;
     screen_game.world.Clear();
     // No more start screen
     screen_game = null;
 }
Exemplo n.º 37
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // collection of players
            players = new List<Player>()
            {
                new Player(PlayerIndex.One, Content),
                new Player(PlayerIndex.Two, Content),
                new Player(PlayerIndex.Three, Content),
                new Player(PlayerIndex.Four, Content)
            };

            // collection of screens
            mainMenuScreen = new MainMenuScreen(GameState.OnMainMenu);
            mainGameScreen = new MainGameScreen(GameState.RunningGame);
            gameOverScreen = new GameOverScreen(GameState.OnGameOver);
            screens = new Dictionary<GameState, BaseScreen>()
            {
                {mainMenuScreen.GameState, mainMenuScreen},
                {mainGameScreen.GameState, mainGameScreen},
                {gameOverScreen.GameState, gameOverScreen}
            };

            base.Initialize();

            //CREATE THE MEDIA PLAYER
            MediaPlayer.Volume = 1.0f;
            MediaPlayer.Play(mainMenuScreen.menuMusic);
        }
Exemplo n.º 38
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // set up the display window
            graphics.PreferredBackBufferWidth = 500;
            graphics.PreferredBackBufferHeight = 500;
            graphics.ApplyChanges();

            // update the ViewportHeight and ViewportWidth constants so the screens know
            // how to draw themselves
            GameConstants.ViewportHeight = graphics.GraphicsDevice.Viewport.Height;
            GameConstants.ViewportWidth = graphics.GraphicsDevice.Viewport.Width;

            // display title in the window
            Window.Title = "Alien Attack";

            // setup the state of the game
            currentGameState = GameConstants.GameState.Title;
            currentKeyboardState = Keyboard.GetState();
            prevKeyBoardState = currentKeyboardState;

            // set up the screens
            titleScreen = new TitleScreen();
            instructionScreen = new InstructionScreen();
            highScoreScreen = new HighScoreScreen();
            creditsScreen = new CreditsScreen();
            introScreen = new IntroScreen();
            readyScreen = new GetReadyScreen();
            gameOverScreen = new GameOverScreen();

            // set up the game objects
            gameCamera = new Camera();
            player = new Player();
            enemies = new Enemies();
            map = new Map();
            miniMap = new MiniMap();
            skybox = new Skybox();

            // set up the ingame displays
            score = new Score();
            highScore = new HighScore();

            // set up the soundtrack
            gameSongs = new GameSongs();

            base.Initialize();
        }
Exemplo n.º 39
0
    void ShowGameOver(bool didWolfWin)
    {
        isGameOver = true;
        GameOverScreen goScreen = new GameOverScreen(didWolfWin);

        Debug.Log("Game over! wolf won?" + didWolfWin);

        if(didWolfWin)
        {
            FXPlayer.WolfWin();
        }
        else
        {
            FXPlayer.VillWin();
        }

        AddChild(goScreen);
        goScreen.alpha = 0.0f;
        goScreen.scale = 0.4f;
        Go.to(goScreen,0.5f, new TweenConfig().alpha(1.0f).setDelay(0.5f));
        Go.to(goScreen,0.5f, new TweenConfig().scaleXY(1.0f).setDelay(0.5f).backOut());
    }
Exemplo n.º 40
0
 void Awake()
 {
     instance = this;
 }
        /// <summary>
        /// Checks if the ship is dead
        /// </summary>
        private void CheckShipKilled()
        {
            if (ship.Health == 0 && !gameOver)
            {
                gameOver = true;

                //Change screen to GameOver screen
                GameScreen nextScreen = new GameOverScreen(score);
                ScreenManager.ChangeScreens(this, nextScreen);

            }
        }