Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMRandomBoundsInstantiator Class Reference

This class lets you randomly spawn objects within its bounds (defined by a 3D collider) More...

Inheritance diagram for MoreMountains.Tools.MMRandomBoundsInstantiator:

Public Types

enum  StartModes { StartModes.Awake, StartModes.Start, StartModes.None }
 the possible start modes More...
 
enum  ScaleModes { ScaleModes.Uniform, ScaleModes.Vector3 }
 the possible scale modes you can use to rescale objects More...
 

Public Member Functions

virtual void InstantiateRandomObject ()
 Spawns a random object from the pool of choices More...
 

Public Attributes

StartModes StartMode = StartModes.Awake
 whether this instantiator should auto trigger on Awake, Start, or never More...
 
string InstantiatedObjectName = "RandomInstantiated"
 the name to give to the instantiated object More...
 
bool ParentInstantiatedToThisObject = true
 if this is true, the instantiated object will be parented to the spawner More...
 
bool DestroyPreviouslyInstantiatedObjects = true
 if this is true, every time InstantiateRandomObject is called, any previously instantiated object will be destroyed More...
 
List< GameObject > RandomPool
 the list containing all the objects that can potentially be instantiated More...
 
Vector2Int Quantity = new Vector2Int(1, 1)
 the min and max bounds to use to determine a random quantity of objects to spawn More...
 
ScaleModes ScaleMode = ScaleModes.Uniform
 the scale mode to use (uniform scales the whole object, Vector3 randomizes x, y and z scale elements More...
 
float MinScale = 1f
 the min scale to use in uniform mode More...
 
float MaxScale = 1f
 the max scale to use in uniform mode More...
 
Vector3 MinVectorScale = Vector3.one
 the min scale to use in vector3 mode More...
 
Vector3 MaxVectorScale = Vector3.one
 the max scale to use in vector3 mode More...
 
bool InstantiateButton
 a test button for your inspector More...
 

Protected Member Functions

virtual void Awake ()
 On awake we instantiate if needed More...
 
virtual void Start ()
 On Start we instantiate if needed More...
 
virtual void Instantiate ()
 Instantiates as many objects as needed, clearing previously existing ones if needed More...
 

Protected Attributes

Collider _collider
 
List< GameObject > _instantiatedGameObjects
 
Vector3 _newScale = Vector3.zero
 

Detailed Description

This class lets you randomly spawn objects within its bounds (defined by a 3D collider)

Member Enumeration Documentation

◆ ScaleModes

the possible scale modes you can use to rescale objects

Enumerator
Uniform 
Vector3 

◆ StartModes

the possible start modes

Enumerator
Awake 
Start 
None 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMRandomBoundsInstantiator.Awake ( )
protectedvirtual

On awake we instantiate if needed

◆ Instantiate()

virtual void MoreMountains.Tools.MMRandomBoundsInstantiator.Instantiate ( )
protectedvirtual

Instantiates as many objects as needed, clearing previously existing ones if needed

◆ InstantiateRandomObject()

virtual void MoreMountains.Tools.MMRandomBoundsInstantiator.InstantiateRandomObject ( )
virtual

Spawns a random object from the pool of choices

◆ Start()

virtual void MoreMountains.Tools.MMRandomBoundsInstantiator.Start ( )
protectedvirtual

On Start we instantiate if needed

Member Data Documentation

◆ _collider

Collider MoreMountains.Tools.MMRandomBoundsInstantiator._collider
protected

◆ _instantiatedGameObjects

List<GameObject> MoreMountains.Tools.MMRandomBoundsInstantiator._instantiatedGameObjects
protected

◆ _newScale

Vector3 MoreMountains.Tools.MMRandomBoundsInstantiator._newScale = Vector3.zero
protected

◆ DestroyPreviouslyInstantiatedObjects

bool MoreMountains.Tools.MMRandomBoundsInstantiator.DestroyPreviouslyInstantiatedObjects = true

if this is true, every time InstantiateRandomObject is called, any previously instantiated object will be destroyed

◆ InstantiateButton

bool MoreMountains.Tools.MMRandomBoundsInstantiator.InstantiateButton

a test button for your inspector

◆ InstantiatedObjectName

string MoreMountains.Tools.MMRandomBoundsInstantiator.InstantiatedObjectName = "RandomInstantiated"

the name to give to the instantiated object

◆ MaxScale

float MoreMountains.Tools.MMRandomBoundsInstantiator.MaxScale = 1f

the max scale to use in uniform mode

◆ MaxVectorScale

Vector3 MoreMountains.Tools.MMRandomBoundsInstantiator.MaxVectorScale = Vector3.one

the max scale to use in vector3 mode

◆ MinScale

float MoreMountains.Tools.MMRandomBoundsInstantiator.MinScale = 1f

the min scale to use in uniform mode

◆ MinVectorScale

Vector3 MoreMountains.Tools.MMRandomBoundsInstantiator.MinVectorScale = Vector3.one

the min scale to use in vector3 mode

◆ ParentInstantiatedToThisObject

bool MoreMountains.Tools.MMRandomBoundsInstantiator.ParentInstantiatedToThisObject = true

if this is true, the instantiated object will be parented to the spawner

◆ Quantity

Vector2Int MoreMountains.Tools.MMRandomBoundsInstantiator.Quantity = new Vector2Int(1, 1)

the min and max bounds to use to determine a random quantity of objects to spawn

◆ RandomPool

List<GameObject> MoreMountains.Tools.MMRandomBoundsInstantiator.RandomPool

the list containing all the objects that can potentially be instantiated

◆ ScaleMode

ScaleModes MoreMountains.Tools.MMRandomBoundsInstantiator.ScaleMode = ScaleModes.Uniform

the scale mode to use (uniform scales the whole object, Vector3 randomizes x, y and z scale elements

◆ StartMode

StartModes MoreMountains.Tools.MMRandomBoundsInstantiator.StartMode = StartModes.Awake

whether this instantiator should auto trigger on Awake, Start, or never


The documentation for this class was generated from the following file: