Ejemplo n.º 1
0
        public override GameObject OnLobbyServerCreateGamePlayer(NetworkConnection conn, short playerControllerId)
        {
            int team = (int)currentPlayers[conn.connectionId];

            GameObject playerPrefab = (GameObject)GameObject.Instantiate(spawnPrefabs[team],
                                                                         startPositions[conn.connectionId].position,
                                                                         Quaternion.identity);

            Splatter s = playerPrefab.GetComponent <Splatter>();

            // set colors and channel mask (mask is implied by order)
            int            i            = 0;
            List <Vector4> DogColorList = new List <Vector4>();

            foreach (LobbyPlayer p in lobbyPlayers.Values)
            {
                if (p.playerTeam == Teams.Team.DOGS)
                {
                    DogColorList.Add(p.playerColor);
                    if (p.connectionId == conn.connectionId)
                    {
                        s.SetConnectionId(conn.connectionId);
                        if (i == 0)
                        {
                            s.SetChannel(SplatChannel.DOG0);
                        }
                        else if (i == 1)
                        {
                            s.SetChannel(SplatChannel.DOG1);
                        }
                        else if (i == 2)
                        {
                            s.SetChannel(SplatChannel.DOG2);
                        }
                    }
                    i++;
                }
            }
            s.SetColors(DogColorList);
            foreach (var d in DogColorList)
            {
                Debug.Log(d);
            }
            Debug.Log("Team " + 1 + " Prefab " + playerPrefab + " connId " + conn.connectionId);
            return(playerPrefab);
        }