Пример #1
0
        public override void Place(Level level, Coordinates tile, Direction facing)
        {
            var entity = _blueprint.Construct();

            entity.Facing = facing;
            level.AddEntityAt(entity, tile.X, tile.Y);
        }
Пример #2
0
        public Entity AddEntityAt(EntityBlueprint b, int tx, int ty, float offX = 0f, float offY = 0f)
        {
            var entity = b.Construct();

            AddEntityAt(entity, tx, ty, offX, offY);
            return(entity);
        }
Пример #3
0
        public override void Apply(Generator gen, LevelGenerator levelGen, Level level)
        {
            for (var x = 0; x < gen.Size; x += Spacing)
            {
                for (var y = 0; y < gen.Size; y += Spacing)
                {
                    if (gen.Random.Next(0, Chance) == 0 && CanBePlantOn.Contains(level.GetTile(x, y)) && PlacingFunction(x, y, gen, levelGen, level) < Threashold && level.GetEntitiesAt(x, y).Count == 0)
                    {
                        level.AddEntityAt(_blueprint.Construct(), x, y, gen.Random.Next(-RandomOffset, RandomOffset), gen.Random.Next(-RandomOffset, RandomOffset));
                    }
                }

                _progress = (x / (float)gen.Size);
            }
        }
Пример #4
0
 public Entity AddEntityAt(EntityBlueprint blueprint, int tx, int ty, float offX = 0f, float offY = 0f)
 {
     return(AddEntityAt(blueprint.Construct(), tx, ty, offX, offY));
 }
Пример #5
0
 public Entity AddEntityAt(EntityBlueprint blueprint, Coordinates coordinates, Vector2 offset)
 {
     return(AddEntityAt(blueprint.Construct(), coordinates.X, coordinates.Y, offset.X, offset.Y));
 }
Пример #6
0
        /* --- Entities ----------------------------------------------------- */

        public Entity AddEntityAt(EntityBlueprint blueprint, Coordinates coordinates)
        {
            return(AddEntityAt(blueprint.Construct(), coordinates.X, coordinates.Y));
        }