Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
BoulderSpawner Class Reference

Detailed Description

Spawns boulders at a consistent rate at a given spawn point, facing upwards.

Documentation updated 8/26/2024

Author
Roy Pascual
Note
Boulders apply their initial force in their "up" direction, which is set to be this object's "up" direction. This will cause the boulder to be thrown upwards, rather than to the side like anticipated. The intention is that you rotate the spawner object to change which direction "up" is, and thus the direction the boulders will spawn from and be propelled towards. Usually you'd want to set it to face either to the left or right, which is 90 degrees and -90 (or 270) degrees respectively.

Public Attributes

Transform boulderPrefab
 Reference to the prefab of the boulder which we want to spawn.
 
Transform spawnPoint
 Reference to the point the boulder spawns at.
 
float seconds = -1
 Time until object despawns, in seconds. -1 to use the boulder prefab's default despawn time.
 

Private Member Functions

IEnumerator BoulderSpawnTimer ()
 Spawns a boulder every spawnCooldown seconds.
 
void SpawnBoulder ()
 Instantiates a boulder prefab and sets its up direction to this object's up direction. Also sets despawn time (if applicable).
 
void Awake ()
 Find the spawn point and set our reference to it.
 
void Start ()
 Starts the boulder spawner timer.
 

Private Attributes

float spawnCooldown = 3f
 Time between each boulder spawn, in seconds.
 
bool isSpawning = true
 True if the spawner is currently spawning boulders.
 

Member Function Documentation

◆ Awake()

void BoulderSpawner.Awake ( )
private

Find the spawn point and set our reference to it.

◆ BoulderSpawnTimer()

IEnumerator BoulderSpawner.BoulderSpawnTimer ( )
private

Spawns a boulder every spawnCooldown seconds.

◆ SpawnBoulder()

void BoulderSpawner.SpawnBoulder ( )
private

Instantiates a boulder prefab and sets its up direction to this object's up direction. Also sets despawn time (if applicable).

◆ Start()

void BoulderSpawner.Start ( )
private

Starts the boulder spawner timer.

Member Data Documentation

◆ boulderPrefab

Transform BoulderSpawner.boulderPrefab

Reference to the prefab of the boulder which we want to spawn.

◆ isSpawning

bool BoulderSpawner.isSpawning = true
private

True if the spawner is currently spawning boulders.

◆ seconds

float BoulderSpawner.seconds = -1

Time until object despawns, in seconds. -1 to use the boulder prefab's default despawn time.

◆ spawnCooldown

float BoulderSpawner.spawnCooldown = 3f
private

Time between each boulder spawn, in seconds.

◆ spawnPoint

Transform BoulderSpawner.spawnPoint

Reference to the point the boulder spawns at.


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