Пример #1
0
	protected virtual void ExplodeTarget(Attackable target)
	{
		if (target == null)
			return;

		Owner.DoDamageToTarget(target);

		Vector2 force = (target.Position - rigid.position);
		force *= (ExplosionRange - force.magnitude); //Reverse force magnitude (closer = bigger force)
		force *= ExplosionForce;
		if (force.magnitude < 0) //don't suck things in
			force *= 0;

		target.AddForce(force, ForceMode2D.Impulse);
	}