Inheritance: MonoBehaviour
Ejemplo n.º 1
0
	void Awake()
	{
		if (instance == null) {
			instance = this;
		} else if (instance != this) {
			Destroy (gameObject);
			Debug.Log ("destroy Pause Screen duplicate on Awake");
		}
	}
    void Awake()
    {
        if (instance == null) {
            instance = this;
            DontDestroyOnLoad(gameObject);
        } else {
            Destroy(gameObject);
        }
        gameover = GetComponent<GameOverMenu>();
        fader = GetComponent<Fader>();
        gman = GetComponent<GUIManager>();
        pauseScreen = GetComponent<PauseScreen>();
        bgmm = GetComponent<BGMManager>();
        semm = GetComponent<SEManager>();
        GameObject storyController = GameObject.FindGameObjectWithTag(Tags.storyController);
        if (storyController != null) {
            storysemm = storyController.GetComponent<SEManager>();
        }

        paused = false;
    }
Ejemplo n.º 3
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()
        {
            //graphics.ToggleFullScreen();

            screenState = ScreenState.Title;

            gameScreen     = new GameScreen();
            mainMenuScreen = new MainMenuScreen();
            titleScreen    = new TitleScreen();
            gameOverScreen = new GameOverScreen();
            //playerSelectScreen = new PlayerSelectScreen();
            oneplayerSelectScreen = new OnePlayerSelectScreen();
            twoplayerSelectScreen = new TwoPlayerSelectScreen();
            onlineOptionsScreen   = new OnlineOptionsScreen();
            onlineJoinScreen      = new OnlineJoinScreen();
            optionsScreen         = new OptionsScreen();
            editControls          = new EditControlsScreen();
            pauseScreen           = new PauseScreen();
            errorScreen           = new ErrorScreen();
            gameModeScreen        = new GameModeScreen();
            keyboardScreen        = new KeyboardScreen();
            waitingScreen         = new WaitingScreen();



            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;
            graphics.ApplyChanges();


            Global.Scale = new Vector2(GraphicsDevice.Viewport.Width / 1920f);

            InputManager.Update();
            Global.UsingKeyboard = !InputManager.PressedKeysPlayer1.IsConnected;
            IsMouseVisible       = true;
            base.Initialize();
        }
Ejemplo n.º 4
0
        public IEnumerator PauseScreen_Can_Return_From_Scenes_Menu()
        {
            PauseScreen.PauseGame();
            yield return(null);

            PauseScreen.OpenScenesMenu();
            yield return(null);

            // The test is only valid if we know for a fact we made it to the scenes menu.
            Assert.True(PauseScreen.ScenesMenu.activeSelf);

            MenuButton[] buttons = PauseScreen.ScenesMenu.GetComponentsInChildren <MenuButton>();
            MenuButton   found   = null;

            foreach (MenuButton button in buttons)
            {
                if (button.name.Contains("back"))
                {
                    found = button;
                    break;
                }
            }

            if (found != null)
            {
                found.onClick.Invoke();
            }
            else
            {
                Assert.Fail();
            }

            yield return(null);

            Assert.True(PauseScreen.MainPauseMenu.activeSelf);
            Assert.False(PauseScreen.ScenesMenu.activeSelf);
        }
Ejemplo n.º 5
0
    void Update()
    {
        if (player.dead)
        {
            // Pull in our pause screen script so we can call a method in it
            pause = GameObject.FindObjectOfType(typeof(PauseScreen)) as PauseScreen;

            // Wait past the player's death for a short period and then
            deathCooldown -= Time.deltaTime;
            if (deathCooldown <= 0f)
            {
                Time.timeScale = 0;

                // Show our end screen text and play the ending music
                GetComponent <Text>().enabled = true;
                audioSource.clip = gameOver;
                audioSource.loop = true;
                if (!audioSource.isPlaying)
                {
                    audioSource.Play();
                }

                // Kick the pause button off the screen
                GameObject PauseButton = GameObject.FindGameObjectWithTag("GameUI");
                PauseButton.GetComponent <Image>().enabled = false;

                // And show our score
                GetComponent <Text>().text = "Distance: " + Score.score + "\nBest Distance: " + Score.highScore + "\n\nTap to Restart";

                // If the player starts tapping, then reload the scene and start again
                if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0) && !PauseScreen.GamePaused)
                {
                    SceneManager.LoadScene("Scene");
                }
            }
        }
    }
Ejemplo n.º 6
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            ScreenRectangle = new Rectangle(
                0,
                0,
                screenWidth,
                screenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

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

            TitleScreen              = new TitleScreen(this, stateManager);
            StartMenuScreen          = new StartMenuScreen(this, stateManager);
            GamePlayScreen           = new GamePlayScreen(this, stateManager);
            AdminScreen              = new AdminScreen(this, stateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, stateManager);
            EndGameScreen            = new EndGameScreen(this, stateManager);
            PauseScreen              = new PauseScreen(this, stateManager);
            highscoreScreen          = new HighscoreScreen(this, stateManager);
            upgradeScreen            = new UpgradeScreen(this, stateManager);
            saveHistory              = new SaveHistoryScreen(this, stateManager);
            initPrice = new InitialPriceScreen(this, stateManager);

            spaceShip = new SpaceShip();
            board     = new Board();

            stateManager.ChangeState(TitleScreen);
        }
    void Awake()
    {
        //
        if (singleton != null)
        {
            enabled = false;
            Destroy(this);
            return;
        }

        inputPlayer2 = ReInput.players.GetPlayer(1);
        inputPlayer3 = ReInput.players.GetPlayer(2);
        inputPlayer4 = ReInput.players.GetPlayer(3);

        singleton         = this;
        singleton.players = this.players;

        ps = players[0].ps;

        players[1].gameObject.SetActive(false);
        players[2].gameObject.SetActive(false);
        players[3].gameObject.SetActive(false);
        //    player = new Dictionary<int, TPC>();
    }
Ejemplo n.º 8
0
 private void Awake() => PauseMenu = this;
Ejemplo n.º 9
0
 public override void OnEscapePressed()
 {
     PauseScreen.Open();
 }
Ejemplo n.º 10
0
 private void Quit()
 {
     PauseScreen.TriggerQuitGame();
 }
Ejemplo n.º 11
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public GameplayScreenView(Screen screen) : base(screen)
        {
            Screen          = (GameplayScreen)screen;
            RatingProcessor = new RatingProcessorKeys(MapManager.Selected.Value.DifficultyFromMods(Screen.Ruleset.ScoreProcessor.Mods));

            CreateBackground();

            if (OnlineManager.CurrentGame != null && OnlineManager.CurrentGame.Ruleset == MultiplayerGameRuleset.Battle_Royale &&
                ConfigManager.EnableBattleRoyaleBackgroundFlashing.Value)
            {
                BattleRoyaleBackgroundAlerter = new BattleRoyaleBackgroundAlerter(this);
            }

            if (!Screen.IsPlayTesting && !Screen.IsCalibratingOffset)
            {
                CreateScoreboards();
            }

            CreateProgressBar();
            CreateScoreDisplay();
            CreateRatingDisplay();
            CreateAccuracyDisplay();

            if (ConfigManager.DisplayComboAlerts.Value)
            {
                ComboAlert = new ComboAlert(Screen.Ruleset.ScoreProcessor)
                {
                    Parent = Container
                }
            }
            ;

            // Create judgement status display
            if (ConfigManager.DisplayJudgementCounter.Value)
            {
                if (OnlineManager.CurrentGame == null || OnlineManager.CurrentGame.Ruleset != MultiplayerGameRuleset.Team)
                {
                    JudgementCounter = new JudgementCounter(Screen)
                    {
                        Parent = Container
                    }
                }
                ;
            }

            CreateKeysPerSecondDisplay();
            CreateGradeDisplay();

            SkipDisplay = new SkipDisplay(Screen, SkinManager.Skin.Skip)
            {
                Parent = Container
            };

            if (Screen.IsMultiplayerGame)
            {
                MultiplayerEndTime = new MultiplayerEndGameWaitTime
                {
                    Parent    = Container,
                    Alignment = Alignment.MidCenter
                };
            }

            // Create screen transitioner to perform any animations.
            Transitioner = new Sprite()
            {
                Parent     = Container,
                Size       = new ScalableVector2(WindowManager.Width, WindowManager.Height),
                Tint       = Color.Black,
                Alpha      = 1,
                Animations =
                {
                    // Fade in from black.
                    new Animation(AnimationProperty.Alpha, Easing.Linear, 1, 0, 1500)
                }
            };

            // Create pause screen last.
            PauseScreen = new PauseScreen(Screen)
            {
                Parent = Container
            };

            // Notify the user if their local offset is actually set for this map.
            if (MapManager.Selected.Value.LocalOffset != 0)
            {
                NotificationManager.Show(NotificationLevel.Info, $"The local audio offset for this map is: {MapManager.Selected.Value.LocalOffset}ms");
            }

            if (Screen.IsCalibratingOffset)
            {
                Tip = new OffsetCalibratorTip
                {
                    Parent    = Container,
                    Alignment = Alignment.MidCenter
                };
            }

            if (OnlineManager.Client != null)
            {
                OnlineManager.Client.OnGameEnded += OnGameEnded;
            }
        }
Ejemplo n.º 12
0
 public static void Postfix(PauseScreen __instance)
 {
     LogLine("Hello! After OnLoadLevel.");
 }
Ejemplo n.º 13
0
 public static void DestroyInstance()
 {
     instance = null;
 }
Ejemplo n.º 14
0
 void Start()
 {
     PauseScreen = CreateGameObject.CreateChildGameObject <PauseScreen>(transform).GetComponent <PauseScreen>();
     Menu        = CreateGameObject.CreateChildGameObject <Menu>(transform).GetComponent <Menu>();
     Menu.SetParentScreen(PauseScreen);
 }
Ejemplo n.º 15
0
 public static void Postfix(PauseScreen __instance)
 {
     WirelessAutomationManager.ResetEmittersList();
     WirelessAutomationManager.ResetReceiversList();
 }
Ejemplo n.º 16
0
 void Awake()
 {
     S = this;
 }
Ejemplo n.º 17
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()
        {
            _gameScreen = new GameScreen();
            _startScreen = new StartScreen();
            _restartScreen = new RestartScreen();
            _pausedScreen = new PauseScreen();
            _passedScreen = new PassedScreen();
            _gameInfo = new GameInfo();
            _gameInfo.Level = 1;
            _gameInfo.Lives = 3;

            base.Initialize();
        }
Ejemplo n.º 18
0
 private void Awake()
 {
     current = this;
     screenCanvas = GetComponentInChildren<Canvas>();
     Hide();
 }
Ejemplo n.º 19
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public GameplayScreenView(Screen screen) : base(screen)
        {
            Screen = (GameplayScreen)screen;

            CreateBackground();
            CreateProgressBar();
            CreateScoreDisplay();
            CreateAccuracyDisplay();

            if (ConfigManager.DisplayComboAlerts.Value)
            {
                ComboAlert = new ComboAlert(Screen.Ruleset.ScoreProcessor)
                {
                    Parent = Container
                }
            }
            ;

            // Create judgement status display
            if (ConfigManager.DisplayJudgementCounter.Value)
            {
                JudgementCounter = new JudgementCounter(Screen)
                {
                    Parent = Container
                }
            }
            ;

            CreateKeysPerSecondDisplay();
            CreateGradeDisplay();

            if (!Screen.IsPlayTesting && !Screen.IsCalibratingOffset)
            {
                CreateScoreboard();
            }

            SkipDisplay = new SkipDisplay(Screen, SkinManager.Skin.Skip)
            {
                Parent = Container
            };

            // Create screen transitioner to perform any animations.
            Transitioner = new Sprite()
            {
                Parent     = Container,
                Size       = new ScalableVector2(WindowManager.Width, WindowManager.Height),
                Tint       = Color.Black,
                Alpha      = 1,
                Animations =
                {
                    // Fade in from black.
                    new Animation(AnimationProperty.Alpha, Easing.Linear, 1, 0, 1500)
                }
            };

            // Create pause screen last.
            PauseScreen = new PauseScreen(Screen)
            {
                Parent = Container
            };

            // Notify the user if their local offset is actually set for this map.
            if (MapManager.Selected.Value.LocalOffset != 0)
            {
                NotificationManager.Show(NotificationLevel.Info, $"The local audio offset for this map is: {MapManager.Selected.Value.LocalOffset}ms");
            }

            if (Screen.IsCalibratingOffset)
            {
                Tip = new OffsetCalibratorTip
                {
                    Parent    = Container,
                    Alignment = Alignment.MidCenter
                };
            }
        }
Ejemplo n.º 20
0
    // Update is called once per frame
    void Update()
    {
        if (PauseScreen.shouldPause(PAUSE_LEVEL))
        {
            return;
        }

        //sets m_CanGrapple to true when the players lands on the ground, this is necessary so the player can not keep grappling without ever touching the
        //ground.
        if (GetIsGrounded())
        {
            m_CanGrapple = true;
        }

        if (m_PlayerHealth.IsDead)
        {
            m_target.SetCurrentTarget(null);
            m_Grappling  = false;
            m_CanGrapple = false;
        }

        //checks if there is a target in sight
        if (m_target.GetCurrentTarget() != null && m_Grappling == false)
        {
            //checks if player is on ground, he can't grapple if on ground
            if (CanGrapple())
            {
                //Checks for input, if jump has been pressed then m_Grappling = true;
                if (InputManager.getJumpDown(m_AcceptInputFrom.ReadInputFrom) && m_PlayerHealth.IsDead != true)
                {
                    m_Grappling  = true;
                    m_CanGrapple = false;
                    m_GrappleHook.renderer.enabled = true;
                    m_CurrentTarget = m_target.GetCurrentTarget();
                }
            }
        }

        //checks the distance between the player and the target, if it's smaller than m_DistBeforeFalling, you will fall
        if (m_CurrentTarget != null)
        {
            if (Vector3.Distance(this.transform.position, m_CurrentTarget.transform.position) < m_DistBeforeFalling)
            {
                m_Grappling = false;
                m_GrappleHook.renderer.enabled = false;
            }
        }

        //if you should be grappling move to your target
        if (m_Grappling)
        {
            PlayAnimation();
            MoveTowardsTarget();
            SetGrappleTransform();
            return;
        }

        //Used to make sure that the player stops trying to grapple if his target gets destroyed
        if (m_target.GetCurrentTarget() == null)
        {
            m_Grappling = false;
        }


        base.UpdateVelocity();
    }
Ejemplo n.º 21
0
    // Update is called once per frame
    void Update()
    {
        if (ps == null)
        {
            ps = PlayerManager.GetMainPlayer().ps;
            ps.CheckTears();
        }

        if (!levelcomplete)
        {
            if ((watertear1.activeSelf && watertear2.activeSelf && watertear3.activeSelf) || PlayerPrefs.GetInt("IntroWatched", 0) == 0)
            {
                levelcomplete = true;
                if (PlayerPrefs.GetInt("IntroWatched", 0) == 1)
                {
                    if (PlayerPrefs.GetInt("Played" + levelID.ToString() + "TreeCompletion", 0) == 0)
                    {
                        PlayerPrefs.SetInt("Played" + levelID.ToString() + "TreeCompletion", 1);

                        ps.CheckTears();

                        if (ps.tearCount == 24)
                        {
                            WaterTearManager.AllTearsCutscene();
                            //    GameObject.FindWithTag("Pause").transform.Find("Event Text").gameObject.GetComponent<TextTriggerMain>().SetText(5);
#if UNITY_PS4
                            //
                            // check trophy
                            PS4Manager.ps4TrophyManager.UnlockTrophy((int)PS4_TROPHIES.FIND_ALL_WATER_TEARS);
#endif

#if UNITY_XBOXONE
                            //
                            // check trophy : items >= 3 and items = all
                            //
                            XONEAchievements.SubmitAchievement((int)XONEACHIEVS.ALL_TREE_SAGE_RESTORED);
#endif
                        }
                        else
                        {
                            if (levelID != 3 && ps.tearCount > 3)
                            {
                                GameObject.FindWithTag("Pause").transform.Find("Event Text").gameObject.GetComponent <TextTriggerMain>().SetText(4);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (PlayerPrefs.GetInt("IntroWatched", 0) == 1 && (!watertear1.activeSelf || !watertear2.activeSelf || !watertear3.activeSelf))
            {
                levelcomplete = false;
            }
        }

        if (levelcomplete)
        {
            if (treesage != null)
            {
                treesage.SetActive(true);
                treesagegrey.SetActive(false);
            }

            if (!wateractive1.activeInHierarchy)
            {
                wateractive1.SetActive(true);
            }

            if (!wateractive2.activeInHierarchy)
            {
                if (ps.tearCount == 24 || PlayerPrefs.GetInt("IntroWatched", 0) == 0)
                {
                    wateractive2.SetActive(true);

                    if (watermain1 != null)
                    {
                        watermain1.SetActive(true);
                        watermain2.SetActive(true);
                    }
                }
            }
        }
        else
        {
            if (treesage != null)
            {
                treesage.SetActive(false);
                treesagegrey.SetActive(true);
            }

            if (wateractive1.activeInHierarchy)
            {
                wateractive1.SetActive(false);
            }

            if (wateractive2.activeInHierarchy)
            {
                if (ps.tearCount != 24 && PlayerPrefs.GetInt("IntroWatched", 0) == 1)
                {
                    wateractive2.SetActive(false);

                    if (watermain1 != null)
                    {
                        watermain1.SetActive(false);
                        watermain2.SetActive(false);
                    }
                }
            }
        }
    }
Ejemplo n.º 22
0
 public static void Postfix(PauseScreen __instance)
 {
     LogLine("Hello! After OnPrefabInit. Trying to add AccountantUpdate.");
     Game.Instance.gameObject.AddComponent(typeof(AccountantUpdate));
 }
Ejemplo n.º 23
0
 public GUIPausedState(PauseScreen pauseScreen) {
     this.pauseScreen = pauseScreen;
 }
Ejemplo n.º 24
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);

            // Load the content for the start screen, add it to the components, and hide it.
            startScreen = new StartScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/StartScreen"));
            Components.Add(startScreen);
            startScreen.Hide();

            // Load the content for the loading screen.
            splashScreen = new SplashScreen(this, spriteBatch, Content.Load<Texture2D>("Menus/SampleSplashScreen"));
            Components.Add(splashScreen);
            splashScreen.Hide();

            // Load the content for the action screen, where most of the gameplay will occur.
            actionScreen = new ActionScreen(this, spriteBatch);
            Components.Add(actionScreen);
            actionScreen.Hide();

            // Load the content for the pause screen.
            pauseScreen = new PauseScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/PauseScreen"), actionScreen);
            Components.Add(pauseScreen);
            pauseScreen.Hide();

            // Load the content for the quit screen.
            quitScreen = new QuitScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/QuitScreen"), actionScreen);
            Components.Add(quitScreen);
            quitScreen.Hide();

            // Load the content for the dialogue screen.
            dialogueScreen = new DialogueScreen(this, spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("Menus/DialogueScreen"), actionScreen);
            Components.Add(dialogueScreen);
            dialogueScreen.Hide();

            // When the game starts, the active screen is the start screen.
            activeScreen = startScreen;
            activeScreen.Show();
        }
Ejemplo n.º 25
0
        // ============================================================================
        //							   ***** DESTROY *****
        // ============================================================================
        /// <summary>
        /// Ne pas oublier de remove les events.
        /// </summary>
        protected void OnDestroy()
        {
            LevelSelector lLevelSelector = LevelSelector.Instance;
            Hud           lHud           = Hud.Instance;
            PauseScreen   lPauseScreen   = PauseScreen.Instance;
            Options       lOptions       = Options.Instance;

            if (lOptions != null)
            {
                lOptions.OnMusicVolume -= Options_OnMusicVolume;
                lOptions.OnSFXVolume   -= Options_OnSFXVolume;
            }

            if (uiManager != null)
            {
                uiManager.OnLoadFinish -= UIManager_OnLoadFinish;
            }

            if (loader != null)
            {
                loader.OnProgress    -= Loader_OnProgress;
                loader.OnPreloadDone -= Loader_OnPreloadDone;
                loader.OnCompleted   -= Loader_OnCompleted;
            }

            if (levelManager != null)
            {
                levelManager.OnLose -= LevelManager_OnLose;
                levelManager.OnWin  -= LevelManager_OnWin;
                levelManager.OnCameraFinishToward -= LevelManager_OnCameraFinishToward;
                levelManager.OnTotalTimeInGame    -= LevelManager_OnTotalTimeInGame;
                levelManager.OnGainSoftCurrencies -= LevelManager_OnGainSoftCurrencies;
                levelManager.OnPastTime           -= LevelManager_OnPastTime;
            }

            if (myIAPManager != null)
            {
                myIAPManager.OnPurchaseSuccess -= MyIAPManager_OnPurchaseSuccess;
                myIAPManager.OnPurchaseFail    -= MyIAPManager_OnPurchaseFail;
            }

            if (myServer != null)
            {
                myServer.OnLoginSuccess        -= ServerManager_OnLoginSuccess;
                myServer.OnGettingDatasSuccess -= ServerManager_OnGettingDatasSuccess;
                myServer.OnStartFTUE           -= FTUE;
            }

            if (lLevelSelector != null)
            {
                lLevelSelector.OnPlay           -= LevelSelector_OnPlay;
                lLevelSelector.OnDailyQuestPlay -= LevelSelector_OnDailyQuestPlay;
            }

            if (lHud != null)
            {
                lHud.OnPause -= Hud_OnPause;
            }

            if (lPauseScreen != null)
            {
                lPauseScreen.OnResume -= PauseSreen_OnResume;
            }
        }
Ejemplo n.º 26
0
 public void SetReferences()
 {
     player1Script = GameObject.Find("John").GetComponent<Player>();
     player2Script = GameObject.Find("Brian").GetComponent<Player>();
     p1 = GameObject.Find("John");
     p2 = GameObject.Find("Brian");
     pauseScreen = GameObject.Find("PauseScreen").GetComponent<PauseScreen>();
 }
Ejemplo n.º 27
0
 public GameState_Pause()
 {
     this._screen = PauseScreen.GetInstance();
 }
Ejemplo n.º 28
0
        public PlayerView(GameLogic game)
        {
            this.Game         = game;
            this.EventManager = game.EventManager;

            menuClock = new GameClock();
            menuClock.Start();

            /**
             * Initialize Graphics Subsystem
             **/
            RenderForm                 = new Form();
            RenderForm.ClientSize      = new Size(Game.World.Width, Game.World.Height);
            RenderForm.Text            = "Alien Invasion v1.0";
            RenderForm.BackColor       = Color.Empty;
            RenderForm.KeyPreview      = true;
            RenderForm.FormBorderStyle = FormBorderStyle.FixedSingle; // Disable resizing of window
            RenderForm.MaximizeBox     = false;                       // Disable maximizing
            RenderForm.Leave          += (s, e) => {
                this.RenderForm.Focus();                              // When RenderForm loses focus player input won't be processed correctly
            };

            extractor = new Extractor(game);
            Renderer  = new Graphics.Renderer(RenderForm, extractor);
            Renderer.StartRender();

            rendererLoaders.Add(new TextureLoader(Renderer));
            rendererLoaders.Add(new MeshLoader(Renderer));
            rendererLoaders.Add(new EffectLoader(Renderer));

            foreach (var rendererLoader in rendererLoaders)
            {
                game.ResourceManager.AddLoader(rendererLoader);
            }

            game.ResourceManager.AddLoader(new MaterialLoader(game.ResourceManager));

            /**
             * Initialize Input Subsystem
             **/
            gameController      = new GameController(EventManager, game);
            RenderForm.KeyDown += new KeyEventHandler(gameController.OnKeyDown);
            RenderForm.KeyUp   += new KeyEventHandler(gameController.OnKeyUp);

            /**
             * Initialize Audio Subsystem
             **/
            audioPlayer = new FmodAudioPlayer(@"./data/audio/");
            audioPlayer.LoadFile("audio.fev");
            audioPlayer.IsPaused = false;

            /**
             * Initialize GUI
             **/
            mainMenuControl          = new GameMainMenu(EventManager);
            mainMenuControl.Location = new Point(
                (RenderForm.ClientSize.Width - mainMenuControl.Width) / 2,
                (RenderForm.ClientSize.Height - mainMenuControl.Height) / 2);
            RenderForm.Controls.Add(mainMenuControl);

            highscoreControl          = new HighscoreScreen(EventManager);
            highscoreControl.Location = new Point(
                (RenderForm.ClientSize.Width - highscoreControl.Width) / 2,
                (RenderForm.ClientSize.Height - highscoreControl.Height) / 2);
            RenderForm.Controls.Add(highscoreControl);

            creditsControl          = new Credits(EventManager);
            creditsControl.Location = new Point(
                (RenderForm.ClientSize.Width - creditsControl.Width) / 2,
                (RenderForm.ClientSize.Height - creditsControl.Height) / 2);
            RenderForm.Controls.Add(creditsControl);

            pauseControl          = new PauseScreen();
            pauseControl.Location = new Point(
                (RenderForm.ClientSize.Width - pauseControl.Width) / 2,
                (RenderForm.ClientSize.Height / 2) - pauseControl.Height);
            RenderForm.Controls.Add(pauseControl);

            victoryControl          = new VictoryScreen(EventManager);
            victoryControl.Location = new Point(
                (RenderForm.ClientSize.Width - victoryControl.Width) / 2,
                (RenderForm.ClientSize.Height / 2) - (victoryControl.Height / 2));
            RenderForm.Controls.Add(victoryControl);

            gameOverControl          = new DefeatScreen(EventManager);
            gameOverControl.Location = new Point(
                (RenderForm.ClientSize.Width - gameOverControl.Width) / 2,
                (RenderForm.ClientSize.Height / 2) - (gameOverControl.Height / 2));
            RenderForm.Controls.Add(gameOverControl);

            hud          = new Hud(EventManager);
            hud.Location = new Point(RenderForm.ClientSize.Width - hud.Width, 0);
            RenderForm.Controls.Add(hud);

            numOfGcCollectedObjects = new int[GC.MaxGeneration];

            registerGameEventListeners();
        }
Ejemplo n.º 29
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public GameplayScreenView(Screen screen) : base(screen)
        {
            Screen = (GameplayScreen)screen;
            BackgroundContainer = new Container();

            BackgroundHelper.Background.Dim = 100 - ConfigManager.BackgroundBrightness.Value;

            BackgroundManager.PermittedToFadeIn = false;
            FadeBackgroundToDim();
            BackgroundManager.Loaded += OnBackgroundLoaded;

            CreateProgressBar();
            CreateScoreDisplay();
            CreateAccuracyDisplay();

            // Create judgement status display
            JudgementCounter = new JudgementCounter(Screen)
            {
                Parent = Container
            };

            CreateKeysPerSecondDisplay();
            CreateGradeDisplay();

            // Song Information Display
            SongInfo = new SongInformation(Screen)
            {
                Parent    = Container,
                Alignment = Alignment.MidCenter,
                Y         = -200
            };

            CreateScoreboard();

            SkipDisplay = new SkipDisplay(Screen, SkinManager.Skin.Skip)
            {
                Parent = Container
            };

            // Create screen transitioner to perform any animations.
            Transitioner = new Sprite()
            {
                Parent     = Container,
                Size       = new ScalableVector2(WindowManager.Width, WindowManager.Height),
                Tint       = Color.Black,
                Alpha      = 1,
                Animations =
                {
                    // Fade in from black.
                    new Animation(AnimationProperty.Alpha, Easing.Linear, 1, 0, 1500)
                }
            };

            // Create pause screen last.
            PauseScreen = new PauseScreen(Screen)
            {
                Parent = Container
            };

            // Notify the user if their local offset is actually set for this map.
            if (MapManager.Selected.Value.LocalOffset != 0)
            {
                NotificationManager.Show(NotificationLevel.Info, $"The local audio offset for this map is: {MapManager.Selected.Value.LocalOffset}ms");
            }
        }
Ejemplo n.º 30
0
 public void UnpauseGame()
 {
     Time.timeScale = 1;
     PauseScreen.SetActive(false);
     paused = false;
 }
Ejemplo n.º 31
0
 public void PauseGame()
 {
     Time.timeScale = 0;
     PauseScreen.SetActive(true);
     paused = true;
 }
Ejemplo n.º 32
0
 private void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 33
0
 public static void Postfix(PauseScreen __instance) => WirelessPowerGrid.Instance.ClearGrid();
Ejemplo n.º 34
0
        //clears everything and starts a new game (reinitialize)
        public void StartGame()
        {
            Components.Clear();

            // game objective
            objDetermine = Random.Next(3);
            switch (objDetermine)
            {
            case 0:
                gameObj = Objective.Scientist;
                break;

            case 1:
                gameObj = Objective.Bomb;
                break;

            default:
                gameObj = Objective.Elimination;
                break;
            }
            objTimer = 0;
            objShow  = true;
            objRoom  = Random.Next(10, 18);
            objRoom2 = Random.Next(18);
            while (objRoom2 == objRoom)
            {
                objRoom2 = Random.Next(18);
            }
            objEliminate = 40;
            heliRoom     = Random.Next(0, 9);

            player = new PlayerSprite(this, "Images//playerWalk", new Vector2(GlobalClass.ScreenWidth / 2,
                                                                              GlobalClass.ScreenHeight / 2), 2, 6, this);

            gridNumbers = new List <int>(Enumerable.Range(0, 9));
            Shuffle(gridNumbers);

            street0 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.White, 0);
            street1 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightBlue, 1);
            street2 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightCoral, 2);
            street3 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGoldenrodYellow, 3);
            street4 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGreen, 4);
            street5 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGray, 5);
            street6 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightPink, 6);
            street7 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSteelBlue, 7);
            street8 = new Room(this, "Images//Maps//External//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSeaGreen, 8);

            room0 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.White, 9);
            room1 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightBlue, 10);
            room2 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightCoral, 11);
            room3 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGoldenrodYellow, 12);
            room4 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGreen, 13);
            room5 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightGray, 14);
            room6 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightPink, 15);
            room7 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSteelBlue, 16);
            room8 = new Room(this, "Images//Maps//Internal//test01", new Vector2(100, 100), 1, 1, false, false, player, Color.LightSeaGreen, 17);

            //add rooms to game
            Components.Add(street0);
            Components.Add(player);

            //Add game components
            Components.Add(new Enemy(this, "Images//enemyWalk", new Vector2(200, 200), 2, 5));
            elements = new GameElements(this, player);
            elements.Initialize();
            camera = new Camera(this);

            //Splashscreen component
            splashScreen = new SplashScreen(this);
            menuScreen   = new MenuScreen(this);
            pauseScreen  = new PauseScreen(this);
            endScreen    = new EndScreen(this);
            tutScreen    = new TutScreen(this);
            Components.Add(splashScreen);
            Components.Add(menuScreen);
            Components.Add(pauseScreen);
            Components.Add(endScreen);
            Components.Add(tutScreen);
        }
Ejemplo n.º 35
0
    void Start()
    {
        RGlowColor = PlayerPrefs.GetString("GlowColor");

        switch (RGlowColor)
        {
        case "Cyan":
            RColor = Color.cyan;
            break;

        case "Green":
            RColor = Color.green;
            break;

        case "Purple":
            RColor = Color.green;
            break;

        case "White":
            RColor = Color.white;
            break;
        }

        ScoreSpotlight.color           = RColor;
        ScoreSpotlight.bounceIntensity = 8;

        Application.targetFrameRate = 30;
        //PlayerPrefs.DeleteAll();
        Time.timeScale = 0;
        ScoreSpotlight.GetComponent <Animator>().enabled = false;
        //Taking saved Highscore
        level = PlayerPrefs.GetInt("Level");

        switch (level)
        {
        case 1:
            HighScore = PlayerPrefs.GetInt("L1HighScore");
            break;

        case 2:
            HighScore = PlayerPrefs.GetInt("L2HighScore");
            break;
        }

        score = 0;
        CheckSound();

        //Initializing other variables
        RunnerOneScript   = RunnerOne.GetComponent <ReachExit1> ();
        RunnerTwoScript   = RunnerTwo.GetComponent <ReachExit2> ();
        BonusRunnerScript = BonusRunner.GetComponent <BonusReachExit> ();
        RunnerOneScript.r = 3;
        RunnerTwoScript.r = 4;
        Physics.IgnoreCollision(RunnerOne.GetComponent <Collider> (), RunnerTwo.GetComponent <Collider> ());        //Runners will pass through each other
        // PauseScreen = GameObject.FindGameObjectWithTag ("PauseScreen");
        // GameOver = GameObject.FindGameObjectWithTag("GameOverPanel");
        PauseButton.SetActive(false);
        CountDown.SetActive(false);
        GameOver.SetActive(false);
        PauseScreen.SetActive(false);
        BonusRunner.SetActive(false);
        paused        = false;
        gameOver      = false;
        timer         = 0;
        scoreInterval = 0.1f;

        //COUNTING
        countText = CountDown.GetComponent <TextMeshProUGUI>();
        StartCoroutine(GetReady());
    }
 private void Start()
 {
     ps = GameObject.FindWithTag("Pause").GetComponent <PauseScreen>();
 }
Ejemplo n.º 37
0
    public IEnumerator ResetCharacter(TPC character)
    {
        character.challengeReset = true;
        if (character == PlayerManager.GetMainPlayer())
        {
            if (ps == null)
            {
                ps = character.ps;
            }

            character.disableControl = true;
            character.ExitRiverForce();
            character.ExitWaterFS();
            character.inWindCol = false;

            foreach (TPC mtpc in ps.multiTPC)
            {
                mtpc.disableControl = true;
                mtpc.ExitRiverForce();
                mtpc.ExitWaterFS();
            }
            ps.cam.disableControl = true;

            ps.cantPause = true;

            for (int f = 1; f <= 60; f++)
            {
                AudioListener.volume = Mathf.Lerp(1f, 0f, (f * 1f) / 60f);
                ps.loadFS.color      = Color.Lerp(Color.clear, Color.white, (f * 1f) / 60f);
                yield return(null);
            }

            character.transform.position = this.transform.position + Vector3.up;
            character.anim.enabled       = true;
            character.anim.SetBool("damaged", false);
            character.anim.Play("Idle", 0);
            character.onGround       = true;
            character.rb.isKinematic = true;
            ps.PositionMultiCharacters();

            ps.cam.disableControl = false;

            yield return(new WaitForSeconds(2f));

            for (int f = 59; f >= 0; f--)
            {
                AudioListener.volume = Mathf.Lerp(1f, 0f, (f * 1f) / 60f);
                ps.loadFS.color      = Color.Lerp(Color.clear, Color.white, (f * 1f) / 60f);
                yield return(null);
            }

            character.capcol.enabled = true;
            character.rb.isKinematic = false;
            character.disableControl = false;
            foreach (TPC mtpc in ps.multiTPC)
            {
                mtpc.disableControl = false;
            }
            character.rb.velocity = Vector3.zero;
            ps.cantPause          = false;

            character.challengeReset = false;
        }
        else
        {
            StartCoroutine(character.RespawnCharacterWait());
        }
    }