public override void Place(Level level, Coordinates tile, Direction facing) { var entity = _blueprint.Construct(); entity.Facing = facing; level.AddEntityAt(entity, tile.X, tile.Y); }
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); }
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); } }
public Entity AddEntityAt(EntityBlueprint blueprint, int tx, int ty, float offX = 0f, float offY = 0f) { return(AddEntityAt(blueprint.Construct(), tx, ty, offX, offY)); }
public Entity AddEntityAt(EntityBlueprint blueprint, Coordinates coordinates, Vector2 offset) { return(AddEntityAt(blueprint.Construct(), coordinates.X, coordinates.Y, offset.X, offset.Y)); }
/* --- Entities ----------------------------------------------------- */ public Entity AddEntityAt(EntityBlueprint blueprint, Coordinates coordinates) { return(AddEntityAt(blueprint.Construct(), coordinates.X, coordinates.Y)); }