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; }
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; }