3232import org .destinationsol .location .components .Angle ;
3333import org .destinationsol .location .components .Position ;
3434import org .destinationsol .location .components .Velocity ;
35+ import org .destinationsol .moneyDropping .components .DropsMoneyOnDestruction ;
3536import org .destinationsol .removal .events .DeletionEvent ;
3637import org .destinationsol .removal .systems .DestructionSystem ;
3738import org .destinationsol .rendering .RenderableElement ;
5152 */
5253public class RubbleCreationSystem implements EventReceiver {
5354
54- public static final float SIZE_TO_RUBBLE_COUNT = 13f ;
55- public static final float MIN_SCALE = .07f ;
56- public static final float MAX_SCALE = .12f ;
55+ public static final float SIZE_TO_RUBBLE_COUNT = 8f ;
56+ public static final float MIN_SCALE = .1f ;
57+ public static final float MAX_SCALE = .3f ;
5758 private static final float MAX_SPD = 40f ;
5859
5960 @ In
@@ -115,7 +116,7 @@ private void buildRubblePieces(Position pos, Velocity vel, Angle angle, Size siz
115116 element .graphicsOffset = new Vector2 ();
116117
117118 float scale = SolRandom .randomFloat (MIN_SCALE , MAX_SCALE );
118- element .setSize (scale );
119+ element .setSize (scale * size . size );
119120
120121 element .relativePosition = new Vector2 ();
121122 element .tint = Color .WHITE ;
@@ -136,7 +137,7 @@ private void buildRubblePieces(Position pos, Velocity vel, Angle angle, Size siz
136137
137138 //Create size component
138139 Size sizeComponent = new Size ();
139- sizeComponent .size = scale ;
140+ sizeComponent .size = scale * size . size ;
140141
141142 //Create velocity component
142143 Velocity velocityComponent = new Velocity ();
@@ -145,7 +146,13 @@ private void buildRubblePieces(Position pos, Velocity vel, Angle angle, Size siz
145146 velocityComponent .velocity = velocity ;
146147
147148 EntityRef entityRef = entitySystemManager .getEntityManager ().createEntity (graphicsComponent , positionComponent ,
148- velocityComponent , angle , sizeComponent , new RubbleMesh ());
149+ velocityComponent , angle , sizeComponent , new RubbleMesh (), health );
150+
151+ if (sizeComponent .size > 0.1 ) {
152+ entityRef .setComponent (new CreatesRubbleOnDestruction ());
153+ entityRef .setComponent (new DropsMoneyOnDestruction ());
154+ }
155+
149156 SolMath .free (velocity );
150157 entityRef .setComponent (new BodyLinked ());
151158 }
0 commit comments