Example #1
0
 public Game(MenuGame mode)
 {
     Mode            = mode;
     acceptedChoices = new string[] { "r", "p", "f", "s" };
     PrincipalUser   = new HumanPlayer("Player_1");
     PrincipalUser.acceptedChoices = acceptedChoices;
 }
 public MenuManager(MenuState ms)
 {
     menuState     = ms;
     this.menuGame = new MenuGame();
     this.menuHome = new MenuHome();
     this.menuGO   = new MenuGO();
 }
        // GAME METHODS
        public void Update(GameTime gameTime, Input input)
        {
            switch (menuState)
            {
            case MenuState.HOME:
                this.menuHome.Update(gameTime, input);
                this.menuGame = new MenuGame();
                break;

            case MenuState.GAME:
                this.menuGame.Update(gameTime, input);
                this.menuHome = new MenuHome();
                this.menuGO   = new MenuGO();
                break;

            case MenuState.GO:
                this.menuGO.Update(gameTime, input);
                this.menuHome = new MenuHome();
                break;

            default:

                break;
            }
        }
Example #4
0
    public void Restart()
    {
        MenuGame.ReportScore(PlayerPrefs.GetInt("MaxScore", MaxScore));
        Debug.Log(PlayerPrefs.GetInt("MaxScore", MaxScore));

        //PlayerPrefs.SetInt("deadCounter", deadCounter);
        deadCounter++;
        Debug.Log(deadCounter);
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
    void Update()
    {
        if (resume != null && quit != null && menu != null)
        {
            RaycastHit seen;
            Ray        raydirection = new Ray(transform.position, transform.forward);

            if (Physics.Raycast(raydirection, out seen, sightlength))
            {
                if (seen.collider.tag.Equals("ResumeGame"))
                {
                    if (resume.load())
                    {
                        pgc.resume();
                    }
                }
                else if (seen.collider.tag.Equals("QuitGame"))
                {
                    if (quit.load())
                    {
                        Application.Quit();
                    }
                }
                else if (seen.collider.transform.name.Equals("MenuGame"))
                {
                    if (menu.load())
                    {
                        pgc.inactivatePauseMenu();
                        Time.timeScale = 1;
                        gameManager.resetGame();
                        SceneManager.LoadScene("GameStart");
                    }
                }
                else
                {
                    resume.unload();
                    quit.unload();
                    menu.unload();
                }
            }
            else
            {
                resume.unload();
                quit.unload();
                menu.unload();
            }
        }
        else
        {
            resume = FindObjectOfType <ResumeGame>();
            quit   = FindObjectOfType <QuitGame>();
            menu   = FindObjectOfType <MenuGame>();
        }
    }
Example #6
0
 // UPDATE & DRAW
 public void Update(GameTime gameTime)
 {
     if (reset)
     {
         mainMenu = new MenuMain();
         gameMenu = new MenuGame();
         reset    = false;
     }
     if (activeMenu == "main")
     {
         mainMenu.Update(gameTime);
     }
     else if (activeMenu == "game")
     {
         gameMenu.Update(gameTime);
     }
 }
Example #7
0
    void Start()
    {
        if (Level >= 7)
        {
            Turret = GameObject.FindGameObjectsWithTag("Turret");
            for (int i = 0; i < Turret.Length; i++)
            {
                Turret[i].GetComponent <Tourelle>().Explosif = true;
            }
        }

        bulletDeleted -= 1;
        Name           = "Record" + Level;
        name           = "Level" + Level;

        if (PlayerPrefs.GetInt(Name) == 0)
        {
            Record = "-";
        }
        else
        {
            Record = PlayerPrefs.GetInt(Name).ToString();
        }

        if (menuGame == null && Game)
        {
            menuGame = GameObject.FindGameObjectWithTag("Canvas").GetComponent <MenuGame>();
        }

        if (LevelText == null && Game)
        {
            LevelText = GameObject.FindGameObjectWithTag("Level").GetComponent <Text>();
        }

        if (Player == null && Game)
        {
            Player = GameObject.FindGameObjectWithTag("Player");
        }

        if (Game)
        {
            TimerText.text = "Timer: " + Mathf.Round(timer).ToString() + "         " + "record: " + Record;
        }
    }
 void Start()
 {
     survival    = FindObjectOfType <Survival>();
     back        = FindObjectOfType <MenuGame>();
     gameManager = FindObjectOfType <GameManager>();
 }
Example #9
0
 public void LeaderboardButton()
 {
     MenuGame.ShowLeaderboards();
     //Social.ShowLeaderboardUI();
 }
Example #10
0
 public void Exit()
 {
     MenuGame.ReportScore(PlayerPrefs.GetInt("MaxScore", MaxScore));
     SceneManager.LoadScene("MenuGame");
     //Application.Quit();
 }