/// <summary> /// Default values /// </summary> public virtual void New() { if (!bInitialised) { bInitialised = true; DestructionTimeOut = 2; PhysicsForceOptions = new PhysicsOptions(); PhysicsForceOptions.Radius = 10f; PhysicsForceOptions.Force = 20f; PhysicsForceOptions.UpwardsForce = 3f; PhysicsForceOptions.Mode = ForceMode.Force; RandomSphere = new RandomSphereOptions(); RandomSphere.IncludeX = true; RandomSphere.IncludeY = true; RandomSphere.IncludeZ = true; RandomRotate = new RandomRotateOptions(); } }
} // trigger all spawns in the array /// <summary> /// Spawn with the minimum options aka basic. /// </summary> /// <param name="Prefab">Prefab to spawn.</param> /// <param name="HowMany">Number of instances.</param> /// <param name="Where">Transform to center the spawns at.</param> /// <param name="Radius">Random radius options.</param> /// <param name="Target">Spawn targeting.</param> /// <returns></returns> public static List <GameObject> SpawnBasic(GameObject Prefab, int HowMany, Transform Where, RandomSphereOptions Radius, SpawnTarget Target) { // set up var retunedSpawns = new List <GameObject>(); if (HowMany <= 0) { HowMany = 1; } // generate instances for (int i = 0; i < HowMany; i++) { var soSpawnMe = new SpawnerOptionsDelayedSequence(); soSpawnMe.Prefab = Prefab; soSpawnMe.NumberToSpawn = 1; soSpawnMe.RandomSphere = Radius; soSpawnMe.PhysicsForceOptions = new PhysicsOptions(); soSpawnMe.RandomRotate = new RandomRotateOptions(); retunedSpawns.Add(soSpawnMe.Spawn(Where, Target)); } // all done return(retunedSpawns); }