Пример #1
0
        public override void ProcessEntity(AbstractEntity entity)
        {
            // Todo
            ImpregnatedComponent ic = (ImpregnatedComponent)entity.GetComponent(nameof(ImpregnatedComponent));

            if (ic != null)
            {
                ic.turnsUntilBurst--;
                if (ic.turnsUntilBurst <= 0)
                {
                    PositionComponent pos = (PositionComponent)entity.GetComponent(nameof(PositionComponent));
                    AlienEntityFactory.CreateAlien(this.ecs, this.mapData, pos.x, pos.y);
                    entity.markForRemoval = true;
                }
            }
        }
 private AbstractEntity GetTarget(int ourX, int ourY, int ourSide)
 {
     foreach (var e in this.entities)
     {
         ImpregnatedComponent ic = (ImpregnatedComponent)e.GetComponent(nameof(ImpregnatedComponent));
         if (ic == null)   // Don't go after anyone who's impregnated
         {
             MobDataComponent att = (MobDataComponent)e.GetComponent(nameof(MobDataComponent));
             if (att != null && att.side != ourSide && att.side >= 0)
             {
                 PositionComponent pos = (PositionComponent)e.GetComponent(nameof(PositionComponent));
                 if (pos != null)
                 {
                     if (this.cmvs.CanSee(ourX, ourY, pos.x, pos.y))
                     {
                         return(e);
                     }
                 }
             }
         }
     }
     return(null);
 }