public void world_SpawnPlayerList(S2GC_PlayerList spawnList) { foreach (S2GC_PlayerList.PlayerSpawnData p in spawnList.Data) { if (p.PlayerID != Player_Self.PlayerID) { PlayerData_Other newPlayer = GameObject.Instantiate(playerOtherPrefab).GetComponent <PlayerData_Other>(); newPlayer.PlayerID = p.PlayerID; newPlayer.CharacterName = p.CharacterName; newPlayer.gameObject.name = p.CharacterName; newPlayer.gameObject.transform.position = p.Position.V3; newPlayer.gameObject.transform.rotation = Quaternion.Euler(p.Rotation.V3); newPlayer.Level = p.Level; newPlayer.Health = p.HP; newPlayer.maxHealth = p.MaxHP; newPlayer.Energy = p.Energy; newPlayer.maxEnergy = p.MaxEnergy; newPlayer.CharacterGender = p.CharacterGender; newPlayer.CharacterEyeShape = p.CharacterEyeShape; newPlayer.CharacterEyeType = p.CharacterEyeType; newPlayer.CharacterEyeColor = p.CharacterEyeColor.V4; newPlayer.CharacterFrontHair = p.CharacterFrontHair; newPlayer.CharacterBackHair = p.CharacterBackHair; newPlayer.CharacterHairColor = p.CharacterHairColor.V4; newPlayer.Init(e); e.getUI().ui_world_CreatePlayerNameplate(newPlayer); e.getUI().ui_chat_CreateMessage(ChatMSGType.System, "", p.CharacterName + " has joined."); PlayerList.Add(newPlayer); } } }
public void world_SpawnSinglePlayer(S2GC_PlayerSpawn s) { if (s.SpawnData.PlayerID != Player_Self.PlayerID) { PlayerData_Other newPlayer = GameObject.Instantiate(playerOtherPrefab).GetComponent <PlayerData_Other>(); newPlayer.PlayerID = s.SpawnData.PlayerID; newPlayer.CharacterName = s.SpawnData.CharacterName; newPlayer.gameObject.name = s.SpawnData.CharacterName; newPlayer.gameObject.transform.position = s.SpawnData.Position.V3; newPlayer.gameObject.transform.rotation = Quaternion.Euler(s.SpawnData.Rotation.V3); newPlayer.Level = s.SpawnData.Level; newPlayer.Health = s.SpawnData.HP; newPlayer.maxHealth = s.SpawnData.MaxHP; newPlayer.Energy = s.SpawnData.Energy; newPlayer.maxEnergy = s.SpawnData.MaxEnergy; newPlayer.CharacterGender = s.SpawnData.CharacterGender; newPlayer.CharacterEyeShape = s.SpawnData.CharacterEyeShape; newPlayer.CharacterEyeType = s.SpawnData.CharacterEyeType; newPlayer.CharacterEyeColor = s.SpawnData.CharacterEyeColor.V4; newPlayer.CharacterFrontHair = s.SpawnData.CharacterFrontHair; newPlayer.CharacterBackHair = s.SpawnData.CharacterBackHair; newPlayer.CharacterHairColor = s.SpawnData.CharacterHairColor.V4; newPlayer.Init(e); e.getUI().ui_world_CreatePlayerNameplate(newPlayer); e.getUI().ui_chat_CreateMessage(ChatMSGType.System, "", s.SpawnData.CharacterName + " has joined."); PlayerList.Add(newPlayer); } /* * if (spawnInfo.ID == Player_Self.ID) * return; * foreach (PlayerData plr in PlayerList) * { * if (plr.ID == spawnInfo.ID) * return; * } * PlayerData newPlayer = new PlayerData * { * GObject = (GameObject)GameObject.Instantiate(playerOtherPrefab, spawnInfo.position, spawnInfo.rotation) * }; * newPlayer.GObject.name = spawnInfo.name; * newPlayer.Name = spawnInfo.name; * newPlayer.ID = spawnInfo.ID; * newPlayer.GObject.GetComponent<CapsuleCollider>().enabled = true; * //newPlayer.Object.GetComponent<MeshRenderer>().enabled = true; * newPlayer.OPController = newPlayer.GObject.GetComponent<Client_OtherPlayerController>(); * newPlayer.OPController.init(e); * e.getUI().ui_world_CreatePlayerNameplate(newPlayer); * * e.getUI().ui_chat_CreateMessage(ChatMSGType.System, "", spawnInfo.name + " has joined."); * * PlayerList.Add(newPlayer); */ }