Ejemplo n.º 1
0
        public IEnumerator SpreadShot(int pellets)
        {
            slowWalkDisableTimer = 15f;
            GameCameras.instance.cameraShakeFSM.SendEvent("SmallShake");
            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);
            PlayGunSounds("Shotgun");

            float direction = HP_DirectionHandler.finalDegreeDirection;

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

                GameObject         bullet = HP_Prefabs.SpawnBullet(direction);
                HP_BulletBehaviour hpbb   = bullet.GetComponent <HP_BulletBehaviour>();
                hpbb.bulletDegreeDirection += UnityEngine.Random.Range(-20, 20);
                hpbb.pierce = PlayerData.instance.equippedCharm_13;
                bullet.transform.localScale = new Vector3(0.3f, 0.3f, 0.1f);

                Destroy(bullet, HP_Stats.bulletRange);
            }

            yield return(new WaitForSeconds(0.05f));

            isFiring = false;
        }
Ejemplo n.º 2
0
        public IEnumerator BurstShot(int burst)
        {
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            for (int i = 0; i < burst; i++)
            {
                HP_HeatHandler.IncreaseHeat(0.5f);

                GameObject bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);
                PlayGunSounds("rifle");
                Destroy(bullet, .2f);

                HP_Sprites.StartGunAnims();
                HP_Sprites.StartFlash();
                HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);
                yield return(new WaitForSeconds(0.12f)); //0.12f This yield will determine the time inbetween shots

                if (h_state.dashing || h_state.jumping)
                {
                    break;
                }
            }
            isFiring             = false;
            isBursting           = false;
            slowWalkDisableTimer = 4f * burst;
        }
Ejemplo n.º 3
0
 public void StartTyphoon()
 {
     //Dung Crest cloud on slam
     if (PlayerData.instance.equippedCharm_10)
     {
         HP_Prefabs.SpawnObjectFromDictionary("Knight Dung Cloud", HeroController.instance.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
     }
     typhoonTimer = 25f;
 }
Ejemplo n.º 4
0
        public void OnDestroy()
        {
            Destroy(Instantiate(HP_Prefabs.bulletFadePrefab, gameObject.transform.position, gameObject.transform.localRotation), 0.03f); //bullet fade out sprite

            if (specialAttrib.Contains("Explosion") && PlayerData.instance.equippedCharm_17)
            {
                HP_Prefabs.prefabDictionary.TryGetValue("Knight Spore Cloud", out GameObject sporeCloud);
                GameObject sporeCloudGO = Instantiate(sporeCloud, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                sporeCloudGO.SetActive(true);
            }

            if (specialAttrib.Contains("DungExplosion"))
            {
                HP_Prefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion);
                GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                dungExplosionGO.SetActive(true);
                dungExplosionGO.name += " KnightMadeDungExplosion";

                if (specialAttrib.Contains("Small"))
                {
                    dungExplosionGO.transform.localScale = new Vector3(0.75f, 0.75f, 0);
                }
            }

            //If its from a grenade launch or a offensive fire support projectile, make it explode
            else if (gameObject.GetComponent <HP_BulletBehaviour>().specialAttrib.Contains("Explosion") || isFireSupportBullet)
            {
                GameObject explosionClone = HP_Prefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity);
                explosionClone.name += " KnightMadeExplosion";

                //Shrinks the explosion when its not a fire support bullet or its not an upgraded vengeful, as a nerf/downgrade
                if (isFireSupportBullet)
                {
                    HP_SpellControl.PlayAudio("mortarexplosion", true);
                }
                else if (PlayerData.instance.fireballLevel > 1)
                {
                    explosionClone.transform.localScale = new Vector3(1.3f, 1.3f, 0);
                }
                else
                {
                    explosionClone.transform.localScale = new Vector3(0.7f, 0.7f, 0);
                }
            }
        }
Ejemplo n.º 5
0
        public IEnumerator SingleShot()
        {
            HP_HeatHandler.IncreaseHeat(HP_Stats.heatPerShot);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            GameObject         bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);
            HP_BulletBehaviour hpbb   = bullet.GetComponent <HP_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 && (HP_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, HP_Stats.bulletRange + 3f);

            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);

            slowWalkDisableTimer = 10f;

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

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

            yield return(new WaitForSeconds(0.02f));

            isFiring = false;
        }
Ejemplo n.º 6
0
        public IEnumerator FireFlare()
        {
            airStrikeActive              = false;
            HP_Stats.currentPrimaryAmmo -= 1;
            HP_SpellControl.artifactActivatedEffect.SetActive(false);

            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
            GameObject bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);

            PlayGunSounds("flare");

            HP_BulletBehaviour bullet_behaviour = bullet.GetComponent <HP_BulletBehaviour>();

            bullet_behaviour.flareRound = true;

            HP_Sprites.StartGunAnims();
            HP_Sprites.StartFlash();
            HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);

            yield return(new WaitForSeconds(0.04f));

            isFiring = false;
        }
Ejemplo n.º 7
0
        public void SpawnFireball()
        {
            int soulCost = (PlayerData.instance.equippedCharm_33) ? 33 : 50;

            if (HP_WeaponHandler.currentGun.gunName == "Nail" || PlayerData.instance.fireballLevel == 0 || PlayerData.instance.MPCharge < soulCost)
            {
                HeroController.instance.spellControl.SetState("Inactive");
                return;
            }
            HeroController.instance.TakeMP(soulCost);
            HeroController.instance.spellControl.SetState("Spell End");

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

            directionMultiplier *= wallClimbMultiplier;
            GameObject bullet = HP_Prefabs.SpawnBullet(HP_DirectionHandler.finalDegreeDirection);

            bullet.SetActive(true);
            HP_BulletBehaviour hpbb = bullet.GetComponent <HP_BulletBehaviour>();

            hpbb.perfectAccuracy = true;
            bullet.GetComponent <BoxCollider2D>().size *= 1.5f;
            hpbb.bulletDegreeDirection = HP_DirectionHandler.finalDegreeDirection;
            hpbb.specialAttrib         = "Explosion";
            hpbb.bulletSpeedMult       = 2;

            HP_Prefabs.projectileSprites.TryGetValue("specialbullet.png", out Sprite specialBulletTexture);
            bullet.GetComponent <SpriteRenderer>().sprite = specialBulletTexture;

            //HP_Sprites.StartMuzzleFlash(HP_DirectionHandler.finalDegreeDirection);
            GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");

            PlayAudio("firerocket", true);

            HP_Sprites.StartGunAnims();
        }