public ExplosionSystem(BasicEcs ecs, CheckMapVisibilitySystem _checkVis, DamageSystem _damageSystem, MapData _mapData, List <AbstractEntity> _entities) : base(ecs, false) { this.mapData = _mapData; this.checkVis = _checkVis; this.damageSystem = _damageSystem; this.entities = _entities; }
private bool Move(AbstractEntity entity, MovementDataComponent md, PositionComponent p, Point dest) { if (this.IsAccessible(dest.X, dest.Y)) { MobDataComponent mdc = (MobDataComponent)entity.GetComponent(nameof(MobDataComponent)); if (mdc == null || mdc.actionPoints > 0) { /*if (entity.name == "Alien") { * Console.WriteLine($"Moving alien.... {mdc.actionPoints} APs left"); * }*/ int cost = 50; if (p.x != dest.X && p.y != dest.Y) // Diagonal { cost = 70; } mdc.actionPoints -= cost; this.map_data.map[p.x, p.y].Remove(entity); p.x = dest.X; p.y = dest.Y; this.map_data.map[p.x, p.y].Add(entity); /*if (entity.name == "Alien") { * Console.WriteLine($"Moved alien. {mdc.actionPoints} APs left"); * }*/ CheckMapVisibilitySystem cmvs = (CheckMapVisibilitySystem)this.ecs.GetSystem(nameof(CheckMapVisibilitySystem)); cmvs.ReCheckVisibility = true; return(true); } } else { CloseCombatSystem ccs = (CloseCombatSystem)this.ecs.GetSystem(nameof(CloseCombatSystem)); if (ccs.Combat(entity, this.map_data.map[dest.X, dest.Y]) == false) { // Movement failed } } return(false); }
public AbstractEntity GetTargetAt(List <AbstractEntity> entities, int ourX, int ourY, int ourSide) { CheckMapVisibilitySystem cmvs = (CheckMapVisibilitySystem)this.ecs.GetSystem(nameof(CheckMapVisibilitySystem)); foreach (var e in entities) { MobDataComponent att = (MobDataComponent)e.GetComponent(nameof(MobDataComponent)); if (att != null && att.side != ourSide) { PositionComponent pos = (PositionComponent)e.GetComponent(nameof(PositionComponent)); if (pos != null) { if (cmvs.CanSee(ourX, ourY, pos.x, pos.y)) { return(e); } } } } return(null); }
public ShootOnSightSystem(BasicEcs ecs, CheckMapVisibilitySystem _cmvs, List <AbstractEntity> _entities) : base(ecs, true) { this.cmvs = _cmvs; this.entities = _entities; }