public TextureSender(BasicLevel level, BaseObject owner, int frequency, Vector2 size, float velocity = 0.1f, IWorldObject parent = null, MyTexture2D texture = null) : base(level, owner.BasicPosition, size, parent, texture) { _owner = owner; Frequency = frequency; Velocity = velocity; }
public static Level GetLevel(List <IController> controllers, int index) { string levelName = levels[index]; object type = typeMap[index]; Level level = null; if (levelName != null && type != null) { LevelParser parser = new LevelParser(levels[index], controllers); parser.Parse(); if (type is BasicLevel) { level = new BasicLevel(); } level.SetCharacterList(parser.CharactersList); level.SetCollectableList(parser.CollectablesList); level.SetEnemyList(parser.EnemiesList); level.SetItemList(parser.ItemsList); level.SetTerrainList(parser.TerrainList); level.SetControllerList(controllers); level.SetItemSetList(parser.ItemSetList); level.SetBackground(parser.Background); level.SetMusic(parser.Music); if (parser.CamerasList.Count > 0) { level.SetCamera(parser.CamerasList[0]); } } return(level); }
public VelocityObject(BasicLevel level, Vector2 position, Vector2 size, float velocity, float direction, float rotationSpeed = 0, IWorldObject parent = null, MyTexture2D texture = null) : base(level, position, size, parent, texture) { _velocity = velocity; _rotationSpeed = rotationSpeed; BasicRotation = _direction = direction; }
public ExplosionBox(BasicLevel level, Vector2 position, float sideSize, float direction, float distance, IWorldObject parent = null) : base(level, position, new Vector2(sideSize), parent, TextureManager.Box2) { base.BasicRotation = _direction = direction; _distance = distance; _originPosition = position; SmoothOpacity.ValueToGo = 0; }
public PartTextureDisolve(BasicLevel level, Vector2 position, Vector2 size, Rectangle rectangle, Vector2 originMultiplier, float velocity = 1f, float direction = 0f, float rotationSpeed = 0.1f, IWorldObject parent = null, MyTexture2D texture = null) : base(level, position, size, parent, velocity, direction, rotationSpeed, texture) { CutRectangle = rectangle; OriginMultiplier = originMultiplier; SmoothOpacity.Friction = 0.0001f; }
public CollisionPixel(BasicLevel level, World world, Vector2 position, Vector2 size, IWorldObject parent = null) : base(level, world, position, size, parent, TextureManager.Box2) { _isAlive = true; Body.BodyType = BodyType.Static; Body.CollisionCategories = Category.Cat2; Body.CollidesWith = Category.Cat1 | Category.Cat3; Body.Friction = 0; }
public ExplosionBoxes(BasicLevel level, Vector2 position, float boxSideSize, int boxesCount, float distance, IWorldObject parent = null) : base(level, position, Vector2.Zero, parent) { // Creates boxes var span = MathHelper.TwoPi / boxesCount; for (var i = 0; i < boxesCount; i++) { var direction = MyMath.GetRandomAngle(span) + i * span; var box = new ExplosionBox(level, position, boxSideSize, direction, distance * MyMath.GetRandomFloat(0.8f, 1.2f)); AddObject(box); } }
static void Main() { Customer[] arrayCustomers = { new RegularCustomer(150), new RegularCustomer(50), new RegularCustomer(210), new BenefitCustomer1(60), new BenefitCustomer1(10), new BenefitCustomer2(160), new LimitedCustomer(250), new BenefitCustomer1(60), new BenefitCustomer2(310), new LimitedCustomer(180), new LimitedCustomer(120), new BenefitCustomer2(70) }; BasicLevel basicLevel = new BasicLevel(arrayCustomers); arrayCustomers = basicLevel.SortDescByEnergyConsumed(); foreach (Customer element in arrayCustomers) { Console.WriteLine(element.GetEnergyConsumed()); } Console.WriteLine(); arrayCustomers = basicLevel.SortByTotalCost(); foreach (Customer element in arrayCustomers) { Console.WriteLine(element.GetTotalCostEnergyValue()); } Console.WriteLine(); arrayCustomers = basicLevel.SortByTypeCustomer(); foreach (Customer element in arrayCustomers) { Console.WriteLine(element.GetType()); } Console.WriteLine(); Console.WriteLine(basicLevel.TotalCostFromAllCustomers()); Console.WriteLine(); Console.WriteLine(basicLevel.TotalBenefitsCots()); }
public override void OnInspectorGUI() { BasicLevel myScript = (BasicLevel)target; if (!Application.isPlaying) { DrawDefaultInspector(); List <EntityBullet.EntityBulletType> bullets = myScript.GetBulletsList(); int bullets_number = bullets.Count; GUILayout.Label("Bullets elements ========"); bullets_number = EditorGUILayout.IntField("Bullets number", bullets_number); if (bullets_number != bullets.Count) { myScript.SetBulletsNumber(bullets_number); EditorUtility.SetDirty(target); } bullets = myScript.GetBulletsList(); for (int i = 0; i < bullets.Count; ++i) { EntityBullet.EntityBulletType curr_bullet = bullets[i]; string name = "Bullet " + (i + 1); EntityBullet.EntityBulletType obj = (EntityBullet.EntityBulletType)EditorGUILayout.EnumPopup(name, curr_bullet); if (obj != curr_bullet) { myScript.SetBulletType(i, obj); EditorUtility.SetDirty(target); } } } }
public TextureBreak(BasicLevel level, Vector2 position, Vector2 size, IWorldObject parent = null, MyTexture2D texture = null, float velocity = 0.1f) : base(level, position, size, parent, texture) { _velocity = velocity; float friction = 0.001f; float randomAngleSpan = MathHelper.PiOver2; AddObject(new PartTextureDisolve(level, LeftTopPosition, size, LeftTopRectangle, LeftTopOriginMultiplier, _velocity, MyMath.GetRandomAngle(randomAngleSpan) - MathHelper.PiOver4 - MathHelper.PiOver2, 0.1f, this, Texture) { SmoothOpacity = { Friction = friction } }); AddObject(new PartTextureDisolve(level, LeftBotPosition, size, LeftBotRectangle, LeftBotOriginMultiplier, _velocity, MyMath.GetRandomAngle(randomAngleSpan) + MathHelper.PiOver4 + MathHelper.PiOver2, 0.1f, this, Texture) { SmoothOpacity = { Friction = friction } }); AddObject(new PartTextureDisolve(level, RightTopPosition, size, RightTopRectangle, RightTopOriginMultiplier, _velocity, MyMath.GetRandomAngle(randomAngleSpan) - MathHelper.PiOver4, 0.1f, this, Texture) { SmoothOpacity = { Friction = friction } }); AddObject(new PartTextureDisolve(level, RightBotPosition, size, RightBotRectangle, RightBotOriginMultiplier, _velocity, MyMath.GetRandomAngle(randomAngleSpan) + MathHelper.PiOver4, 0.1f, this, Texture) { SmoothOpacity = { Friction = friction } }); }
public CollisionPixelObject(BasicLevel level, World world, Vector2 position, PixelDescription[,] pixelsDescription, Vector2 pixelsCount, IWorldObject parent = null) : base(level, position, pixelsDescription, pixelsCount, parent) { _world = world; Pixels = CreatePixels(pixelsDescription); }
public SimplePixelObject(BasicLevel level, Vector2 position, PixelDescription[,] pixelsDescription, Vector2 pixelsCount) : base(level, position, pixelsDescription, pixelsCount) { }
protected BasicPixelObject(BasicLevel level, Vector2 position, PixelDescription[,] pixelsDescription, Vector2 pixelsCount, IWorldObject parent = null) : base(level, position, PixelOptions.PixelSideSize * pixelsCount, parent, TextureManager.Box2) { PixelsCount = pixelsCount; }
public SimplePixel(BasicLevel level, Vector2 position, Vector2 size, IWorldObject parent = null) : base(level, position, size, parent, TextureManager.Box2) { }
public TextureDisolve(BasicLevel level, Vector2 position, Vector2 size, IWorldObject parent = null, float velocity = 0, float direction = 0, float rotationSpeed = 0, MyTexture2D texture = null) : base(level, position, size, velocity, direction, rotationSpeed, parent, texture ?? TextureManager.Box2) { SmoothOpacity.ValueToGo = 0; }
public CollisionPixelEnvironment(BasicLevel level, World world, PixelDescription[,] pixelsDescription, Vector2 pixelsCount, IWorldObject parent = null) : base(level, world, Vector2.Zero, pixelsDescription, pixelsCount, parent) { }