//========================================SECONDARY FIRE METHODS====================================

        public IEnumerator FireGAU(int rounds)
        {
            AttackHandler.isFiring = true;
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            //float direction = (hc_instance.cState.facingRight) ? 315 : 225;
            //DirectionalOrientation orientation = DirectionalOrientation.Diagonal;
            float direction = OrientationHandler.finalDegreeDirection;
            DirectionalOrientation orientation = OrientationHandler.directionOrientation;

            AudioHandler.instance.PlayGunSoundEffect("gatlinggun");
            for (int b = 0; b < rounds; b++)
            {
                GameObject bullet = HollowPointPrefabs.SpawnBulletFromKnight(direction, orientation);
                HeatHandler.IncreaseHeat(15f);
                BulletBehaviour hpbb = bullet.GetComponent <BulletBehaviour>();
                bullet.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.DungExplosionSmall;
                hpbb.bulletOriginPosition = bullet.transform.position; //set the origin position of where the bullet was spawned
                //hpbb.specialAttrib = "DungExplosionSmall";
                hpbb.bulletSpeed = 40;

                HollowPointSprites.StartGunAnims();
                HollowPointSprites.StartFlash();
                HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);

                Destroy(bullet, 4f);
                yield return(new WaitForSeconds(0.03f)); //0.12f This yield will determine the time inbetween shots
            }

            yield return(new WaitForSeconds(0.02f));

            AttackHandler.isFiring = false;
        }
        public void State_CycloneSpin()
        {
            Stats.instance.enemyList.RemoveAll(enemy => enemy == null);
            Log("Enemy Count " + Stats.instance.enemyList.Count);
            //Array.ForEach<GameObject>(Stats.instance.enemyList.ToArray(), g => Log("GameObject Name Is " + g.name));

            foreach (GameObject enemy in Stats.instance.enemyList)
            {
                Vector2 knightPos = HeroController.instance.transform.position;
                Vector2 enemyPos  = enemy.transform.position;
                double  angle     = Math.Atan2(enemyPos.y - knightPos.y, enemyPos.x - knightPos.x) * 180 / Math.PI;
                Log("Throwing at " + angle);
                GameObject      knife = HollowPointPrefabs.SpawnBulletFromKnight(120, DirectionalOrientation.Vertical);
                BulletBehaviour hpbb  = knife.GetComponent <BulletBehaviour>();
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.bulletDamage          = 3;
                hpbb.bulletDamageScale     = 4;
                hpbb.noDeviation           = true;
                hpbb.bulletOriginPosition  = knife.transform.position;
                hpbb.bulletSpeed           = 45f;
                hpbb.bulletDegreeDirection = (float)angle;//Range(0, HeroController.instance.cState.onGround ? 180 : 360);
                //hpbb.appliesDamageOvertime = true;
                hpbb.isDagger     = true;
                hpbb.size         = new Vector3(0.65f, 0.65f, 1);
                hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dagger;
                knife             = AddDaggerTrail(knife);
                Destroy(knife, 60f);
            }

            Stats.instance.DisableNailArts(PlayerData.instance.equippedCharm_26 ? 12f : 18f);
        }
        //State GSlash is called whenever the player is about to perform a great slash, use this to spawn the knives
        public void State_GSlash()
        {
            float startingDegree = HeroController.instance.cState.facingRight ? -25 : 155;

            AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.ThrowDaggerSFXGO);
            for (int k = 0; k < 5; k++)
            {
                GameObject      knife = HollowPointPrefabs.SpawnBulletFromKnight(120, DirectionalOrientation.Horizontal);
                BulletBehaviour hpbb  = knife.GetComponent <BulletBehaviour>();
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.bulletDamage          = 2;
                hpbb.bulletDamageScale     = 2;
                hpbb.noDeviation           = true;
                hpbb.bulletOriginPosition  = knife.transform.position;
                hpbb.bulletSpeed           = 30f;
                hpbb.bulletDegreeDirection = startingDegree;
                //hpbb.appliesDamageOvertime = true;
                hpbb.isDagger     = true;
                hpbb.piercesEnemy = true;
                startingDegree   += 10;
                hpbb.size         = new Vector3(0.65f, 0.65f, 1);
                hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dagger;
                knife             = AddDaggerTrail(knife);

                Destroy(knife, 0.45f);
            }

            Stats.instance.DisableNailArts(PlayerData.instance.equippedCharm_26 ? 3f : 6f);
        }
Esempio n. 4
0
        public IEnumerator VoidSpikes()
        {
            isFiring = true;
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            DirectionalOrientation orientation = DirectionalOrientation.Center;

            float rotation = 0;

            for (int b = 0; b < 15; b++)
            {
                GameObject      bullet = HollowPointPrefabs.SpawnBulletFromKnight(rotation, orientation);
                BulletBehaviour hpbb   = bullet.GetComponent <BulletBehaviour>();
                hpbb.bulletDamage          = 1;
                hpbb.bulletDamageScale     = 1;
                hpbb.noDeviation           = true;
                hpbb.canGainEnergyCharges  = false;
                hpbb.bulletOriginPosition  = HeroController.instance.transform.position;
                hpbb.bulletSpeed           = 10;
                hpbb.bulletDegreeDirection = rotation;
                hpbb.enableSoulParticles   = false;
                hpbb.piercesEnemy          = true;
                hpbb.playSoundOnSurfaceHit = false;
                hpbb.size         = new Vector3(0.65f, 0.65f, 1);
                hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.voids;

                rotation += 24;
                Destroy(bullet, 4f);
            }

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
Esempio n. 5
0
        public IEnumerator BurstShot(int burst)
        {
            hc_instance.TakeMP(Stats.instance.SoulCostPerShot());
            HeatHandler.IncreaseHeat(15);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            float direction = OrientationHandler.finalDegreeDirection;
            DirectionalOrientation orientation = OrientationHandler.directionOrientation;

            for (int i = 0; i < burst; i++)
            {
                GameObject      bullet = HollowPointPrefabs.SpawnBulletFromKnight(direction, orientation);
                BulletBehaviour hpbb   = bullet.GetComponent <BulletBehaviour>();
                hpbb.bulletDamage          = Stats.instance.current_damagePerShot;
                hpbb.bulletDamageScale     = Stats.instance.current_damagePerLevel;
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.noDeviation           = (PlayerData.instance.equippedCharm_14 && HeroController.instance.cState.onGround) ? true : false;
                hpbb.piercesEnemy          = PlayerData.instance.equippedCharm_13;
                hpbb.bulletOriginPosition  = bullet.transform.position;
                hpbb.bulletSpeed           = Stats.instance.current_bulletVelocity;
                hpbb.bulletDegreeDirection = direction;
                hpbb.size = Stats.instance.currentEquippedGun.bulletSize;

                bool sapperBuffs = (Stats.instance.current_class == WeaponSubClass.SABOTEUR && Stats.instance.infusionActivated);
                hpbb.appliesDamageOvertime = (Stats.instance.infusionActivated && PlayerData.instance.equippedCharm_35);
                hpbb.bulletSpeed           = (sapperBuffs) ? Stats.instance.current_bulletVelocity * 1.20f : Stats.instance.current_bulletVelocity;
                hpbb.piercesEnemy          = (PlayerData.instance.equippedCharm_25);

                AudioHandler.instance.PlayGunSoundEffect(Stats.instance.currentEquippedGun.gunName.ToString());
                HollowPointSprites.StartGunAnims();
                HollowPointSprites.StartFlash();
                HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);

                Destroy(bullet, Stats.instance.current_bulletLifetime);

                yield return(new WaitForSeconds(0.055f));

                isFiring = false;

                if (h_state.dashing)
                {
                    break;
                }
            }
            HeatHandler.IncreaseHeat(Stats.instance.current_heatPerShot);

            isFiring = false;
        }
Esempio n. 6
0
        public IEnumerator SpreadShot()
        {
            hc_instance.TakeMP(Stats.instance.SoulCostPerShot());
            //HeatHandler.IncreaseHeat(50);
            GameCameras.instance.cameraShakeFSM.SendEvent("SmallShake");
            int   pellets           = 6;
            float coneSpread        = 40;
            float coneSpreadDelta   = coneSpread / (pellets + 1);
            float direction         = OrientationHandler.finalDegreeDirection;
            float coneStart         = direction - (coneSpread / 2);
            float pelletSpawnDegree = coneStart + coneSpreadDelta;

            DirectionalOrientation orientation = OrientationHandler.directionOrientation;

            AudioHandler.instance.PlayGunSoundEffect(Stats.instance.currentEquippedGun.gunName.ToString());
            HollowPointSprites.StartGunAnims();
            HollowPointSprites.StartFlash();
            HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);

            for (int i = 0; i < pellets; i++)
            {
                GameObject      bullet = HollowPointPrefabs.SpawnBulletFromKnight(direction, orientation);
                BulletBehaviour hpbb   = bullet.GetComponent <BulletBehaviour>();
                hpbb.bulletDamage          = Stats.instance.current_damagePerShot;
                hpbb.bulletDamageScale     = Stats.instance.current_damagePerLevel;
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.bulletOriginPosition  = bullet.transform.position;
                hpbb.bulletSpeed           = Stats.instance.current_bulletVelocity;
                hpbb.bulletDegreeDirection = pelletSpawnDegree + UnityEngine.Random.Range(-3f, 3f);;  //direction + UnityEngine.Random.Range(-20f, 20f);
                pelletSpawnDegree         += coneSpreadDelta;
                hpbb.size         = Stats.instance.currentEquippedGun.bulletSize;
                hpbb.piercesEnemy = true;

                bool sapperBuffs = (Stats.instance.current_class == WeaponSubClass.SABOTEUR && Stats.instance.infusionActivated);
                hpbb.appliesDamageOvertime = (Stats.instance.infusionActivated && PlayerData.instance.equippedCharm_35);
                hpbb.bulletSpeed           = (sapperBuffs) ? Stats.instance.current_bulletVelocity * 1.20f : Stats.instance.current_bulletVelocity;

                Destroy(bullet, Stats.instance.current_bulletLifetime + UnityEngine.Random.Range(-0.03f, 0.03f));
            }
            //HeatHandler.IncreaseHeat(Stats.instance.current_heatPerShot);

            yield return(null);

            isFiring = false;
        }
        public IEnumerator QuakeAbility_BulletSpray(int charges)
        {
            AudioHandler.instance.PlayGunSoundEffect("gatlinggun");
            for (int i = 0; i < 10 * charges; i++)
            {
                float           degreeDeviation = Range(0, 180);
                GameObject      bullet          = HollowPointPrefabs.SpawnBulletFromKnight(Range(0, 180), DirectionalOrientation.Center);
                BulletBehaviour hpbb            = bullet.GetComponent <BulletBehaviour>();
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.bulletDamage          = 2;
                hpbb.bulletDamageScale     = 1;
                hpbb.noDeviation           = true;
                hpbb.bulletOriginPosition  = bullet.transform.position;
                hpbb.bulletSpeed           = 50f;
                hpbb.bulletDegreeDirection = degreeDeviation;
                hpbb.piercesEnemy          = true;
                //hpbb.piercesWalls = true;
                hpbb.size = new Vector3(1f, 0.65f, 1);
                Destroy(bullet, 0.25f);

                yield return(new WaitForSeconds(0.01f));
            }
        }
        public IEnumerator ScreamAbility_SparkingBullets(int charges)
        {
            int        sparkAmount  = 20 * charges;
            GameObject closestEnemy = null;

            while (sparkAmount > 0)
            {
                yield return(new WaitForSeconds(0.12f));

                Stats.instance.enemyList.RemoveAll(enemy => enemy == null);

                //Create a list of valid targets from the enemy list, meaning anyone closer than 10 units
                List <GameObject> validTargets = new List <GameObject>();
                while (Stats.instance.enemyList.Count <= 0 || HeroController.instance.cState.transitioning)
                {
                    yield return(null);
                }
                foreach (GameObject enemy in Stats.instance.enemyList)
                {
                    Vector2 knightPos = HeroController.instance.transform.position;
                    Vector2 enemyPos  = enemy.transform.position;
                    float   enemyDistanceFromKnight = Vector3.Distance(knightPos, enemyPos);
                    if (enemyDistanceFromKnight < 8)
                    {
                        validTargets.Add(enemy);
                    }
                }

                if (validTargets.Count <= 0)
                {
                    continue;                          //If there is no valid tagets, start all over again;
                }
                //For each of the valid enemies, find the closest one to the knight
                closestEnemy = null;
                float closetEnemyDistance = float.MaxValue;
                foreach (GameObject validTarget in validTargets)
                {
                    Vector2 knightPos     = HeroController.instance.transform.position;
                    Vector2 enemyPos      = validTarget.transform.position;
                    float   enemyDistance = Vector3.Distance(knightPos, enemyPos);
                    if (Vector3.Distance(knightPos, enemyPos) < closetEnemyDistance)
                    {
                        closestEnemy        = validTarget;
                        closetEnemyDistance = enemyDistance;
                    }
                }

                Vector2 knightPos2        = HeroController.instance.transform.position;
                Vector2 enemyPos2         = closestEnemy.transform.position;
                double  fireBulletAtAngle = Math.Atan2(enemyPos2.y - knightPos2.y, enemyPos2.x - knightPos2.x) * 180 / Math.PI;

                AudioHandler.instance.PlayGunSoundEffect("shrapnel");
                GameObject      spark = HollowPointPrefabs.SpawnBulletFromKnight((float)fireBulletAtAngle, DirectionalOrientation.Center);
                BulletBehaviour hpbb  = spark.GetComponent <BulletBehaviour>();
                hpbb.gunUsed               = Stats.instance.currentEquippedGun;
                hpbb.bulletDamage          = 2;
                hpbb.bulletDamageScale     = 2;
                hpbb.noDeviation           = true;
                hpbb.bulletOriginPosition  = spark.transform.position;
                hpbb.bulletSpeed           = 40f;
                hpbb.bulletDegreeDirection = (float)fireBulletAtAngle + Range(-3, 3);
                hpbb.size         = new Vector3(0.8f, 0.8f, 1);
                hpbb.piercesWalls = true;
                Destroy(spark, 1);
                sparkAmount -= 1;

                HollowPointSprites.StartFlash();
            }
            yield return(null);
        }