private static void LoadPlayer(String player, PlayableMainGameScreen PGS) { char[] delims = {'<','>'}; String[] tokens = player.Substring(8).Split(delims); String texture = tokens[1]; PlayerEntity pEntity; Vector2 playerPos = PGS.PlayerPos; pEntity = new PlayerEntity(texture, playerPos); PGS.AddEntity(pEntity); }
public void AddEntity(DrawableEntity entity) { entity.OwnerScreen = this; entity.LoadContent(); entities.Add(entity); if (entity is PlayerEntity) player = (PlayerEntity)entity; }
private static void LoadPlayer(String player, PlayableMainGameScreen PGS) { char[] delims = {'<','>'}; String[] tokens = player.Substring(8).Split(delims); String texture = tokens[1]; float posX = float.Parse(tokens[3]); float posY = float.Parse(tokens[5]); PlayerEntity pEntity; Vector2 playerPos; if (PGS.PlayerPos.Equals(new Vector2(-1, -1))) { playerPos = new Vector2(posX, posY); } else { playerPos = PGS.PlayerPos; } pEntity = new PlayerEntity(texture, playerPos); PGS.AddEntity(pEntity); }