public void ObjectPlayer(S.ObjectPlayer p) { MapObject ob; PlayerObject player; if (ObjectList.TryGetValue(p.ObjectID, out ob)) { player = (PlayerObject)ob; player.CurrentLocation = new Vector2(p.Location.X, p.Location.Y); player.Direction = p.Direction; player.transform.position = CurrentScene.Cells[p.Location.X, p.Location.Y].position; player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction); player.Armour = p.Armour; player.Weapon = p.Weapon; player.gameObject.SetActive(true); CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(player); return; } player = Instantiate(PlayerModel, CurrentScene.Cells[p.Location.X, p.Location.Y].position, Quaternion.identity).GetComponent <PlayerObject>(); player.gameManager = this; player.Name = p.Name; player.ObjectID = p.ObjectID; player.CurrentLocation = new Vector2(p.Location.X, p.Location.Y); player.Direction = p.Direction; player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction); player.Armour = p.Armour; player.Weapon = p.Weapon; ObjectList.Add(p.ObjectID, player); CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(player); }
public void ObjectPlayer(S.ObjectPlayer p) { PlayerObject player; if (Players.TryGetValue(p.ObjectID, out player)) { player.CurrentLocation = new Vector2(p.Location.X, p.Location.Y); player.Direction = p.Direction; player.transform.position = CurrentScene.Cells[p.Location.X, p.Location.Y].position; player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction); player.gameObject.SetActive(true); return; } player = Instantiate(WarriorModels[0], CurrentScene.Cells[p.Location.X, p.Location.Y].position, Quaternion.identity).GetComponent <PlayerObject>(); player.CurrentLocation = new Vector2(p.Location.X, p.Location.Y); player.Direction = p.Direction; player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction); Players.Add(p.ObjectID, player); }
public static void ObjectPlayer(S.ObjectPlayer p) { gameManager.ObjectPlayer(p); }