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
        //========================================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;
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 4
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.º 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 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;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
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.º 9
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.º 10
0
        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);
        }