public Section CreateSafeLevelBlock() { var safeBackground = GetBackgroundEntity(BgKeys.bg_a00); var levelBlock = new Section(); levelBlock.AddBackgroundEntity(safeBackground.Entity); return(levelBlock); }
/// <summary> /// Factory method to create Section from a given BackgroundEntity /// </summary> /// <param name="backgroundEnt"></param> /// <returns></returns> private Section CreateLevelBlock(BackgroundEntity backgroundEnt) { var levelBlock = new Section(); levelBlock.AddBackgroundEntity(backgroundEnt.Entity).AddHoleRange(backgroundEnt.Holes); var len = levelBlock.Length; RandomAddObstacles(levelBlock, len, backgroundEnt.MaxNbObstacles); return(levelBlock); }
/// <summary> /// Factory method to create Section from a given BackgroundEntity /// </summary> /// <param name="backgroundEnt"></param> /// <param name="maxObstacleOverride">The maximum number of obstacle in the block level</param> /// <returns></returns> private Section CreateLevelBlock(Entity backgroundEnt, int? maxObstacleOverride = null) { // Reset position backgroundEnt.Transform.Position = Vector3.Zero; var levelBlock = new Section(); var backgroundInfo = backgroundEnt.Get<BackgroundInfo>(); levelBlock.AddBackgroundEntity(backgroundEnt).AddHoleRange(backgroundInfo.Holes); var len = levelBlock.Length; RandomAddObstacles(levelBlock, len, maxObstacleOverride ?? backgroundInfo.MaxNbObstacles); return levelBlock; }
/// <summary> /// Factory method to create Section from a given BackgroundEntity /// </summary> /// <param name="backgroundEnt"></param> /// <param name="maxObstacleOverride">The maximum number of obstacle in the block level</param> /// <returns></returns> private Section CreateLevelBlock(Entity backgroundEnt, int?maxObstacleOverride = null) { // Reset position backgroundEnt.Transform.Position = Vector3.Zero; var levelBlock = new Section(); var backgroundInfo = backgroundEnt.Get(ScriptComponent.Key).Scripts.OfType <BackgroundInfo>().First(); levelBlock.AddBackgroundEntity(backgroundEnt).AddHoleRange(backgroundInfo.Holes); var len = levelBlock.Length; RandomAddObstacles(levelBlock, len, maxObstacleOverride ?? backgroundInfo.MaxNbObstacles); return(levelBlock); }
/// <summary> /// Factory method to create Section from a given BackgroundEntity /// </summary> /// <param name="backgroundEnt"></param> /// <returns></returns> private Section CreateLevelBlock(BackgroundEntity backgroundEnt) { var levelBlock = new Section(); levelBlock.AddBackgroundEntity(backgroundEnt.Entity).AddHoleRange(backgroundEnt.Holes); var len = levelBlock.Length; RandomAddObstacles(levelBlock, len, backgroundEnt.MaxNbObstacles); return levelBlock; }
public Section CreateSafeLevelBlock() { var safeBackground = GetBackgroundEntity(BgKeys.bg_a00); var levelBlock = new Section(); levelBlock.AddBackgroundEntity(safeBackground.Entity); return levelBlock; }