void Update() { if (Time.time >= nextRotateAction) { bool skipRotate = false; string action = rotatePattern.GetNextAction(); switch (action) { case "delay": break; case "sync": skipRotate = spawnPattern.GetCurrentStep() > 0; break; default: int degrees = int.Parse(action); transform.Rotate(new Vector3(0, degrees, 0)); break; } if (!skipRotate) { if (rotatePattern.Next() != null) { nextRotateAction = Time.time + (float)rotatePattern.GetNextExecution() / 1000; } else { nextRotateAction = float.MaxValue; } } } if (Time.time >= nextSpawnAction) { string action = spawnPattern.GetNextAction(); switch (action) { case "delay": break; default: if (_onlyPlayOnFire && _audioSource != null) { _audioSource.pitch = Random.Range(0.9f, 1.1f); _audioSource.Play(); } Bullet obj = Instantiate <Bullet>(bullet, transform.position + transform.TransformVector(bulletSpawnOffset), transform.rotation); obj.IsFriendly = IsFriendlyFire; obj.Launch((transform.forward * speed) + relativeVelocity); break; } if (spawnPattern.Next() != null) { nextSpawnAction = Time.time + (float)spawnPattern.GetNextExecution() / 1000; } else { nextSpawnAction = float.MaxValue; } } }