Пример #1
0
        public static void Initialize()
        {
            // Initialize game window, set's the Global.CurrentScreen
            var gameWindow = new GameWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameWindow);

            // Initialize map
            var map = new MapWindow(Constants.Map.Width, Constants.Map.Height);

            Add(map);
            map.Initialize();

            // Initialize dialog window
            var dialogWindow = new DialogWindow(Constants.Map.Width, 6);

            Add(dialogWindow);

            // Initialize game over window
            var gameOverWindow = new GameOverWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameOverWindow);

            // Initialize inventory
            var inventory = new InventoryWindow(Constants.GameWindowWidth / 3, 15);

            Add(inventory);
            inventory.Initialize();

            var fovWindow = new FovWindow(Constants.GameWindowWidth / 3, 12);

            Add(fovWindow);

            IsInitialized = true;
        }
Пример #2
0
    private void Awake()
    {
        instance = this;

        transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = Retry;
        instance.gameObject.SetActive(false);
    }
Пример #3
0
    public static void SnakeDeath()
    {
        bool isNewHighScore = Score.SetNewHighScore();

        GameOverWindow.ShowStatic(isNewHighScore);
        ScoreWindow.HideStatic();
    }
Пример #4
0
    public static void SnakeDied()
    {
        bool isNewHighscore = Score.TrySetNewHighscore();

        GameOverWindow.ShowStatic(isNewHighscore);
        ScoreWindow.HideStatic();
    }
Пример #5
0
        /// <summary>
        /// Reaction to left click of button.
        /// Show field on selected button and check from database, if game still continues.
        /// If yes, refresh field.
        /// If lost, call GameLost method
        /// If won, call GameWon method
        /// </summary>
        /// <param name="param">Button representing one field in game</param>
        private void ShowField(object param)
        {
            int gameState = (int)DBHelper.GetGame(this.OblastID).stav; // check if you can play

            if (gameState == (int)DBHelper.State.Playing)
            {
                Button b = param as Button;
                POLE   p = b.DataContext as POLE;

                DBHelper.ShowField(this.OblastID, p.souradnice_x, p.souradnice_y);

                gameState = (int)DBHelper.GetGame(this.OblastID).stav; // check state after move
                if (gameState != (int)DBHelper.State.Playing)
                {
                    this.Timer.Enabled = false; // stop counting time

                    if (gameState == (int)DBHelper.State.Won)
                    {
                        this.GameWon();
                        GameOverWindow gameWin = new GameOverWindow();
                        gameWin.ShowDialog();
                    }
                    else if (gameState == (int)DBHelper.State.Lost)
                    {
                        this.GameLost(p);
                        GameOverWindow gameWin = new GameOverWindow();
                        gameWin.ShowDialog();
                    }
                }
                else
                {
                    this.RefreshGame();
                }
            }
        }
Пример #6
0
    IEnumerator ShowGameOverWindow()
    {
        yield return(new WaitForSeconds(3f));

        SceneManager.UnloadScene("level");
        GameOverWindow.Show();
    }
Пример #7
0
 private void GameOver()
 {
     Time.timeScale = 0.0f;
     gameOver       = true;
     gameOn         = false;
     GameOverWindow.ShowStatic();
 }
    public static void SnakeDied()
    {
        bool isNewHighscore = Score.TrySetNewHighscore(level);

        //zapisz najwyzszy wynik
        GameOverWindow.ShowStatic(isNewHighscore);
        ScoreWindow.HideStatic();
    }
Пример #9
0
    public override void Death()
    {
        // GameOver
        GameOverWindow window = WindowManager.Singleton.ShowWindow <GameOverWindow>(UIWindowType.GAME_OVER_WINDOW);

        window.SetContent();
        CharacterManager.Singleton.RemoveCharacter(this);
    }
Пример #10
0
 public GuiController()
 {
     _menuWindow      = new MenuWindow();
     _creditWindow    = new CreditWindow();
     _exitWindow      = new ExitWindow();
     _gameOverWindow  = new GameOverWindow();
     _highScoreWindow = new HighScoreWindow();
 }
Пример #11
0
    private void Awake()
    {
        instance = this;

        //button = transform.Find("retryButton").GetComponent<Button>();
        button.onClick.AddListener(retry);
        titleScreenButton.onClick.AddListener(title);
    }
Пример #12
0
 private void GameOver()
 {
     Time.timeScale = 0.0f;
     gameOver       = true;
     gameOn         = false;
     Score.TrySetNewHighScore(Score.GetScore());
     GameOverWindow.ShowStatic();
 }
Пример #13
0
 private void Awake()
 {
     instance         = this;
     resetButton      = transform.Find("resetButton").GetComponent <Button>();
     finalScore       = transform.Find("ScoreDisplay").GetComponent <Text>();
     currentHighscore = transform.Find("CurrentHighscore").GetComponent <Text>();
     gameOverText     = transform.Find("GameOverText").GetComponent <Text>();
     Hide();
 }
Пример #14
0
    private void Awake()
    {
        instance = this;

        transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = () => {
            Loader.Load(Loader.Scene.GameScene);
        };
        Hide();
    }
Пример #15
0
    private void Awake()
    {
        instance = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;

        Hide();
    }
Пример #16
0
    private void Awake()
    {
        overWindow = this;

        gameOverButton.ClickFunc = () =>
        {
            GameLoader.Load(GameLoader.Scene.GameScene);
        };

        Hide();
    }
Пример #17
0
 private static void changeVous(string pseudo)
 {
     for (int i = 0; i < 10; i++)
     {
         if (GetHighScorePseudo(i) == "VOUS")
         {
             SetHighScore(pseudo, i, GetHighScore(i));
         }
     }
     GameOverWindow.ShowStaticUpdated();
 }
Пример #18
0
    private void Awake()
    {
        instance = this;
        // reference to this button
        transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = () => {
            // Load the GameScene
            Loader.Load(Loader.Scene.GameScene);
        };

        Hide();
    }
    private void Awake()
    {
        instance = this;
        transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = () => Loader.Load(Loader.Scene.GameScene);
        transform.Find("retryBtn").GetComponent <Button_UI>().AddButtonSound(); // dzwieki do przyciskow

        transform.Find("backBtn").GetComponent <Button_UI>().ClickFunc = () => Loader.Load(Loader.Scene.MainMenu);
        // po kliknieciu przycisku main menu wroc do sceny glownego menu
        transform.Find("backBtn").GetComponent <Button_UI>().AddButtonSound(); // dzwieki do przyciskow

        Hide();
    }
Пример #20
0
    public static void PlayerDied()
    {
        if (playsound_dead)
        {
            SoundManager.PlaySound(SoundManager.Sound.Dead);
            playsound_dead = false;
        }
        bool isNewHighscore = Score.TrySetNewHighscore();

        GameOverWindow.ShowStatic(isNewHighscore);
        ScoreWindow.HideStatic();
    }
Пример #21
0
 public static void WinLevel()
 {
     WinWindow.ShowStatic();
     GameWindow.HideStatic();
     GameOverWindow.HideStatic();
     GamePlayWindow.HideStatic();
     foreach (AudioSource audio in FindObjectsOfType <AudioSource>())
     {
         Destroy(audio.gameObject);
     }
     SoundManager.PlaySound(SoundManager.Sound.VictoryTheme);
     Time.timeScale = 0f;
 }
Пример #22
0
        private void GameOver()
        {
            enemyAttackTimer.Stop();
            song.Stop();
            song.Position = TimeSpan.FromSeconds(0);
            enemyBulletTimer.Stop();
            strafeTimer.Stop();
            bulletTimer.Stop();
            GameOverWindow GameOverWindow = new GameOverWindow(killCount);

            GameOverWindow.Show();
            this.Close();
        }
        public void StartGame()
        {
            myGame.SetHero(new Hero("HERO", (AppSettings.GameScreenWidth - AppSettings.HeroWidth) / 2, AppSettings.GameScreenHeight - 4));
            int universalID = 0;

            for (int x = 0; x < AppSettings.EnemyCount; x++)
            {
                Random rnd = new Random();
                myGame.AddEnemy(new Enemy(universalID, "Enemy_" + universalID,
                                          rnd.Next(AppSettings.EnemyAreaFromX, AppSettings.EnemyAreaToX), rnd.Next(AppSettings.EnemyAreaFromY, AppSettings.EnemyAreaToY)));
                universalID++;
            }
            myGame.Render();

            bool needToRender = true;

            do
            {
                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo pressedChar = Console.ReadKey(true);
                    switch (pressedChar.Key)
                    {
                    case ConsoleKey.Escape:
                        needToRender = false;
                        break;

                    case ConsoleKey.Spacebar:
                        myGame.CreateBall();
                        break;

                    case ConsoleKey.RightArrow:
                        myGame.MoveHeroRight();
                        break;

                    case ConsoleKey.LeftArrow:
                        myGame.MoveHeroLeft();
                        break;
                    }
                }
                myGame.Recalculate();
                System.Threading.Thread.Sleep(50);
            } while (!myGame.IsGameLost && needToRender && !myGame.IsGameWin);

            if (needToRender == true) // t.y. išėjome su Escape
            {
                GameOverWindow gameOverWindow = new GameOverWindow(35, 8, 50, 19, myGame.GetScores(), myGame.GetReason());;
                gameOverWindow.Render();
            }
        }
Пример #24
0
 public void GameOver(bool win)
 {
     // TODO: if they won, show a different/cheerful form
     if (!win)
     {
         var window = new GameOverWindow();
         window.Show();
         MainWindow.GetInstance().Close();
     }
     else
     {
         var window = new YouWinWindow();
         window.Show();
         MainWindow.GetInstance().Close();
     }
 }
Пример #25
0
 void Replay()
 {
     gameState = GameState.PlayGame;
     time      = Time.timeSinceLevelLoad;
     Character.SetActiveRecursively(true);
     GameOverWindow.SetActiveRecursively(false);
     TutorialWindow.SetActiveRecursively(true);
     if (currentPlayMode == CurrentPlayMode.Black)
     {
         CharWRender.active = false;
     }
     if (currentPlayMode == CurrentPlayMode.White)
     {
         CharBRender.active = false;
     }
 }
 private void Awake()
 {
     instance = this;
     if (gamemode == 1)
     {
         transform.Find("retryReactionBtn").GetComponent <Button_UI>().ClickFunc = () => {
             Loader.Load(Loader.Scene.Reaction_mode);
         };
     }
     else
     {
         transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = () =>
         {
             Loader.Load(Loader.Scene.GameScene);
         };
     }
     Hide();
 }
Пример #27
0
 //Kun peli alkaa
 private void Awake()
 {
     instance = this;
     //Haetaan retryBtn -nappi
     transform.Find("retryBtn").GetComponent <Button_UI>().ClickFunc = () =>
     {
         //retryBtn lataa uudestaan "GameScene" -ruudun
         Loader.Load(Loader.Scene.GameScene);
     };
     //Haetaan extiGame -nappi
     transform.Find("exitBtn").GetComponent <Button_UI>().ClickFunc = () =>
     {
         //gameExit lataa "MainMenu" -ruudun
         Loader.Load(Loader.Scene.MainMenu);
     };
     //Kutsutaan pelin alkaessa Hide() -funktiota
     Hide();
 }
Пример #28
0
        private async void OnGameWin()
        {
            timer.Stop();
            if (currentLevel != null)
            {
                await statisticManager.AddGame(new TimeSpan(0, 0, time), true, currentLevel.Id);
            }
            GameOverWindow gameOverWindow = new GameOverWindow();

            gameOverWindow.DataContext = new GameOverViewModel(isGameWin: true);
            if (gameOverWindow.ShowDialog() == true)
            {
                this.Close();
            }
            else
            {
                NewGame();
            }
        }
Пример #29
0
        public static GameOverWindow AddGameOverWindow() // show up "Game over" window
        {
            Grid mainGrid = GetGamePageMainGrid();

            mainGrid.Children.OfType <YouWinWindow>().ToList().ForEach(x => { mainGrid.Children.Remove(x); x = null; }); // remove YouWinWinow (if any) before adding GameOverWindow

            if (!mainGrid.Children.OfType <GameOverWindow>().Any())                                                      // if "You Win!" window isn't shown up already
            {
                GameOverWindow GOW = new GameOverWindow();
                mainGrid.Children.Add(GOW);
                Grid.SetRow(GOW, 1);
                Grid.SetColumn(GOW, 1);
                return(GOW);
            }
            else // else return already shown up window
            {
                return(mainGrid.Children.OfType <GameOverWindow>().FirstOrDefault());
            }
        }
Пример #30
0
        private async void OnGameOver(Cell bombedCell)
        {
            timer.Stop();
            buttonsMatrix[bombedCell.RowIndex, bombedCell.ColumnIndex].Content = cellToImageConverter.ConvertToImage(bombedCell);
            if (currentLevel != null)
            {
                await statisticManager.AddGame(new TimeSpan(0, 0, time), false, currentLevel.Id);
            }
            GameOverWindow gameOverWindow = new GameOverWindow();

            gameOverWindow.DataContext = new GameOverViewModel();
            if (gameOverWindow.ShowDialog() == true)
            {
                this.Close();
            }
            else
            {
                NewGame();
            }
        }
Пример #31
0
    public void Init()
    {
        cam              = GameObject.Find("Main Camera").GetComponent <Camera>();
        bgTrans          = GameObject.Find("GameArea/bg").GetComponent <Transform>();
        leftTrans        = GameObject.Find("GameArea/Left").GetComponent <Transform>();
        rightTrans       = GameObject.Find("GameArea/Right").GetComponent <Transform>();
        bottomTrans      = GameObject.Find("GameArea/Bottom").GetComponent <Transform>();
        nextShow         = GameObject.Find("GameArea/NextShow").GetComponent <SpriteRenderer>();
        warningLineTrans = GameObject.Find("GameArea/WarningLine").GetComponent <Transform>();


        mainWindow     = GameObject.Find("GameArea/Canvas/MainWindow").GetComponent <MainWindow>();
        gameOverWindow = GameObject.Find("GameArea/Canvas/GameOverWindow").GetComponent <GameOverWindow>();

        maxMergeEffect = GameObject.Find("GameArea/MaxMergeEffect").GetComponent <MaxMergeEffect>();

        welcomeArea = GameObject.Find("GameArea/WelcomeArea").GetComponent <WelcomeArea>();


        AdjustGameArea.Init(cam, bgTrans, leftTrans, rightTrans, bottomTrans);
        logic = new GameLogic(cam, nextShow, warningLineTrans);
    }
Пример #32
0
 internal void GameOverEventCheat()
 {
     // change this
     var window = new GameOverWindow();
     window.Show();
 }