TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.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.TopDownEngine.TimedSpawner:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

virtual void ToggleSpawn ()
 Toggles spawn on and off.
virtual void TurnSpawnOff ()
 Turns spawning off.
virtual void TurnSpawnOn ()
 Turns spawning on.

Public Attributes

bool CanSpawn = true
 whether or not this spawner can spawn
float MinFrequency = 1f
 the minimum frequency possible, in seconds
float MaxFrequency = 1f
 the maximum frequency possible, in seconds
bool CanSpawnButton
 a test button to spawn an object

Protected Member Functions

virtual void Start ()
 On Start we initialize our spawner.
virtual void Initialization ()
 Grabs the associated object pooler if there's one, and initalizes the frequency.
virtual void Update ()
 Every frame we check whether or not we should spawn something.
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.
virtual void DetermineNextFrequency ()
 Determines the next frequency by randomizing a value between the two specified in the inspector.

Protected Attributes

float _lastSpawnTimestamp = 0f
float _nextFrequency = 0f

Properties

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

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.TopDownEngine.TimedSpawner.DetermineNextFrequency ( )
protectedvirtual

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

◆ Initialization()

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

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

◆ Spawn()

virtual void MoreMountains.TopDownEngine.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.TopDownEngine.TimedSpawner.Start ( )
protectedvirtual

On Start we initialize our spawner.

◆ ToggleSpawn()

virtual void MoreMountains.TopDownEngine.TimedSpawner.ToggleSpawn ( )
virtual

Toggles spawn on and off.

◆ TurnSpawnOff()

virtual void MoreMountains.TopDownEngine.TimedSpawner.TurnSpawnOff ( )
virtual

Turns spawning off.

◆ TurnSpawnOn()

virtual void MoreMountains.TopDownEngine.TimedSpawner.TurnSpawnOn ( )
virtual

Turns spawning on.

◆ Update()

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

Every frame we check whether or not we should spawn something.

Member Data Documentation

◆ _lastSpawnTimestamp

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

◆ _nextFrequency

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

◆ CanSpawn

bool MoreMountains.TopDownEngine.TimedSpawner.CanSpawn = true

whether or not this spawner can spawn

◆ CanSpawnButton

bool MoreMountains.TopDownEngine.TimedSpawner.CanSpawnButton

a test button to spawn an object

◆ MaxFrequency

float MoreMountains.TopDownEngine.TimedSpawner.MaxFrequency = 1f

the maximum frequency possible, in seconds

◆ MinFrequency

float MoreMountains.TopDownEngine.TimedSpawner.MinFrequency = 1f

the minimum frequency possible, in seconds

Property Documentation

◆ ObjectPooler

virtual MMObjectPooler MoreMountains.TopDownEngine.TimedSpawner.ObjectPooler
getset

the object pooler associated to this spawner


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/AI/Automation/TimedSpawner.cs