Exemplo n.º 1
0
 public MonsterEntity(MapNpcMonsterDto dto) : base(EntityType.Monster)
 {
     Components = new Dictionary <Type, IComponent>
     {
         {
             typeof(VisibilityComponent), new VisibilityComponent(this)
             {
                 IsVisible = true
             }
         },
         { typeof(BattleComponent), new BattleComponent(this)
           {
               Hp    = dto.Data.MaxHp,
               HpMax = dto.Data.MaxHp,
               Mp    = dto.Data.MaxMp,
               MpMax = dto.Data.MaxMp
           } },
         {
             typeof(MovableComponent), new MovableComponent(this)
             {
                 Actual = new Position <short> {
                     X = dto.Position.X, Y = dto.Position.Y
                 },
                 Destination = new Position <short> {
                     X = dto.Position.X, Y = dto.Position.Y
                 }
             }
         },
         { typeof(NpcMonsterComponent), new NpcMonsterComponent(this, dto) }
     };
 }
 public NpcMonsterComponent(IEntity entity, MapNpcMonsterDto dto)
 {
     Entity          = entity;
     Vnum            = dto.Data.Id;
     MapNpcMonsterId = dto.Id;
     MapId           = dto.MapId;
     IsAggressive    = !dto.Data.NoAggresiveIcon;
 }
Exemplo n.º 3
0
 public NpcEntity(MapNpcMonsterDto npc) : base(EntityType.Npc)
 {
     Components = new Dictionary <Type, IComponent>
     {
         { typeof(BattleComponent), new BattleComponent(this) },
         { typeof(VisibilityComponent), new VisibilityComponent(this) },
         { typeof(MovableComponent), new MovableComponent(this) },
         { typeof(NpcMonsterComponent), new NpcMonsterComponent(this, npc) }
     };
 }