Corgi Engine  v9.1
MoreMountains.CorgiEngine.TimedSpawner Class Reference

A class meant to be used in conjunction with an object pool (simple or multiple) to spawn objects regularly, at a frequency randomly chosen between the min and max values set in its inspector More...

Inheritance diagram for MoreMountains.CorgiEngine.TimedSpawner:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Attributes

float MinFrequency = 1f
 the minimum frequency possible, in seconds More...
 
float MaxFrequency = 1f
 the maximum frequency possible, in seconds More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our spawner More...
 
virtual void Initialization ()
 Grabs the associated object pooler if there's one, and initalizes the frequency More...
 
virtual void Update ()
 Every frame we check whether or not we should spawn something More...
 
virtual void Spawn ()
 Spawns an object out of the pool if there's one available. If it's an object with Health, revives it too. More...
 
virtual void DetermineNextFrequency ()
 Determines the next frequency by randomizing a value between the two specified in the inspector. More...
 

Protected Attributes

float _lastSpawnTimestamp = 0f
 
float _nextFrequency = 0f
 

Properties

MMObjectPooler ObjectPooler [get, set]
 the object pooler associated to this spawner More...
 

Detailed Description

A class meant to be used in conjunction with an object pool (simple or multiple) to spawn objects regularly, at a frequency randomly chosen between the min and max values set in its inspector

Member Function Documentation

◆ DetermineNextFrequency()

virtual void MoreMountains.CorgiEngine.TimedSpawner.DetermineNextFrequency ( )
protectedvirtual

Determines the next frequency by randomizing a value between the two specified in the inspector.

◆ Initialization()

virtual void MoreMountains.CorgiEngine.TimedSpawner.Initialization ( )
protectedvirtual

Grabs the associated object pooler if there's one, and initalizes the frequency

◆ Spawn()

virtual void MoreMountains.CorgiEngine.TimedSpawner.Spawn ( )
protectedvirtual

Spawns an object out of the pool if there's one available. If it's an object with Health, revives it too.

◆ Start()

virtual void MoreMountains.CorgiEngine.TimedSpawner.Start ( )
protectedvirtual

On Start we initialize our spawner

◆ Update()

virtual void MoreMountains.CorgiEngine.TimedSpawner.Update ( )
protectedvirtual

Every frame we check whether or not we should spawn something

Member Data Documentation

◆ _lastSpawnTimestamp

float MoreMountains.CorgiEngine.TimedSpawner._lastSpawnTimestamp = 0f
protected

◆ _nextFrequency

float MoreMountains.CorgiEngine.TimedSpawner._nextFrequency = 0f
protected

◆ MaxFrequency

float MoreMountains.CorgiEngine.TimedSpawner.MaxFrequency = 1f

the maximum frequency possible, in seconds

◆ MinFrequency

float MoreMountains.CorgiEngine.TimedSpawner.MinFrequency = 1f

the minimum frequency possible, in seconds

Property Documentation

◆ ObjectPooler

MMObjectPooler MoreMountains.CorgiEngine.TimedSpawner.ObjectPooler
getset

the object pooler associated to this spawner


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