//========================================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;
        }
Example #2
0
        public IEnumerator BurstShot(int burst)
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            for (int i = 0; i < burst; i++)
            {
                HeatHandler.IncreaseHeat(1.5f);

                float direction = OrientationHandler.finalDegreeDirection;
                DirectionalOrientation orientation = OrientationHandler.directionOrientation;
                GameObject             bullet      = HollowPointPrefabs.SpawnBullet(direction, orientation);

                AudioHandler.PlayGunSounds("rifle");
                Destroy(bullet, .4f);

                HollowPointSprites.StartGunAnims();
                HollowPointSprites.StartFlash();
                HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);
                yield return(new WaitForSeconds(0.08f)); //0.12f This yield will determine the time inbetween shots

                if (h_state.dashing)
                {
                    break;
                }
            }
            HeatHandler.IncreaseHeat(8f);
            isFiring             = false;
            slowWalkDisableTimer = 4f * burst;
        }
Example #3
0
        public IEnumerator BurstShot(int burst)
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");

            for (int i = 0; i < burst; i++)
            {
                //HeatHandler.IncreaseHeat(20f);
                AudioHandler.PlayGunSounds("rifle");
                float direction = OrientationHandler.finalDegreeDirection;
                DirectionalOrientation orientation = OrientationHandler.directionOrientation;
                GameObject             bullet      = HollowPointPrefabs.SpawnBullet(direction, orientation);
                bullet.GetComponent <BulletBehaviour>().bulletSizeOverride = 1.6f;

                Destroy(bullet, .4f);

                HollowPointSprites.StartGunAnims();
                HollowPointSprites.StartFlash();
                HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);
                yield return(new WaitForSeconds(0.07f)); //0.12f This yield will determine the time inbetween shots

                if (HeroController.instance.cState.dashing)
                {
                    break;
                }
            }
        }
Example #4
0
        public IEnumerator FireGAU()
        {
            isFiring = true;
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            float direction = (hc_instance.cState.facingRight)? 315 : 225;
            DirectionalOrientation orientation = DirectionalOrientation.Diagonal;

            for (int b = 0; b < 14; b++)
            {
                GameObject bullet = HollowPointPrefabs.SpawnBullet(direction, orientation);
                HeatHandler.IncreaseHeat(1.5f);
                BulletBehaviour hpbb = bullet.GetComponent <BulletBehaviour>();
                hpbb.bulletOriginPosition = bullet.transform.position; //set the origin position of where the bullet was spawned
                hpbb.specialAttrib        = "DungExplosionSmall";
                hpbb.bulletSpeedMult     += 1.5f;

                AudioHandler.PlayGunSounds("rifle");
                HollowPointSprites.StartGunAnims();
                HollowPointSprites.StartFlash();
                HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);

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

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
Example #5
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;
        }
Example #6
0
        //Delete soon, this is pretty much unused
        public IEnumerator ConcussShot()
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            HeatHandler.IncreaseHeat(1.1f);


            //set the origin position of where the bullet was spawned

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

            slowWalkDisableTimer = 14f;
            AudioHandler.PlayGunSounds("sniper");

            float direction = OrientationHandler.finalDegreeDirection; //90 degrees
            DirectionalOrientation orientation = OrientationHandler.directionOrientation;

            int   pellets                = 3;
            float coneDegree             = 15;
            float angleToSpawnBullet     = direction - (coneDegree / 2); //90 - (30 / 2) = 75, start at 75 degrees
            float angleIncreasePerPellet = coneDegree / (pellets + 2);   // 30 / (5 + 2) = 4.3, move angle to fire for every pellet by 4.3 degrees

            angleToSpawnBullet = angleToSpawnBullet + angleIncreasePerPellet;

            //Checks if the player is firing upwards, and enables the x offset so the bullets spawns directly ontop of the knight
            //from the gun's barrel instead of spawning to the upper right/left of them
            bool fixYOrientation = (direction == 270 || direction == 90) ? true : false;

            for (int i = 0; i < pellets; i++)
            {
                yield return(new WaitForEndOfFrame());

                GameObject      bullet = HollowPointPrefabs.SpawnBullet(angleToSpawnBullet, orientation);
                BulletBehaviour hpbb   = bullet.GetComponent <BulletBehaviour>();
                hpbb.fm = FireModes.Concuss;
                hpbb.bulletOriginPosition = bullet.transform.position;
                hpbb.pierce = true;
                //hpbb.pierce = PlayerData.instance.equippedCharm_13;
                bullet.transform.localScale = new Vector3(2f, 2f, 0.1f);


                angleToSpawnBullet += angleIncreasePerPellet;
                Destroy(bullet, 0.07f);
            }

            yield return(new WaitForSeconds(0.05f));

            isFiring = false;

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
        public static GameObject SpawnBulletFromKnight(float bulletDegreeDirection, DirectionalOrientation dirOrientation)
        {
            //SpawnObjectFromDictionary("FireballImpact", HeroController.instance.transform.position, Quaternion.identity);
            //Instantiate(fireballImpactPrefab, HeroController.instance.transform.position, Quaternion.identity).SetActive(true);

            bulletDegreeDirection = bulletDegreeDirection % 360;
            float directionOffsetY = 0;

            //If the player is aiming upwards, change the bullet offset of where it will spawn
            //Otherwise the bullet will spawn too high or inbetween the knight
            bool directionalOffSetBool = (dirOrientation == DirectionalOrientation.Vertical || dirOrientation == DirectionalOrientation.Diagonal);
            bool firingUpwards         = (bulletDegreeDirection > 0 && bulletDegreeDirection < 180);

            if (directionalOffSetBool && firingUpwards)
            {
                directionOffsetY = 0.8f;
            }
            else if (directionalOffSetBool && !firingUpwards)
            {
                directionOffsetY = -1.1f;
            }

            float directionMultiplierX = (HeroController.instance.cState.facingRight) ? 1f : -1f;
            float wallClimbMultiplier  = (HeroController.instance.cState.wallSliding) ? -1f : 1f;

            //Checks if the player is firing upwards/downwards, and enables the x offset so the bullets spawns directly ontop of the knight
            //from the gun's barrel instead of spawning to the upper right/left of them
            if (dirOrientation == DirectionalOrientation.Vertical)
            {
                directionMultiplierX = 0.2f * directionMultiplierX;
            }

            if (dirOrientation == DirectionalOrientation.Center)
            {
                directionMultiplierX = 0f;
                directionOffsetY     = 0f;
            }

            directionMultiplierX *= wallClimbMultiplier;

            GameObject bullet = Instantiate(bulletPrefab, HeroController.instance.transform.position + new Vector3(1.4f * directionMultiplierX, -0.7f + directionOffsetY, -0.002f), new Quaternion(0, 0, 0, 0));

            //BulletBehaviour bb = bullet.GetComponent<BulletBehaviour>();
            // bb.bulletDegreeDirection = bulletDegreeDirection;
            //bb.heatOnHit = HeatHandler.currentHeat;
            //bb.size = Stats.instance.currentWeapon.bulletSize;
            bullet.SetActive(true);

            return(bullet);
        }
Example #8
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;
        }
Example #9
0
        public void Update()
        {
            up             = InputHandler.Instance.inputActions.up;
            down           = InputHandler.Instance.inputActions.down;
            right          = InputHandler.Instance.inputActions.right;
            left           = InputHandler.Instance.inputActions.left;
            holdingAttack  = InputHandler.Instance.inputActions.attack.WasRepeated;
            pressingAttack = InputHandler.Instance.inputActions.attack.WasPressed;
            heldAttack     = InputHandler.Instance.inputActions.attack.IsPressed;
            facingRight    = HeroController.instance.cState.facingRight;

            finalDegreeDirection = facingRight ? 0 : 180;
            directionOrientation = DirectionalOrientation.Horizontal;

            if (!up && !down)
            {
                return;
            }

            finalDegreeDirection = up ? 90 : 270;
            directionOrientation = DirectionalOrientation.Vertical;

            if (!right && !left)
            {
                return;
            }

            int sign = (up ? 1 : -1) * (left ? 1 : -1);

            finalDegreeDirection += 45 * sign;

            if (finalDegreeDirection % 45 == 0)
            {
                directionOrientation = DirectionalOrientation.Diagonal;
            }

            if (Stats.cardinalFiringMode)
            {
                //If the player has activated cardinal only firing, disables diagonal degree direction
                directionOrientation = DirectionalOrientation.Vertical;
                finalDegreeDirection = (finalDegreeDirection >= 0 && finalDegreeDirection < 180) ? 90 : 270;
            }

            return;
        }
Example #10
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;
        }
Example #11
0
        public IEnumerator SingleShot()
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            HeatHandler.IncreaseHeat(20f);

            float direction = OrientationHandler.finalDegreeDirection;
            DirectionalOrientation orientation = OrientationHandler.directionOrientation;
            GameObject             bullet      = HollowPointPrefabs.SpawnBullet(direction, orientation);

            BulletBehaviour hpbb = bullet.GetComponent <BulletBehaviour>();

            hpbb.fm = FireModes.Single;

            //Charm 14 Steady Body
            hpbb.noDeviation = (PlayerData.instance.equippedCharm_14 && HeroController.instance.cState.onGround) ? true : false;
            //Charm 13 Mark of Pride gives perfect accuracy and pierce
            hpbb.perfectAccuracy = (PlayerData.instance.equippedCharm_13 && (HeatHandler.currentHeat < 10)) ? true : false;
            hpbb.pierce          = PlayerData.instance.equippedCharm_13;

            //set the origin position of where the bullet was spawned
            hpbb.bulletOriginPosition = bullet.transform.position;

            Destroy(bullet, 0.3f);

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

            slowWalkDisableTimer = 14f;

            string weaponType = PlayerData.instance.equippedCharm_13 ? "sniper" : "rifle";

            AudioHandler.PlayGunSounds("rifle");
            if (weaponType == "sniper")
            {
                bullet.transform.localScale = new Vector3(1.8f, 1.8f, 0.1f);
            }

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
Example #12
0
        public IEnumerator SpreadShot(int pellets)
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("SmallShake"); //SmallShake
            HollowPointSprites.StartGunAnims();
            HollowPointSprites.StartFlash();
            HollowPointSprites.StartMuzzleFlash(OrientationHandler.finalDegreeDirection, 1);
            AudioHandler.PlayGunSounds("Shotgun");

            float direction = OrientationHandler.finalDegreeDirection; //90 degrees
            DirectionalOrientation orientation = OrientationHandler.directionOrientation;

            float coneDegree             = 40;
            float angleToSpawnBullet     = direction - (coneDegree / 2); //90 - (30 / 2) = 75, start at 75 degrees
            float angleIncreasePerPellet = coneDegree / (pellets + 2);   // 30 / (5 + 2) = 4.3, move angle to fire for every pellet by 4.3 degrees

            angleToSpawnBullet = angleToSpawnBullet + angleIncreasePerPellet;

            //Checks if the player is firing upwards, and enables the x offset so the bullets spawns directly ontop of the knight
            //from the gun's barrel instead of spawning to the upper right/left of them
            bool fixYOrientation = (direction == 270 || direction == 90) ? true : false;

            for (int i = 0; i < pellets; i++)
            {
                yield return(new WaitForEndOfFrame());

                GameObject      bullet = HollowPointPrefabs.SpawnBullet(angleToSpawnBullet, orientation);
                BulletBehaviour hpbb   = bullet.GetComponent <BulletBehaviour>();
                hpbb.bulletDegreeDirection += UnityEngine.Random.Range(-3, 3);
                //hpbb.pierce = PlayerData.instance.equippedCharm_13;
                bullet.transform.localScale = new Vector3(0.2f, 0.2f, 0.1f);
                hpbb.specialAttrib          = "Explosion";

                angleToSpawnBullet += angleIncreasePerPellet;
                Destroy(bullet, 0.7f);
            }

            yield return(new WaitForSeconds(0.3f));

            AttackHandler.isFiring = false;
        }