1- #include " common.h "
1+ #include < vector >
22
33#include < cage-core/color.h>
44#include < cage-core/hashString.h>
55
6- #include < vector >
6+ #include " common.h "
77
88namespace
99{
10- constexpr const uint32 modelNames[] = {
10+ constexpr uint32 modelNames[] = {
1111 HashString (" ants/planets/farcodev/0.object" ),
1212 HashString (" ants/planets/farcodev/1.object" ),
1313 HashString (" ants/planets/farcodev/2.object" ),
@@ -48,12 +48,9 @@ namespace
4848 RenderComponent &r = e->value <RenderComponent>();
4949 r.object = modelNames[randomRange (0u , (uint32)(sizeof (modelNames) / sizeof (modelNames[0 ])))];
5050 r.color = playerColors[owner.owner ];
51- PhysicsComponent &physics = e->value <PhysicsComponent>();
52- physics.rotation = interpolate (Quat (), randomDirectionQuat (), 0.0003 );
53- LifeComponent &life = e->value <LifeComponent>();
54- life.life = randomRange (1000000 , 2000000 );
55- PlanetComponent &planet = e->value <PlanetComponent>();
56- planet.batch = randomRange (3 * batchScale, 5 * batchScale);
51+ e->value <PhysicsComponent>().rotation = interpolate (Quat (), randomDirectionQuat (), 0.0003 );
52+ e->value <LifeComponent>().life = randomRange (1000000 , 2000000 );
53+ e->value <PlanetComponent>().batch = randomRange (3 * batchScale, 5 * batchScale);
5754 }
5855 },
5956 -50 );
@@ -66,18 +63,13 @@ namespace
6663 t.scale = 0.3 ;
6764 t.position = planetTransform.position + randomDirection3 () * (t.scale + planetTransform.scale + 1e-5 );
6865 t.orientation = randomDirectionQuat ();
69- OwnerComponent &planetOwner = (planet)->value <OwnerComponent>();
70- OwnerComponent &owner = e->value <OwnerComponent>();
71- owner.owner = planetOwner.owner ;
72- RenderComponent &planetRender = planet->value <RenderComponent>();
66+ e->value <OwnerComponent>().owner = planet->value <OwnerComponent>().owner ;
7367 RenderComponent &r = e->value <RenderComponent>();
74- r.color = planetRender .color ;
68+ r.color = planet-> value <RenderComponent>() .color ;
7569 r.object = HashString (" ants/ships/1/1.object" );
76- PhysicsComponent &physics = e->value <PhysicsComponent>();
77- LifeComponent &life = e->value <LifeComponent>();
78- life.life = randomRange (200 , 300 );
79- ShipComponent &ship = e->value <ShipComponent>();
80- ship.longtermTarget = target;
70+ e->value <PhysicsComponent>();
71+ e->value <LifeComponent>().life = randomRange (200 , 300 );
72+ e->value <ShipComponent>().longtermTarget = target;
8173 }
8274
8375 uint32 planetIndex = 0 ;
@@ -96,8 +88,7 @@ namespace
9688 continue ;
9789 if (shipsCount + p.batch > shipsLimit)
9890 continue ;
99- OwnerComponent &owner = e->value <OwnerComponent>();
100- uint32 target = pickTargetPlanet (owner.owner );
91+ uint32 target = pickTargetPlanet (e->value <OwnerComponent>().owner );
10192 for (uint32 s = 0 ; s < p.batch ; s++)
10293 createShip (e, target);
10394 p.batch = randomRange (3 * batchScale, 5 * batchScale);
0 commit comments