IEnumerator ShootBulletLoop()
    {
        while (true)
        {
            SpawnFromPool(transform.position, transform.eulerAngles);

            BasicParticleScript script = objectToSpawn.GetComponent <BasicParticleScript>();

            float angleShot     = Vector2.Angle(transform.position, targetPoint);
            float horizontalVel = speed * Mathf.Cos(angleShot);
            float verticallVel  = speed * Mathf.Sin(angleShot);

            script.horiVel = horizontalVel;
            script.vertVel = verticallVel;

            yield return(new WaitForSeconds(1f));
        }
    }
    IEnumerator ShootBulletLoop()
    {
        while (true)
        {
            SpawnFromPool(transform.position, transform.eulerAngles);

            BasicParticleScript script = objectToSpawn.GetComponent <BasicParticleScript>();

            if (transform.eulerAngles.z == _rotDictionary["UP"] || transform.eulerAngles.z == _rotDictionary["DOWN"])
            {
                script.vertVel = (transform.eulerAngles.z == _rotDictionary["UP"]) ? script.velocity : -script.velocity;
            }
            else
            {
                script.horiVel = (transform.eulerAngles.z == _rotDictionary["RIGHT"]) ? script.velocity : -script.velocity;
            }

            yield return(new WaitForSeconds(0.7f));
        }
    }
    void HandleShooting()
    {
        if (canShoot[currentWep])
        {
            if (shootInput)
            {
                GameObject attack;
                //Debug.Log(aim);
                PoolerScript pS       = PoolerScript.instance;
                Vector3      rotation = Vector3.zero;
                string       tag      = attackPrefabs[currentWep].tag;
                Vector3      position;
                switch (aim)
                {
                case "right":
                    rotation.z = 0;
                    position   = attackSpawns[0].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = script.velocity;
                        script.vertVel = 0;
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "rightDown":
                    rotation.z = -45;
                    position   = attackSpawns[1].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = script.velocity * Mathf.Cos(45);
                        script.vertVel = -script.velocity * Mathf.Cos(45);
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "Down":
                    rotation.z = -90;
                    position   = attackSpawns[2].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = 0;
                        script.vertVel = -script.velocity;
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "leftDown":
                    rotation.z = -135;
                    position   = attackSpawns[3].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = -script.velocity * Mathf.Cos(45);
                        script.vertVel = -script.velocity * Mathf.Cos(45);
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "left":
                    rotation.z = -180;
                    position   = attackSpawns[4].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = -script.velocity;
                        script.vertVel = 0;
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.CancelInvoke("HideMe");
                        script.HideMe();
                    }
                    break;

                case "leftUp":
                    rotation.z = -225;
                    position   = attackSpawns[5].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = -script.velocity * Mathf.Cos(45);
                        script.vertVel = script.velocity * Mathf.Cos(45);
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "Up":
                    rotation.z = -270;
                    position   = attackSpawns[6].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = 0;
                        script.vertVel = script.velocity;
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                case "rightUp":
                    rotation.z = -315;
                    position   = attackSpawns[7].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = script.velocity * Mathf.Cos(45);
                        script.vertVel = script.velocity * Mathf.Cos(45);
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;

                default:
                    rotation.z = 0;
                    position   = attackSpawns[0].position;
                    pS.SpawnFromPool(tag, position, rotation);
                    attack = pS.objectToSpawn;
                    if (attack.name.Contains("Ranged"))
                    {
                        BasicParticleScript script = attack.GetComponent <BasicParticleScript>();
                        script.horiVel = script.velocity;
                        script.vertVel = 0;
                    }
                    if (attack.name.Contains("Melee"))
                    {
                        MeleeAttackScript script = attack.GetComponent <MeleeAttackScript>();
                        script.HideMe();
                    }
                    break;
                }
                //Debug.Log(rotation.z);
                canShoot[currentWep] = false;
                StartCoroutine(ReadyToShoot(currentWep));
            }
        }
    }