public Vector2 GetNewEmissionPoint() { Vector2 emissionPointOffset = Vector2.Zero; switch (type) { case EmitterShapeType.Rectangle: emissionPointOffset.X = Randomizer.Float(-size.X / 2.0f, size.X / 2.0f); emissionPointOffset.Y = Randomizer.Float(-size.Y / 2.0f, size.Y / 2.0f); break; case EmitterShapeType.Circle: Vector2 radius = new Vector2(Randomizer.Float(0f, size.X), Randomizer.Float(0f, size.Y)); float angle = Randomizer.AngleInRadians(); emissionPointOffset.X = radius.X * IceMath.CosFromRadians(angle); emissionPointOffset.Y = radius.Y * IceMath.SinFromRadians(angle); break; case EmitterShapeType.CircleOutline: float angle2 = Randomizer.AngleInRadians(); emissionPointOffset.X = size.X * IceMath.CosFromRadians(angle2); emissionPointOffset.Y = size.Y * IceMath.SinFromRadians(angle2); break; case EmitterShapeType.TextureMask: // choose an array index at random if (maskPoints.Length > 0) { int arrayIndex = Randomizer.Integer(0, maskPoints.Length - 1); emissionPointOffset = maskPoints[arrayIndex]; } break; default: break; } return(emissionPointOffset + offset + position); }