public void Update(float deltaTime) { if (isEnabled) { if (spawnTimeLeft > 0f) { spawnTimeLeft -= deltaTime; } else if (parent.Speed > minSpeedToSpawn || prevDirection != parent.LookingDirection) { float particleSpeed = speed * parent.Speed; float particleDeceleration = deceleration * particleSpeed; spawnTimeLeft = spawnTime; for (int i = 0; i < spawnPositions.Length; i++) { particleSystem.CreateParticle(parent.Position + Functions.RotateVector2(spawnPositions[i], parent.LookingDirection), parent.LookingDirection, radius, parent.MovementDirection, particleSpeed, particleDeceleration, rotationSpeed, lifeTime, color); } } prevDirection = parent.LookingDirection; } }