Exemplo n.º 1
0
 private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene.name == "StartMenu")
     {
         playerInputManager.EnableJoining();
     }
     else
     {
         playerInputManager.DisableJoining();
     }
 }
Exemplo n.º 2
0
        public IEnumerator GameOver()
        {
            gameOver = true;
            //reset all players, delete all Grids, go to menu
            GuiController.Instance.ShowGameOver(lastPlayer);
            SoundsLib.Instance.play2D(enums.Sounds.gameOver);

            yield return(new WaitForSeconds(5));

            foreach (GameObject p in GameObject.FindGameObjectsWithTag("Player"))
            {
                Destroy(p);
            }
            players = new List <GameObject>();

            gameIsRunning = false;
            GuiController.Instance.hideGameOver();

            CameraController.Instance.reset();
            GameObject.Find("Main Camera").GetComponent <CameraController>().enabled = false;


            SceneController.Instance.LoadScene(enums.GameScenes.Menu);
            manager.EnableJoining();
            gameOver = false;
            StopCoroutine("GameOver");
        }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Awake()
 {
     _playerInputManager = GetComponent <PlayerInputManager>();
     if (MatchController.GetInstance().SplitScreen)
     {
         _playerInputManager.EnableJoining();
         _playerInputManager.JoinPlayer();
         _playerInputManager.JoinPlayer();
         _playerInputManager.DisableJoining();
     }
     else
     {
         _playerInputManager.EnableJoining();
         _playerInputManager.JoinPlayer();
         _playerInputManager.DisableJoining();
     }
 }
Exemplo n.º 4
0
 public void MainMenu()
 {
     mainMenu     = true;
     invulnerable = true;
     pim.EnableJoining();
     LoadLevel(0);
     music.MenuMusic();
 }
Exemplo n.º 5
0
 public void AllowPlayerToJoin(bool isAllowed)
 {
     if (isAllowed && !playerInputManager.joiningEnabled)
     {
         playerInputManager.EnableJoining();
     }
     else if (!isAllowed && playerInputManager.joiningEnabled)
     {
         playerInputManager.DisableJoining();
     }
 }
Exemplo n.º 6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         if (pim.joiningEnabled)
         {
             pim.DisableJoining();
         }
         else
         {
             pim.EnableJoining();
         }
     }
 }
Exemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        // 長押し対策
        if (CanReleasedEnter())
        {
            enterRelease = true;
        }
        else if (CanReleasedBack())
        {
            backRelease = true;
        }

        playerInputManager.EnableJoining();

        UpdateUI();

        // 接続するとPlayerInputが使えなくなるので手動で
        var players = FindObjectsOfType <Player> ();

        if (CanPressedEnter() && players.Length > 0)
        {
            GameSetting.Instance.Players = new List <GameObject> ();
            foreach (var p in players)
            {
                GameSetting.Instance.Players.Add(p.gameObject);
                DontDestroyOnLoad(p.gameObject);
            }

            enterRelease = false;
            backRelease  = false;

            SoundManager.Instance.PlaySE(SoundManager.SE.Next);
            TitleManager.Instance.ChangeScreen(TitleManager.Screens.SelectStage);
        }
        else if (CanPressedBack())
        {
            foreach (var p in players)
            {
                Destroy(p.gameObject);
            }
            GameSetting.Instance.Players = new List <GameObject> ();

            enterRelease = false;
            backRelease  = false;

            SoundManager.Instance.PlaySE(SoundManager.SE.Back);
            TitleManager.Instance.ChangeScreen(TitleManager.Screens.Menu);
        }
    }
Exemplo n.º 8
0
 public void SpawnMap(int index)
 {
     mapInGameList[index].SetActive(true);
     playerInputManager.EnableJoining();
 }
    // Update is called once per frame
    void Update()
    {
        if (!changed && Instance.playerCount >= 1)      // Active timer if at least 1 player has joined // currently disabled for better way
        {
            //timer += Time.deltaTime;
            //TitleScreen.text = "GAME STARTS IN: " + (timeLimit - ((int)timer));
        }

        if (Instance.playerCount >= 1 && !changed && startGame) // load game scene
        {
            SceneManager.LoadScene(1);
            changed = true;
            GetComponent <RankingSystem>().StartRanking();
            Instance.DisableJoining();  // no more players can join
        }

        // This is if the game was in the game scene and has re-entered the main menu. This will reset all variables so that the previous code
        // will work like the first time. It will also re-find all the game objects in the scene that this script needs to run
        if (Instance.playerCount == 0 && changed && SceneManager.GetActiveScene().buildIndex == 0)
        {
            changed = false;
            //timer = 0f;
            Instance.EnableJoining();
            PlayerWin   = false;
            startGame   = false;
            gotRankings = false;

            for (int i = 0; i < planes.Length; i++)
            {
                planes[i] = GameObject.Find("P" + (i + 1));               // This is UI stuff, find all the panels so when goat selected, a white square will form
            }
            TitleScreen = GameObject.Find("Timer").GetComponent <Text>(); // find reference to text obj that is the countdown timer
        }

        if (!gotRankings && SceneManager.GetActiveScene().buildIndex == 1)
        {
            goatNameGraphics[0]  = GameObject.Find("RedGoatRanking");
            goatNameGraphics[1]  = GameObject.Find("RedGoatDeadRanking");
            goatNameGraphics[2]  = GameObject.Find("BlueGoatRanking");
            goatNameGraphics[3]  = GameObject.Find("BlueGoatDeadRanking");
            goatNameGraphics[4]  = GameObject.Find("YellowGoatRanking");
            goatNameGraphics[5]  = GameObject.Find("YellowGoatDeadRanking");
            goatNameGraphics[6]  = GameObject.Find("GreenGoatRanking");
            goatNameGraphics[7]  = GameObject.Find("GreenGoatDeadRanking");
            goatNameGraphics[8]  = GameObject.Find("PurpleGoatRanking");
            goatNameGraphics[9]  = GameObject.Find("PurpleGoatDeadRanking");
            goatNameGraphics[10] = GameObject.Find("OrangeGoatRanking");
            goatNameGraphics[11] = GameObject.Find("OrangeGoatDeadRanking");
            goatNameGraphics[12] = GameObject.Find("PinkGoatRanking");
            goatNameGraphics[13] = GameObject.Find("PinkGoatDeadRanking");
            goatNameGraphics[14] = GameObject.Find("AquaGoatRanking");
            goatNameGraphics[15] = GameObject.Find("AquaGoatDeadRanking");

            bool isAnyNull = false;
            for (int i = 0; i < goatNameGraphics.Length; i++)
            {
                if (goatNameGraphics[i] == null)
                {
                    isAnyNull = true;
                }
                if (i + 1 > Instance.playerCount * 2)
                {
                    goatNameGraphics[i].GetComponent <RawImage>().enabled = false;
                }
            }

            if (!isAnyNull)
            {
                gotRankings = true;
            }
        }
    }
Exemplo n.º 10
0
 public void EnableJoining()
 {
     playerInputManager.EnableJoining();
 }
Exemplo n.º 11
0
 //Go to the character selection screen
 public void toCharacterSelect()
 {
     joiningPlayers = true;
     manager.EnableJoining();
     inputModule.DisableAllActions();
 }
Exemplo n.º 12
0
 public void JoinEnable()
 {
     inputManager.EnableJoining();
 }
Exemplo n.º 13
0
 private void Start()
 {
     inputManager.EnableJoining();
     SceneManager.activeSceneChanged += OnSceneChange;
     //StartCoroutine("TestSpawnBot");
 }