public AbstractEntity CreateDoorMapSquare(int x, int y, RLColor colour)
        {
            AbstractEntity e = new AbstractEntity("Door");

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, false, true));
            e.AddComponent(new GraphicComponent('D', RLColor.Black, colour, 'D', 0));
            e.AddComponent(new MapsquareData(true, false));
            this.ecs.entities.Add(e);
            return(e);
        }
        public AbstractEntity CreateFloorMapSquare(int x, int y)
        {
            AbstractEntity e = new AbstractEntity("Floor");

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, false, true));
            e.AddComponent(new GraphicComponent('.', RLColor.White, RLColor.Black, ' ', 0));
            e.AddComponent(new MapsquareData(false, false));
            this.ecs.entities.Add(e);
            return(e);
        }
        public AbstractEntity CreateMedikitItem(int x, int y)
        {
            AbstractEntity e = new AbstractEntity("Medikit");

            e.AddComponent(new GraphicComponent('m', RLColor.Yellow, RLColor.Black, ' ', 5));
            e.AddComponent(new CarryableComponent(.3f));
            //e.AddComponent(new UseableComponent());
            this.ecs.entities.Add(e);
            return(e);
        }
        public AbstractEntity CreateGrenadeItem()
        {
            AbstractEntity grenade = new AbstractEntity("Grenade");

            grenade.AddComponent(new GraphicComponent('o', RLColor.Yellow, RLColor.Black, ' ', 5));
            grenade.AddComponent(new CarryableComponent(1f));
            grenade.AddComponent(new TimerCanBeSetComponent());
            grenade.AddComponent(new ExplodesWhenTimerExpiresComponent(5, 10));
            this.ecs.entities.Add(grenade);
            return(grenade);
        }
        public AbstractEntity CreateKnifeItem(int x, int y)
        {
            AbstractEntity e = new AbstractEntity("Knife");

            e.AddComponent(new GraphicComponent('k', RLColor.Yellow, RLColor.Black, ' ', 5));
            e.AddComponent(new CarryableComponent(.2f));
            //e.AddComponent(new UseableComponent());
            e.AddComponent(new ItemIsWeaponComponent(5));
            this.ecs.entities.Add(e);
            return(e);
        }
示例#6
0
        public AbstractEntity CreateLaunchEscapePodConsole(int x, int y)
        {
            AbstractEntity e = new AbstractEntity("EscapePodConsole");

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, true, true));
            e.AddComponent(new GraphicComponent('E', RLColor.White, RLColor.Red, 'D', 0));
            //e.AddComponent(new MapsquareData(true, false));
            e.AddComponent(new LaunchEscapePodComponent());

            this.ecs.entities.Add(e);
            return(e);
        }
        public AbstractEntity CreateGunItem()
        {
            AbstractEntity gun = new AbstractEntity("Gun");

            gun.AddComponent(new GraphicComponent('L', RLColor.Yellow, RLColor.Black, ' ', 5));
            gun.AddComponent(new CarryableComponent(1f));
            gun.AddComponent(new ItemCanShootComponent(99f, 10f));
            //gun.AddComponent(new UseableComponent());

            this.ecs.entities.Add(gun);
            return(gun);
        }
        public AbstractEntity AddEntityToUnit(AbstractEntity e, AbstractEntity unit)
        {
            CanCarryComponent c = (CanCarryComponent)unit.GetComponent(nameof(CanCarryComponent));

            e.AddComponent(new PositionComponent(e, this.map_data, 0, 0, false, false));
            c.AddItem(e);
            return(e);
        }
 private bool CheckForImpregnation(AlienComponent alienData, PositionComponent alienPos, AbstractEntity target, PositionComponent targetPos)
 {
     if (alienData.impregnateNextEnemy)
     {
         double dist = GeometryFunctions.Distance(alienPos.x, alienPos.y, targetPos.x, targetPos.y);
         if (dist < 2)
         {
             target.AddComponent(new ImpregnatedComponent());
             return(true);
         }
     }
     return(false);
 }
示例#10
0
        public AbstractEntity createEnemyUnit(string name, int x, int y, int aps)
        {
            AbstractEntity e = new AbstractEntity(name);

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, true, true));
            e.AddComponent(new MovementDataComponent());
            e.AddComponent(new GraphicComponent('E', RLColor.Red, RLColor.Black, ' ', 10));
            e.AddComponent(new CanCarryComponent(99));
            e.AddComponent(new ShootOnSightComponent());
            e.AddComponent(new MobDataComponent(1, aps));
            e.AddComponent(new AttackAttackableComponent(6, 5));
            this.ecs.entities.Add(e);
            return(e);
        }
示例#11
0
        public AbstractEntity CreateJones(int x, int y)
        {
            AbstractEntity e = new AbstractEntity("Jones");

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, false, true));
            e.AddComponent(new MovementDataComponent());
            e.AddComponent(new GraphicComponent('J', RLColor.Brown, RLColor.Black, ' ', 10));
            e.AddComponent(new JonesTheCatComponent());
            e.AddComponent(new CarryableComponent(2));
            e.AddComponent(new MobDataComponent(-1, 150));  // side -1 so the alien doesnt attack
            this.ecs.entities.Add(e);
            return(e);
        }
示例#12
0
        public static AbstractEntity CreateAlien(BasicEcs ecs, MapData map_data, int x, int y)
        {
            AbstractEntity e = new AbstractEntity("Alien");

            e.AddComponent(new PositionComponent(e, map_data, x, y, true, true));
            e.AddComponent(new MovementDataComponent());
            e.AddComponent(new GraphicComponent('A', RLColor.Green, RLColor.Black, ' ', 10));
            e.AddComponent(new AlienComponent());
            e.AddComponent(new MobDataComponent(1, 150));
            e.AddComponent(new AttackAttackableComponent(30, 30));
            ecs.entities.Add(e);
            return(e);
        }
        public AbstractEntity CreatePlayersUnit(char ch, String name, int num, int x, int y, int aps)
        {
            AbstractEntity e = new AbstractEntity(name);

            e.AddComponent(new PositionComponent(e, this.map_data, x, y, true, true));
            e.AddComponent(new MovementDataComponent());
            e.AddComponent(new GraphicComponent(ch, RLColor.LightBlue, RLColor.Black, ' ', 10));
            e.AddComponent(new CanCarryComponent(10));
            e.AddComponent(new PlayersUnitData(num));
            e.AddComponent(new MobDataComponent(0, aps));
            e.AddComponent(new AttackAttackableComponent(10, 5));

            this.ecs.entities.Add(e);

            this.game.playersUnits.Add(e);

            return(e);
        }
 public AbstractEntity AddEntityToMap(AbstractEntity e, int x, int y)
 {
     e.AddComponent(new PositionComponent(e, this.map_data, x, y, false, true));
     return(e);
 }