Table of Contents

Class SimpleExplosion

Namespace
Alis.Core.Physic.Common.PhysicsLogic
Assembly
Alis.dll

Creates a simple explosion that ignores other bodies hiding behind static bodies.

public sealed class SimpleExplosion : PhysicsLogic

Inheritance

Inherited Members

Constructors

SimpleExplosion(World)

Initializes a new instance of the Alis.Core.Physic.Common.PhysicsLogic.SimpleExplosion class

public SimpleExplosion(World world)

Parameters

world World

The world

Properties

Power

This is the power used in the power function. A value of 1 means the force applied to bodies in the explosion is linear. A value of 2 means it is exponential.

public float Power { get; set; }

Property Value

float

Methods

Activate(Vector2, float, float, float)

Activate the explosion at the specified position.

public Dictionary<Body, Vector2> Activate(Vector2 pos, float radius, float force, float maxForce = 3.4028235E+38)

Parameters

pos Vector2

The position (center) of the explosion.

radius float

The radius of the explosion.

force float

The force applied

maxForce float

A maximum amount of force. When force gets over this value, it will be equal to maxForce

Returns

Dictionary<Body, Vector2>

A list of bodies and the amount of force that was applied to them.

ApplyImpulse(Vector2, float, float, float, HashSet<Body>)

Applies the impulse using the specified pos

private Dictionary<Body, Vector2> ApplyImpulse(Vector2 pos, float radius, float force, float maxForce, HashSet<Body> overlappingBodies)

Parameters

pos Vector2

The pos

radius float

The radius

force float

The force

maxForce float

The max force

overlappingBodies HashSet<Body>

The overlapping bodies

Returns

Dictionary<Body, Vector2>

The forces

GetPercent(float, float)

Gets the percent using the specified distance

private float GetPercent(float distance, float radius)

Parameters

distance float

The distance

radius float

The radius

Returns

float

The float