@@ -49,7 +49,7 @@ public class Bootstrap : MonoBehaviour
49
49
bool primaryColor = true ;
50
50
Random r ;
51
51
quaternion rQuat ;
52
- float3 rPos ;
52
+ float3 rPos , rScale ;
53
53
float rLife , rSpeed ;
54
54
#endregion
55
55
@@ -61,7 +61,7 @@ void Start()
61
61
62
62
// Create our Entity archetype to spawn our cubes from later
63
63
cubeArch = entityManager . CreateArchetype (
64
- ComponentType . ReadWrite < Translation > ( ) , ComponentType . ReadWrite < Rotation > ( ) ,
64
+ ComponentType . ReadWrite < Translation > ( ) , ComponentType . ReadWrite < Rotation > ( ) , ComponentType . ReadWrite < NonUniformScale > ( ) ,
65
65
ComponentType . ReadWrite < LifeTime > ( ) , ComponentType . ReadWrite < Speed > ( ) ,
66
66
ComponentType . ReadOnly < LocalToWorld > ( ) // Needs this (is the overall transform representation) but doesn't have to be "directly" wrote to or read from
67
67
) ;
@@ -115,6 +115,7 @@ public void SpawnCube()
115
115
r = new Random ( ( uint ) UnityEngine . Random . Range ( 0 , 1000000 ) ) ;
116
116
117
117
rPos = r . NextFloat3 ( ) ;
118
+ rScale = r . NextFloat3 ( .5f , 2.0f ) ;
118
119
rLife = r . NextFloat ( 2 , 10 ) ;
119
120
rSpeed = r . NextFloat ( 1 , 20 ) ;
120
121
rQuat = r . NextQuaternionRotation ( ) ;
@@ -125,6 +126,7 @@ public void SpawnCube()
125
126
126
127
// Set all of the entity data
127
128
entityManager . SetComponentData ( cubeEntity , new Translation { Value = rPos } ) ; // This is the Starting Position
129
+ entityManager . SetComponentData ( cubeEntity , new NonUniformScale { Value = rScale } ) ; // This is the Starting Position
128
130
entityManager . SetComponentData ( cubeEntity , new Rotation { Value = rQuat } ) ; // This is the Starting Rotation
129
131
entityManager . SetComponentData ( cubeEntity , new LifeTime { Value = rLife } ) ; // This determines how long the cube lasts
130
132
entityManager . SetComponentData ( cubeEntity , new Speed { Value = rSpeed } ) ; // This is determines the rotation and movement speed
0 commit comments