protected override void DoEffect(PlayerController user) { int amountOfBullets = storedProjectiles.Count(); float direction = UnityEngine.Random.insideUnitCircle.ToAngle(); if (user.CurrentGun != null) { direction = user.CurrentGun.CurrentAngle; } for (int i = amountOfBullets - 1; i >= 0; i--) { float finaldir = ProjSpawnHelper.GetAccuracyAngled(direction, 25, user); GameObject prefab = storedProjectiles[i].gameObject; GameObject spawnedBulletOBJ = SpawnManager.SpawnProjectile(prefab, user.sprite.WorldCenter, Quaternion.Euler(0f, 0f, finaldir), true); Projectile component = spawnedBulletOBJ.GetComponent <Projectile>(); if (component != null) { component.Owner = user; component.Shooter = user.specRigidbody; component.baseData.speed *= UnityEngine.Random.Range(0.9f, 1.1f); } storedProjectiles.RemoveAt(i); Destroy(prefab); } }
private IEnumerator SpawnAdditionalProjectile(Projectile source, Projectile toSpawn, float variance = 0f, float FromAim = 0f, bool helix = false) { //ETGModConsole.Log("spawn additional ran"); yield return(null); GameObject spawnBee = SpawnManager.SpawnProjectile(toSpawn.gameObject, source.specRigidbody.UnitCenter, Quaternion.Euler(0f, 0f, ProjSpawnHelper.GetAccuracyAngled(source.Direction.ToAngle() + FromAim, variance, source.ProjectilePlayerOwner())), true); if (spawnBee.GetComponent <Projectile>()) { Projectile beeproj = spawnBee.GetComponent <Projectile>(); beeproj.Owner = source.Owner; beeproj.Shooter = source.Shooter; beeproj.baseData.damage *= Owner.stats.GetStatValue(PlayerStats.StatType.Damage); beeproj.baseData.speed *= Owner.stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed); beeproj.baseData.range *= Owner.stats.GetStatValue(PlayerStats.StatType.RangeMultiplier); beeproj.baseData.force *= Owner.stats.GetStatValue(PlayerStats.StatType.KnockbackMultiplier); beeproj.BossDamageMultiplier *= Owner.stats.GetStatValue(PlayerStats.StatType.DamageToBosses); beeproj.UpdateSpeed(); if (helix) { beeproj.ConvertToHelixMotion(true); } beeproj.PossibleSourceGun = source.PossibleSourceGun; beeproj.gameObject.AddComponent <HasBeenBulletShuffled>(); Owner.DoPostProcessProjectile(beeproj); } yield break; }