SpawnComponent.periodRange constructor
SpawnComponent.periodRange({})
Use this constructor if you want your components to spawn within an
interval time range.
minPeriod
will be the minimum amount of time before the next component
spawns and maxPeriod
will be the maximum amount of time before it
spawns.
Implementation
SpawnComponent.periodRange({
required this.factory,
required double minPeriod,
required double maxPeriod,
this.area,
this.within = true,
this.selfPositioning = false,
this.autoStart = true,
this.spawnWhenLoaded = false,
Random? random,
super.key,
}) : assert(
!(selfPositioning && area != null),
"Don't set an area when you are using selfPositioning=true",
),
_period = minPeriod +
(random ?? randomFallback).nextDouble() * (maxPeriod - minPeriod),
_random = random ?? randomFallback;