/***********************************************************************************************************//** * Utility Functions **************************************************************************************************************/ /// <summary> /// Creates and activates an explosion with the given parameters /// </summary> /// <param name="world">The world to activate the exploision in</param> /// <param name="characterBody">The body of the character creating the explosion</param> /// <param name="position">The position of the explosion in the world</param> /// <param name="force">The force of the explosion (by default it is Trump's side special)</param> /// <param name="radius">The radius of the explosion in meters</param> private void CreateAndActivateExplosion(World world, Body characterBody, Vector2 position, float force = LargeHit / 2, float radius = StandardSpecialRadius) { SimpleExplosion Explosion = new SimpleExplosion(world) { Power = 1, DisabledOnGroup = characterBody.CollisionGroup }; Explosion.Activate(position, radius, force); }
/// <summary> /// Creates and activates an explosion with the given parameters in multiple positions in the world /// </summary> /// <param name="world">The world to activate the exploision in</param> /// <param name="characterBody">The body of the character creating the explosion</param> /// <param name="position">The position(s) of the explosion in the world</param> /// <param name="force">The force of the explosion (by default it is Trump's side special)</param> /// <param name="radius">The radius of the explosion in meters</param> /// <remarks>If you only need one position in the world, use the other function</remarks> private void CreateAndActivateExplosion(World world, Body characterBody, float force, float radius, params Vector2[] position) { SimpleExplosion Explosion = new SimpleExplosion(world) { Power = 1, DisabledOnGroup = characterBody.CollisionGroup }; foreach (var I in position) { Explosion.Activate(I, radius, force); } }
/// <summary> /// Creates an explosion outward from TheDonald. This is a linear explosion from the center of TheDonald's body, /// with a radius of 4m and a force of 300, maxforce of the max value of a float. This explosion does not affect /// TheDonald. /// </summary> /// <param name="character">The character preforming the move</param> public override void SideSpecial(Character character) { var DetectedPoints = UseMove(SideSpecialIndex, ref character); if (DetectedPoints.Count < 1) { return; } foreach (var i in DetectedPoints) { SimpleExplosion Explosion = new SimpleExplosion(character.GameWorld) { Power = 1, DisabledOnGroup = character.CharacterBody.CollisionGroup }; Explosion.Activate(i[0].LocalPoint, 4, 300); //Test this } PlaySound(SideSpecialIndex); }
public override void update() { base.update(); animation.setLayerDepth(LayerDepthExt.caluelateLayerDepth(this.position.Y)); if (!startBoom) { timer += Time.deltaTime; if (timer > waitTime) { timer = 0f; startBoom = true; animation.currentAnimation = BombAnimation.Boom; var shape = getComponent <FSCollisionCircle>(); var entity = createAttackEntity(); FSWorld fSWorld = scene.getSceneComponent <FSWorld>(); SimpleExplosion simpleExplosion = new SimpleExplosion(fSWorld.world); simpleExplosion.enabledOnCategories = CollisionSetting.playerCategory | CollisionSetting.enemyCategory; simpleExplosion.activate(shape.GetFixture().body.position, 0.5f, 0.02f, 0.035f); shape.removeComponent(); Core.schedule(0.2f, timer => { entity.destroy(); }); } if (changeColor) { changeColor = false; var time = (waitTime - timer) / 5f; var sprite = getComponent <Sprite>(); sprite.color = Color.Red; Core.schedule(0.1f, timer => { sprite.color = Color.White; }); Core.schedule(time, timer => { changeColor = true; }); } } }