private static IEnumerator HandleShadowChainDelay(Projectile proj, int amount, float delay, float scaleMult, Projectile overrideproj, bool shadowcolour = false) { GameObject prefab = FakePrefab.Clone(proj.gameObject); if (overrideproj != null) { prefab = FakePrefab.Clone(overrideproj.gameObject); } Projectile prefabproj = prefab.GetComponent <Projectile>(); prefabproj.Owner = proj.Owner; prefabproj.Shooter = proj.Shooter; Vector3 position = proj.transform.position; float rotation = proj.Direction.ToAngle(); //Here's where the projectile direction is assigned bool isInitialProjectile = true; yield return(null); for (int i = 0; i < amount; i++) { if (delay > 0f) { float ela = 0f; if (isInitialProjectile) { float initDelay = delay - 0.03f; while (ela < initDelay) { ela += BraveTime.DeltaTime; yield return(null); } isInitialProjectile = false; } else { while (ela < delay) { ela += BraveTime.DeltaTime; yield return(null); } } } ChainedShadowBulletsHandler.SpawnShadowBullet(prefabproj, position, rotation, scaleMult, shadowcolour); } yield break; }
public static void SpawnChainedShadowBullets(this Projectile source, int numberInChain, float pauseLength, float chainScaleMult = 1, Projectile overrideProj = null, bool shadowcolour = false) { GameManager.Instance.Dungeon.StartCoroutine(ChainedShadowBulletsHandler.HandleShadowChainDelay(source, numberInChain, pauseLength, chainScaleMult, overrideProj, shadowcolour)); }