using UnityEngine; public class FireBullet : PlayerAbility { [Header("Projectile Stats")] public int pierceAmount; public float accuracy; public float bulletLifetime; public float projectileSpeed; public enum FireMode {Angled, Offset}; [Header("Projectile")] public FireMode fireMode = FireMode.Offset; public float projectileCount; public Vector2 offset; public float angle; [SerializeField] private Projectile projectile; protected override void AbilityEffects() { for (int i = 0; i < projectileCount; i++) { Projectile newProjectile = Instantiate(projectile, thisPlayer.firingPointBase.position, transform.rotation); newProjectile.RotateToTarget(thisPlayer.firingPoint.position); newProjectile.transform.position = thisPlayer.firingPoint.position; //me when i set the position 3 times in a row. but it's to prevent the bullets firing behind marisa if (fireMode == FireMode.Offset && projectileCount > 1) { newProjectile.transform.position += new Vector3(Random.Range(-offset.x, offset.x), Random.Range(-offset.y, offset.y)); } newProjectile.pierceAmount = pierceAmount; newProjectile.damage = power; newProjectile.speed = projectileSpeed; newProjectile.lifetime = bulletLifetime; newProjectile.transform.Rotate(0, 0, Random.Range(-accuracy, accuracy)); newProjectile.tag = thisPlayer.tag; } } }