Example #1
0
        private void CreatePlayers()
        {
            if (players == null)
            {
                players = new PlayerNetworking[2];
            }

            players[0] = Instantiate(playerPrefab) as PlayerNetworking;
            players[0].SetIndex(0);
            players[1] = Instantiate(playerPrefab) as PlayerNetworking;
            players[1].SetIndex(1);

            players[1].gameObject.SetActive(false);
        }
Example #2
0
        public void SetHostPlayerOnline(GameObject otherPlayer)
        {
            if (players == null)
            {
                players = new PlayerNetworking[2];
            }

            players[0] = otherPlayer.GetComponent <PlayerNetworking>();
            players[0].SetIndex(0);

            if (players[0] == null)
            {
                Debug.Log("is null");
            }
            else
            {
                Debug.Log("isnt null");
            }
        }