상속: IEntity
예제 #1
0
 public MapNpc(Npc npc, Vector position)
 {
     this.Name = npc.Name;
     this.Level = npc.Level;
     this.TextureNumber = npc.TextureNumber;
     this.Position = position;
 }
예제 #2
0
        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;
        }
예제 #3
0
        public void SpawnMapNpc(Npc npc, Vector position)
        {
            this.mapNpcs.Add(new MapNpc(npc, position));

            // TODO: send the spawn packet.
        }