//spawn the objects owned by the master client.
        public void Start()
        {
            int nomHumans = PlayerPrefs.GetInt("nomHumans");
            int nomAI     = PlayerPrefs.GetInt("nomAI");

            //if its the menu -- scene load use 2 ais.
            if (Application.loadedLevel == 0)
            {
                nomHumans = 0;
                nomAI     = 2;
            }
            //how many humans do we want.
            for (int i = 0; i < nomHumans; i++)
            {
                spawnPlayer(i + 1);
            }

            //the ai will be owned by the master client
            for (int i = 0; i < nomAI; i++)
            {
                spawnAI(i);
            }


            BaseGameManager.startGame();
        }
        //our ball has landed in the water, lets call the ball bowling pit
        void OnTriggerEnter(Collider col)
        {
            PoolBall pb = col.GetComponent <PoolBall>();

            if (col.name.Contains("Ball"))
            {
                BaseGameManager.ballEnterPocket(triggerID, pb);
                pb.enterPocket();
            }
        }
Exemple #3
0
 void toggleAudio()
 {
     if (PlayerPrefs.GetFloat("AudioVolume", 0) == 0)
     {
         PlayerPrefs.SetFloat("AudioVolume", 1f);
     }
     else
     {
         PlayerPrefs.SetFloat("AudioVolume", 0f);
     }
     BaseGameManager.toggleAudio();
 }
Exemple #4
0
        private void OnBtnStartGameClick()
        {
            int enemy     = PlayerPrefs.GetInt("Enemy", 0);
            int nomHumans = 1;
            int nomAI     = 0;

            if (enemy == 1)
            {
                nomAI = 1;
            }

            if (enemy == 2)
            {
                nomHumans = 2;
            }
            string sceneName = PlayerPrefs.GetString("GameScene", "8Ball");

            BaseGameManager.connect(true, sceneName, nomHumans, nomAI);
        }