コード例 #1
0
 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;
 }
コード例 #2
0
        private void DoCombat(AbstractEntity e1, AbstractEntity e2)
        {
            AttackAttackableComponent aa1 = (AttackAttackableComponent)e1.GetComponent(nameof(AttackAttackableComponent));
            AttackAttackableComponent aa2 = (AttackAttackableComponent)e2.GetComponent(nameof(AttackAttackableComponent));

            // Todo - take into account weapons being carried
            int att1 = Misc.random.Next(aa1.combatSkill);
            int att2 = Misc.random.Next(aa2.combatSkill);

            DamageSystem damageSystem = (DamageSystem)this.ecs.GetSystem(nameof(DamageSystem));

            if (att1 > att2)
            {
                damageSystem.Damage(e2, aa1.combatDamage, $"Hit by {e1.name}");
            }
            else
            if (att1 < att2)
            {
                damageSystem.Damage(e1, aa2.combatDamage, $"Hit by {e2.name}");
            }
        }