update method
void
update(
- double deltaTime,
- Size size
)
override
Implementation
@override
void update(double deltaTime, Size size) {
color.update(deltaTime);
for (ELightning eLightning in _sideLightning) {
eLightning.update(deltaTime, size);
}
_buildPathPoints(size);
if (_ticker > 0) {
_ticker -= 1;
if (_ticker.abs() <= 1) {
_fireLightningOnNextTick = true;
}
}
if (_buildLightningOnNextTick) {
_buildLightning(size);
_buildLightningOnNextTick = false;
}
if (_fireLightningOnNextTick) {
_fire(size);
_fireLightningOnNextTick = false;
}
if (_fireUntilPoint > 0) {
_fireUntilPoint +=
((_pointList.length - 1) / buildingTimeInTicks) * _fireMultiplier;
if (_fireUntilPoint.isNaN) {
_fireUntilPoint = 0;
}
if (_fireUntilPoint >= _pointList.length - 1) {
_fireUntilPoint = _pointList.length - 1;
//reverse the build process
_fireMultiplier = -_fireMultiplier;
} else if (_fireUntilPoint <= 0) {
_fireUntilPoint = 0;
}
}
}