CurrentScreenSecondsSince
Introduction
Code Example: Spawning an Enemy on a Timer
// At class scope, define a variable to keep track of when the last spawn occurred
double lastEnemySpawn;
void CustomActivity(bool firstTimeCalled)
{
var frequencyInSeconds = 5;
if(TimeManager.CurrentScreenSecondsSince(lastEnemySpawn) >= frequencyInSeconds)
{
var enemy = Factories.EnemyFactory.CreateNew();
// adjust the enemy, such as setting its position here
lastEnemySpawn = TimeManager.CurrentScreenTime;
}
}Last updated
Was this helpful?