public void net_onClientSelfSpawn(NetworkMessage netmsg) { S2GC_PlayerSpawn Message = netmsg.ReadMessage <S2GC_PlayerSpawn>(); e.getWorld().world_SpawnPlayerSelf(Message); State = NETWORK_STATE.STATE_CONNECTED; }
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); */ }
public void world_SpawnPlayerSelf(S2GC_PlayerSpawn s) { Player_Self = GameObject.Instantiate(playerSelfPrefab).GetComponent <PlayerData_Self>(); Player_Self.AccountName = Self_Acc; Player_Self.PlayerID = Self_ID; Player_Self.CharacterName = s.SpawnData.CharacterName; Player_Self.gameObject.name = s.SpawnData.CharacterName; Player_Self.gameObject.transform.position = s.SpawnData.Position.V3; Player_Self.gameObject.transform.rotation = Quaternion.Euler(s.SpawnData.Rotation.V3); Player_Self.Level = s.SpawnData.Level; Player_Self.EXP = s.SpawnData.Experience; Player_Self.statPoints = s.SpawnData.StatPoints; Player_Self.Agility = s.SpawnData.Agility; Player_Self.Intellect = s.SpawnData.Intellect; Player_Self.Stamina = s.SpawnData.Stamina; Player_Self.Strength = s.SpawnData.Strength; Player_Self.Health = s.SpawnData.HP; Player_Self.maxHealth = s.SpawnData.MaxHP; Player_Self.Energy = s.SpawnData.Energy; Player_Self.maxEnergy = s.SpawnData.MaxEnergy; if (s.SpawnData.hasActiveQuests) { Player_Self.ActiveQuests = s.SpawnData.ActiveQuests; } else { Player_Self.ActiveQuests = new List <QuestData>(); } if (s.SpawnData.hasFinishedQuests) { Player_Self.FinishedQuests = s.SpawnData.FinishedQuests; } else { Player_Self.FinishedQuests = new List <string>(); } Player_Self.CharacterGender = s.SpawnData.CharacterGender; Player_Self.CharacterEyeShape = s.SpawnData.CharacterEyeShape; Player_Self.CharacterEyeType = s.SpawnData.CharacterEyeType; Player_Self.CharacterEyeColor = s.SpawnData.CharacterEyeColor.V4; Player_Self.CharacterFrontHair = s.SpawnData.CharacterFrontHair; Player_Self.CharacterBackHair = s.SpawnData.CharacterBackHair; Player_Self.CharacterHairColor = s.SpawnData.CharacterHairColor.V4; Player_Self.Init(e); e.updateGameState(GAME_STATE.STATE_WORLD); e.getUI().ui_ShowLoading(false); e.getUI().ui_world_ShowUI(); }
// World Stuff public void net_onOtherClientSpawn(NetworkMessage netmsg) { S2GC_PlayerSpawn Message = netmsg.ReadMessage <S2GC_PlayerSpawn>(); e.getWorld().world_SpawnSinglePlayer(Message); }