Infinite Runner Engine v2.2
Loading...
Searching...
No Matches
MoreMountains.InfiniteRunnerEngine.DistanceSpawner Class Reference

Spawns and positions/resizes objects based on the distance traveled. More...

Inheritance diagram for MoreMountains.InfiniteRunnerEngine.DistanceSpawner:
MoreMountains.InfiniteRunnerEngine.Spawner

Public Types

enum  GapOrigins { Spawner , LastSpawnedObject }

Public Attributes

GapOrigins GapOrigin = GapOrigins.Spawner
 is the gap related to the last object or the spawner ?
Vector3 MinimumGap = new Vector3(1, 1, 1)
 the minimum gap bewteen two spawned objects
Vector3 MaximumGap = new Vector3(1, 1, 1)
 the maximum gap between two spawned objects
float MinimumYClamp
 the minimum Y position we can spawn the object at
float MaximumYClamp
 the maximum Y position we can spawn the object at
float MinimumZClamp
 the minimum Z position we can spawn the object at
float MaximumZClamp
 the maximum Z position we can spawn the object at
bool SpawnRotatedToDirection = true
 if true, the spawned objects will be rotated towards the spawn direction
Public Attributes inherited from MoreMountains.InfiniteRunnerEngine.Spawner
Vector3 MinimumSize = new Vector3(1, 1, 1)
 the minimum size of a spawned object
Vector3 MaximumSize = new Vector3(1, 1, 1)
 the maximum size of a spawned object
bool PreserveRatio = false
 if set to true, the random size will preserve the original's aspect ratio
Vector3 MinimumRotation
 the minimum size of a spawned object
Vector3 MaximumRotation
 the maximum size of a spawned object
bool Spawning = true
 if true, the spawner can spawn, if not, it won't spawn
bool OnlySpawnWhileGameInProgress = true
 if true, only spawn objects while the game is in progress
float InitialDelay = 0f
 Initial delay before the first spawn, in seconds.

Protected Member Functions

virtual void Start ()
 Triggered at the start of the level, initialization.
virtual void Update ()
 Triggered every frame.
virtual void CheckSpawn ()
 Checks if the conditions for a new spawn are met, and if so, triggers the spawn of a new object.
virtual void DistanceSpawn (Vector3 spawnPosition)
 Spawns an object at the specified position and determines the next spawn position.
virtual Vector3 ClampedPosition (Vector3 vectorToClamp)
 Returns a Vector3 clamped on the Y and Z axis based on the inspector settings.
virtual Vector3 ClampedPositionRelative (Vector3 vectorToClamp, Vector3 clampOrigin)
 Returns a Vector3 clamped on the Y and Z axis based on the inspector settings.
virtual void OnDrawGizmosSelected ()
 Draws on the scene view cubes to show the minimum and maximum gaps, for tweaking purposes.
virtual void DrawClamps ()
 Draws the position clamps, called when the object is selected in scene view.
Protected Member Functions inherited from MoreMountains.InfiniteRunnerEngine.Spawner
virtual void Awake ()
 On awake, we get the objectPooler component.

Protected Attributes

Transform _lastSpawnedTransform
float _nextSpawnDistance
Vector3 _gap = Vector3.zero
Protected Attributes inherited from MoreMountains.InfiniteRunnerEngine.Spawner
MMObjectPooler _objectPooler
float _startTime

Additional Inherited Members

Public Member Functions inherited from MoreMountains.InfiniteRunnerEngine.Spawner
virtual GameObject Spawn (Vector3 spawnPosition, bool triggerObjectActivation=true)
 Spawns a new object and positions/resizes it.

Detailed Description

Spawns and positions/resizes objects based on the distance traveled.

Member Enumeration Documentation

◆ GapOrigins

Enumerator
Spawner 
LastSpawnedObject 

Member Function Documentation

◆ CheckSpawn()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.CheckSpawn ( )
protectedvirtual

Checks if the conditions for a new spawn are met, and if so, triggers the spawn of a new object.

◆ ClampedPosition()

virtual Vector3 MoreMountains.InfiniteRunnerEngine.DistanceSpawner.ClampedPosition ( Vector3 vectorToClamp)
protectedvirtual

Returns a Vector3 clamped on the Y and Z axis based on the inspector settings.

Returns
The new position.
Parameters
vectorToClampVector to clamp.

◆ ClampedPositionRelative()

virtual Vector3 MoreMountains.InfiniteRunnerEngine.DistanceSpawner.ClampedPositionRelative ( Vector3 vectorToClamp,
Vector3 clampOrigin )
protectedvirtual

Returns a Vector3 clamped on the Y and Z axis based on the inspector settings.

Returns
The new position.
Parameters
vectorToClampVector to clamp.

◆ DistanceSpawn()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.DistanceSpawn ( Vector3 spawnPosition)
protectedvirtual

Spawns an object at the specified position and determines the next spawn position.

Parameters
spawnPositionSpawn position.

◆ DrawClamps()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.DrawClamps ( )
protectedvirtual

Draws the position clamps, called when the object is selected in scene view.

◆ OnDrawGizmosSelected()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.OnDrawGizmosSelected ( )
protectedvirtual

Draws on the scene view cubes to show the minimum and maximum gaps, for tweaking purposes.

◆ Start()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.Start ( )
protectedvirtual

Triggered at the start of the level, initialization.

we get the object pooler component

◆ Update()

virtual void MoreMountains.InfiniteRunnerEngine.DistanceSpawner.Update ( )
protectedvirtual

Triggered every frame.

Member Data Documentation

◆ _gap

Vector3 MoreMountains.InfiniteRunnerEngine.DistanceSpawner._gap = Vector3.zero
protected

◆ _lastSpawnedTransform

Transform MoreMountains.InfiniteRunnerEngine.DistanceSpawner._lastSpawnedTransform
protected

◆ _nextSpawnDistance

float MoreMountains.InfiniteRunnerEngine.DistanceSpawner._nextSpawnDistance
protected

◆ GapOrigin

GapOrigins MoreMountains.InfiniteRunnerEngine.DistanceSpawner.GapOrigin = GapOrigins.Spawner

is the gap related to the last object or the spawner ?

◆ MaximumGap

Vector3 MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MaximumGap = new Vector3(1, 1, 1)

the maximum gap between two spawned objects

◆ MaximumYClamp

float MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MaximumYClamp

the maximum Y position we can spawn the object at

◆ MaximumZClamp

float MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MaximumZClamp

the maximum Z position we can spawn the object at

◆ MinimumGap

Vector3 MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MinimumGap = new Vector3(1, 1, 1)

the minimum gap bewteen two spawned objects

◆ MinimumYClamp

float MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MinimumYClamp

the minimum Y position we can spawn the object at

◆ MinimumZClamp

float MoreMountains.InfiniteRunnerEngine.DistanceSpawner.MinimumZClamp

the minimum Z position we can spawn the object at

◆ SpawnRotatedToDirection

bool MoreMountains.InfiniteRunnerEngine.DistanceSpawner.SpawnRotatedToDirection = true

if true, the spawned objects will be rotated towards the spawn direction


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