public MapNpc(Npc npc, Vector position) { this.Name = npc.Name; this.Level = npc.Level; this.TextureNumber = npc.TextureNumber; this.Position = position; }
public Npc LoadNpc(string filePath) { var npc = new Npc() { Position = new Vector() }; using (var fileStream = new FileStream(filePath, FileMode.Open)) { using (var binaryReader = new BinaryReader(fileStream)) { npc.Name = binaryReader.ReadString(); npc.TextureNumber = binaryReader.ReadInt32(); npc.Position.X = binaryReader.ReadInt32(); npc.Position.Y = binaryReader.ReadInt32(); var statCount = binaryReader.ReadInt32(); for (int i = 0; i < statCount; i++) npc.SetStat((Stats)i, binaryReader.ReadInt32()); } } return npc; }
public void SpawnMapNpc(Npc npc, Vector position) { this.mapNpcs.Add(new MapNpc(npc, position)); // TODO: send the spawn packet. }