public static Type ConvertProjectileControllerTypeToType(ProjectileControllerType type)
 {
     if (type == ProjectileControllerType.Rocket)
     {
         return(typeof(RocketProjectileController));
     }
     if (type == ProjectileControllerType.Shotgun)
     {
         return(typeof(ShotgunProjectileController));
     }
     else
     {
         return(typeof(NormalGravityGunProjectile));
     }
 }
    public void ShootGravityGun(Vector2 dir, ProjectileControllerType type)
    {
        if (!IsDead)
        {
            dir = dir.normalized;

            if (type == ProjectileControllerType.Normal)
            {
                ControlledPlayer.ShotsFired++;
                if (!_cooldownController.IsCoolingDown(CooldownType.NormalShot))
                {
                    gg_grab.volume = AudioManager.MasterVol * AudioManager.SFXVol;
                    if (AttachedObject == null)
                    {
                        SpawnProjectile(dir, DurationOfNormalGravityProjectile, ProjectileControllerType.Normal);
                        RandomizeSfx(gravGunFire, gravGunFireCave, 0);
                        _cooldownController.StartCooldown(CooldownType.NormalShot, () => { });
                    }
                    else
                    {
                        ChangeGORBGravityDirection(AttachedObject, dir);
                        var CGORB = AttachedObject.GetComponent <ControllableGravityObjectRigidBody>();
                        AttachedObject.GetComponent <ControllableGravityObjectRigidBody>().AttachedPlayer = null;
                        AttachedObject.GetComponent <ControllableGravityObjectRigidBody>().LaunchSfx();
                        DetachReticle();
                        CGORB.OnShot(this, CGORB);
                    }
                }
            }
            else if (type == ProjectileControllerType.Shotgun)
            {
                if (!_cooldownController.IsCoolingDown(CooldownType.ShotGunShot))
                {
                    ShotGunBlast(dir);
                    _cooldownController.StartCooldown(CooldownType.ShotGunShot, () => { });
                }
            }
            else if (type == ProjectileControllerType.Rocket)
            {
                if (!_cooldownController.IsCoolingDown(CooldownType.Rocket))
                {
                    SpawnProjectile(dir, DurationOfRocketGravityProjectile, ProjectileControllerType.Rocket);
                    RandomizeSfx(rocketLaunch, rocketLaunchCave, 1);
                    _cooldownController.StartCooldown(CooldownType.Rocket, () => { });
                }
            }
        }
    }
    public void SpawnProjectile(Vector2 dir, float secondsUntilDestroy, ProjectileControllerType type)
    {
        float xValue = dir.x;
        float yVlaue = dir.y;
        float angle  = Mathf.Rad2Deg * Mathf.Atan2(dir.y, dir.x);
        GravityGunProjectileController projectileClone = ProjectilePool.Instance.GetProjectile(ProjectilePool.ConvertProjectileControllerTypeToType(type));

        projectileClone.transform.position = Reticle.transform.position;
        projectileClone.Owner = this;
        projectileClone.SecondsUntilDestroy = secondsUntilDestroy;
        ChangeGORBGravityDirection(projectileClone.GetComponent <GravityObjectRigidBody>(), dir);
        projectileClone.GetComponent <GravityObjectRigidBody>().ChangeGravityScale(ShootSpeed);
        projectileClone.GetComponent <GravityObjectRigidBody>().ClearAllVelocities();
        projectileClone.transform.rotation = Quaternion.identity;
        projectileClone.transform.Rotate(0, 0, angle);
        projectileClone.OnShot();
    }