Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        public void Awake()
        {
            if (instance == null)
            {
                instance = this;
            }

            StartCoroutine(AudioHandlerInit());
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        public void Update()
        {
            //Melee attack with the gun out



            if (WeaponSwapHandler.currentWeapon == WeaponType.Ranged && !isFiring && hc_instance.CanCast())
            {
                if (InputHandler.Instance.inputActions.dreamNail.WasPressed)
                {
                    //Log("Concussion Blast");
                    //Stats.StartBothCooldown();
                    //FireGun(FireModes.Concuss);
                    Log("[AttackHandler] Changing Firemode from : " + Stats.cardinalFiringMode + " to : " + !Stats.cardinalFiringMode);
                    Stats.ToggleFireMode();
                }
                else if (fireSpread && Stats.canFire)
                {
                    Stats.StartBothCooldown();
                    FireGun(FireModes.Spread);
                    //FireGun(FireModes.Burst);
                    fireSpread = false;
                }
                else if (OrientationHandler.heldAttack && Stats.canFire)
                {
                    Stats.StartBothCooldown();
                    FireGun(FireModes.Single);
                    //FireGun(FireModes.Burst);
                }
                else if (OrientationHandler.pressingAttack && Stats.canFire && false)
                {
                    if (Stats.currentPrimaryAmmo > 0)
                    {
                        //HP_Stats.ReduceAmmunition();
                        Stats.StartBothCooldown();
                        FireGun(FireModes.Spread);
                        //FireGun((PlayerData.instance.equippedCharm_11) ? FireModes.Spread : FireModes.Single);
                    }
                    else if (clickTimer <= 0)
                    {
                        clickTimer = 3f;
                        AudioHandler.PlaySoundsMisc("cantfire");
                    }
                }
            }
            else if (hc_instance.cState.superDashing && !isFiring && WeaponSwapHandler.currentWeapon == WeaponType.Ranged)
            {
                if (Stats.canFire && OrientationHandler.heldAttack)
                {
                    Stats.StartBothCooldown(30f);
                    StartCoroutine(FireGAU());
                    return;
                }
            }
            else if (!isFiring)
            {
                hc_instance.WALK_SPEED = 2.5f;
            }

            //TODO: Slow down the player while firing MOVE TO HP STATS LATER
            if (slowWalk)
            {
                h_state.inWalkZone = true;
            }
            else
            {
                h_state.inWalkZone = false;
            }
        }