public void State_CycloneSpin() { Stats.instance.enemyList.RemoveAll(enemy => enemy == null); Log("Enemy Count " + Stats.instance.enemyList.Count); //Array.ForEach<GameObject>(Stats.instance.enemyList.ToArray(), g => Log("GameObject Name Is " + g.name)); foreach (GameObject enemy in Stats.instance.enemyList) { Vector2 knightPos = HeroController.instance.transform.position; Vector2 enemyPos = enemy.transform.position; double angle = Math.Atan2(enemyPos.y - knightPos.y, enemyPos.x - knightPos.x) * 180 / Math.PI; Log("Throwing at " + angle); GameObject knife = HollowPointPrefabs.SpawnBulletFromKnight(120, DirectionalOrientation.Vertical); BulletBehaviour hpbb = knife.GetComponent <BulletBehaviour>(); hpbb.gunUsed = Stats.instance.currentEquippedGun; hpbb.bulletDamage = 3; hpbb.bulletDamageScale = 4; hpbb.noDeviation = true; hpbb.bulletOriginPosition = knife.transform.position; hpbb.bulletSpeed = 45f; hpbb.bulletDegreeDirection = (float)angle;//Range(0, HeroController.instance.cState.onGround ? 180 : 360); //hpbb.appliesDamageOvertime = true; hpbb.isDagger = true; hpbb.size = new Vector3(0.65f, 0.65f, 1); hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dagger; knife = AddDaggerTrail(knife); Destroy(knife, 60f); } Stats.instance.DisableNailArts(PlayerData.instance.equippedCharm_26 ? 12f : 18f); }
IEnumerator SpawnTyphoon(Vector3 spawnPos, float explosionAmount) { Modding.Logger.Log("Spawning Typhoon"); float degreeTotal = 0; float addedDegree = 180 / (explosionAmount + 1); GameObject dungCloud; for (int pulse = 0; pulse < 1; pulse++) { dungCloud = HollowPointPrefabs.SpawnObjectFromDictionary("Knight Spore Cloud", HeroController.instance.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity); dungCloud.transform.localScale = new Vector3(1.75f, 1.75f, 0); dungCloud.GetComponent <DamageEffectTicker>().SetAttr <float>("damageInterval", 0.2f); //DEFAULT: 0.15 } yield break; for (; explosionAmount > 0; explosionAmount--) { yield return(new WaitForEndOfFrame()); degreeTotal += addedDegree; GameObject typhoon_ball = Instantiate(HollowPointPrefabs.bulletPrefab, spawnPos, new Quaternion(0, 0, 0, 0)); BulletBehaviour hpbb = typhoon_ball.GetComponent <BulletBehaviour>(); hpbb.bulletDegreeDirection = degreeTotal; hpbb.specialAttrib = "DungExplosionSmall"; typhoon_ball.SetActive(true); //Destroy(typhoon_ball, Range(0.115f, 0.315f)); Destroy(typhoon_ball, Range(0.115f, 0.315f)); } yield return(null); }
//========================================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; }
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; }
void Start() { try { //Log("[DamageOverride:DamageOvertime] Awakening Damage Overtime"); stack = 1; damage = 1; tick = 0f; duration = 2f; hm = gameObject.GetComponent <HealthManager>(); Vector2 enemySize = gameObject.GetComponent <BoxCollider2D>().size; particles = HollowPointPrefabs.SpawnObjectFromDictionary("SpellParticlePrefab", gameObject.transform.position, Quaternion.identity); ParticlesController fpc = particles.AddComponent <ParticlesController>(); fpc.parent = gameObject; fpc.rateOverTimeMultiplier = 100; fpc.size = enemySize; particles.SetActive(true); particleSystem = particles.GetComponent <ParticleSystem>(); particleSystem.Stop(); //Log("ENEMY SIZE IS " + enemySize); //gameObject.GetComponent<SetParticleScale>().transform.localScale = enemySize - new Vector2(0.3f, 0.3f); } catch (Exception e) { Log("DamageOvertime " + e); } }
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; }
//State GSlash is called whenever the player is about to perform a great slash, use this to spawn the knives public void State_GSlash() { float startingDegree = HeroController.instance.cState.facingRight ? -25 : 155; AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.ThrowDaggerSFXGO); for (int k = 0; k < 5; k++) { GameObject knife = HollowPointPrefabs.SpawnBulletFromKnight(120, DirectionalOrientation.Horizontal); BulletBehaviour hpbb = knife.GetComponent <BulletBehaviour>(); hpbb.gunUsed = Stats.instance.currentEquippedGun; hpbb.bulletDamage = 2; hpbb.bulletDamageScale = 2; hpbb.noDeviation = true; hpbb.bulletOriginPosition = knife.transform.position; hpbb.bulletSpeed = 30f; hpbb.bulletDegreeDirection = startingDegree; //hpbb.appliesDamageOvertime = true; hpbb.isDagger = true; hpbb.piercesEnemy = true; startingDegree += 10; hpbb.size = new Vector3(0.65f, 0.65f, 1); hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dagger; knife = AddDaggerTrail(knife); Destroy(knife, 0.45f); } Stats.instance.DisableNailArts(PlayerData.instance.equippedCharm_26 ? 3f : 6f); }
//========================================SPELL METHODS==================================== public static IEnumerator ScreamAbility_SulphurStorm(int charges) { int burstAmount = 1 * charges; int shellsPerBurst = 6; float shellLifeTime = 0.06f; for (int burst = 0; burst < burstAmount; burst++) { //AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false); float waveRotation = 60; for (int shells = 0; shells < shellsPerBurst; shells++) { Vector3 knightPos = HeroController.instance.transform.position; GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(waveRotation + Range(-10f, 10f), knightPos, 0); BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>(); hpbb.ignoreAllCollisions = true; hpbb.bulletSpeed = 70f; hpbb.size = new Vector2(0.6f, 0.7f); hpbb.bulletSprite = BulletBehaviour.BulletSpriteType.dung; shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.DungGas; shell.SetActive(true); Destroy(shell, shellLifeTime); shellLifeTime += 0.01f; waveRotation += 60; yield return(new WaitForSeconds(0.08f)); } //yield return new WaitForSeconds(1f); } }
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; } } }
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; }
public void OnDestroy() { bulletTrailClone.transform.parent = null; Destroy(bulletTrailClone, 1f); //just to make sure theres no lingering game objects in the background Destroy(Instantiate(HollowPointPrefabs.bulletFadePrefab, gameObject.transform.position + new Vector3(0, 0, -0.5f), gameObject.transform.localRotation), 0.03f); //bullet fade out sprite if (specialAttrib.Contains("Explosion") && PlayerData.instance.equippedCharm_17) { //HollowPointPrefabs.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")) { HollowPointPrefabs.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.6f, 0.6f, 0); } } //If its from a grenade launch or a offensive fire support projectile, make it explode else if (gameObject.GetComponent <BulletBehaviour>().specialAttrib.Contains("Explosion") || isFireSupportBullet) { GameObject explosionClone = HollowPointPrefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity); explosionClone.name += " KnightMadeExplosion"; if (false) { for (int shrap = 0; shrap <= 5; shrap++) { GameObject bul = HollowPointPrefabs.SpawnBulletAtCoordinate(rand.Next(0, 360), gameObject.transform.position, 6); bul.GetComponent <BulletBehaviour>().specialAttrib = "DungExplosion"; } } //Shrinks the explosion when its not a fire support bullet or its not an upgraded vengeful, as a nerf/downgrade if (isFireSupportBullet) { SpellControlOverride.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); } } }
public void OnDestroy() { if (explosionType == ExplosionType.DungGas) { HollowPointPrefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion); GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -1.5f), Quaternion.identity); dungExplosionGO.SetActive(true); dungExplosionGO.name += " KnightMadeDungExplosion"; HollowPointPrefabs.prefabDictionary.TryGetValue("Knight Dung Cloud", out GameObject sporeCloud); GameObject sporeCloudGO = Instantiate(sporeCloud, gameObject.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity); sporeCloudGO.SetActive(true); AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.DiveDetonateSFXGO); } if (explosionType == ExplosionType.DungExplosion || explosionType == ExplosionType.DungExplosionSmall) { HollowPointPrefabs.prefabDictionary.TryGetValue("Dung Explosion", out GameObject dungExplosion); GameObject dungExplosionGO = Instantiate(dungExplosion, gameObject.transform.position + new Vector3(0, 0, -1.5f), Quaternion.identity); dungExplosionGO.SetActive(true); dungExplosionGO.name += " KnightMadeDungExplosion"; if (explosionType == ExplosionType.DungExplosionSmall) { dungExplosionGO.transform.localScale = new Vector3(0.6f, 0.6f, -1); } } //If its from a grenade launch or a offensive fire support projectile, make it explode else if (explosionType == ExplosionType.GasExplosion || explosionType == ExplosionType.ArtilleryShell) { Log("ARTILLERY!"); GameObject explosionClone = HollowPointPrefabs.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 (explosionType == ExplosionType.ArtilleryShell) { AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarExplosionSFXGO); //StartCoroutine(SpawnCluster()); for (int shrapnel = 0; shrapnel < 6; shrapnel++) { GameObject s = HollowPointPrefabs.SpawnBulletAtCoordinate(UnityEngine.Random.Range(190, 350), gameObject.transform.position, 1); s.AddComponent <BulletIsExplosive>().explosionType = ExplosionType.DungExplosion; Destroy(s, 1f); } } 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); } } }
//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; }
void Update() { if (OrientationHandler.pressingAttack && typhoonTimer > 0) { typhoonTimer = -1; int pelletAmnt = (PlayerData.instance.quakeLevel == 2) ? 8 : 6; GameObject explosionClone = HollowPointPrefabs.SpawnObjectFromDictionary("Gas Explosion Recycle M", HeroController.instance.transform.position, Quaternion.identity); explosionClone.transform.localScale = new Vector3(1.5f, 1.5f, 1); //StartCoroutine(SpawnGasPulse(HeroController.instance.transform.position, pelletAmnt)); } }
//TODO: Create an "explosion component" to spawn on destroy instead of creating the object at the Destroy of the bullet public void OnDestroy() { if (bulletSprite != BulletSpriteType.soul) { return; } GameObject fireballImpact = HollowPointPrefabs.SpawnObjectFromDictionary("FireballImpact", gameObject.transform.position, Quaternion.identity); fireballImpact.transform.Rotate(0, 0, gameObject.transform.eulerAngles.z, 0); fireballImpact.transform.localScale = size - new Vector3(0, 0.50f, 0); Destroy(fireballImpact, 1.5f); }
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; }
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; }
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; }
//========================================FIRE SUPPORT SPAWN METHODS==================================== //Regular steel rain (non tracking) public static IEnumerator StartSteelRainNoTrack(Vector3 targetCoordinates, int totalShells) { int artyDirection = (HeroController.instance.cState.facingRight) ? 1 : -1; Modding.Logger.Log("SPELL CONTROL STEEL RAIN NO TRACKING"); float shellAimPosition = 5 * artyDirection; //Allows the shell to "walk" slowly infront of the player for (int shells = 0; shells < totalShells; shells++) { //GameObject shell = Instantiate(HollowPointPrefabs.bulletPrefab, targetCoordinates + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0)); GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, HeroController.instance.transform.position + new Vector3(shellAimPosition, 30, -0.1f), 0); shellAimPosition += 3 * artyDirection; BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>(); hpbb.isFireSupportBullet = true; hpbb.ignoreCollisions = true; hpbb.targetDestination = targetCoordinates + new Vector3(0, Range(3f, 6f), -0.1f); shell.SetActive(true); yield return(new WaitForSeconds(0.5f)); } }
public static IEnumerator QuakeAbility_DangerClose(int charges) { int totalShells = 3 * charges; Vector3 knightPos = HeroController.instance.transform.position; AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false); yield return(new WaitForSeconds(0.65f)); for (int shells = 0; shells < totalShells; shells++) { //GameObject shell = Instantiate(HollowPointPrefabs.bulletPrefab, targetCoordinates + new Vector3(Range(-5, 5), Range(25, 50), -0.1f), new Quaternion(0, 0, 0, 0)); GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, knightPos + new Vector3(Range(-6, 6), 80, -1f), 0); BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>(); hpbb.fuseTimerXAxis = true; hpbb.targetDestination = knightPos + new Vector3(0, Range(2f, 7f), -0.1f); hpbb.ignoreAllCollisions = true; shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.DungExplosion; shell.SetActive(true); yield return(new WaitForSeconds(0.05f)); } }
IEnumerator QuakeAbility_SporeRelease(int charges) { Vector3 spawnPos = HeroController.instance.transform.position; float pulseAmount = 2 * charges; Log("Spawning Gas Pulse"); AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.DiveDetonateSFXGO); GameObject dungCloud; float cloudIntensity = (PlayerData.instance.equippedCharm_10) ? 0.11f : 0.15f; //DEFAULT: 0.15 for (int pulse = 0; pulse < pulseAmount; pulse++) { dungCloud = HollowPointPrefabs.SpawnObjectFromDictionary("Knight Spore Cloud", HeroController.instance.transform.position + new Vector3(0, 0, -.001f), Quaternion.identity); dungCloud.transform.localScale = new Vector3(2f, 2f, 0); dungCloud.GetComponent <DamageEffectTicker>().SetAttr <float>("damageInterval", cloudIntensity); yield return(new WaitForSeconds(0.80f)); } yield break; }
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; }
public IEnumerator QuakeAbility_BulletSpray(int charges) { AudioHandler.instance.PlayGunSoundEffect("gatlinggun"); for (int i = 0; i < 10 * charges; i++) { float degreeDeviation = Range(0, 180); GameObject bullet = HollowPointPrefabs.SpawnBulletFromKnight(Range(0, 180), DirectionalOrientation.Center); BulletBehaviour hpbb = bullet.GetComponent <BulletBehaviour>(); hpbb.gunUsed = Stats.instance.currentEquippedGun; hpbb.bulletDamage = 2; hpbb.bulletDamageScale = 1; hpbb.noDeviation = true; hpbb.bulletOriginPosition = bullet.transform.position; hpbb.bulletSpeed = 50f; hpbb.bulletDegreeDirection = degreeDeviation; hpbb.piercesEnemy = true; //hpbb.piercesWalls = true; hpbb.size = new Vector3(1f, 0.65f, 1); Destroy(bullet, 0.25f); yield return(new WaitForSeconds(0.01f)); } }
public static IEnumerator ScreamAbility_CreepingAirburst(int charges) { Vector3 targetCoordinates = HeroController.instance.transform.position; int totalShells = 2 + 1 * charges; int artyDirection = (HeroController.instance.cState.facingRight) ? 1 : -1; float shellAimPosition = 5 * artyDirection; //Allows the shell to "walk" slowly infront of the player AudioHandler.instance.PlayMiscSoundEffect(AudioHandler.HollowPointSoundType.MortarWhistleSFXGO, alteredPitch: false); yield return(new WaitForSeconds(0.65f)); for (int shells = 0; shells < totalShells; shells++) { GameObject shell = HollowPointPrefabs.SpawnBulletAtCoordinate(270, HeroController.instance.transform.position + new Vector3(shellAimPosition, 80, -1f), 0); shellAimPosition += 2 * artyDirection; BulletBehaviour hpbb = shell.GetComponent <BulletBehaviour>(); hpbb.fuseTimerXAxis = true; hpbb.ignoreAllCollisions = true; hpbb.targetDestination = targetCoordinates + new Vector3(0, Range(5f, 6f), -0.1f); //shell.AddComponent<BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.ArtilleryShell; shell.AddComponent <BulletIsExplosive>().explosionType = BulletIsExplosive.ExplosionType.ArtilleryShell; shell.SetActive(true); yield return(new WaitForSeconds(0.30f)); } }
public void CharmUpdate(PlayerData data, HeroController controller) { if (furyParticle == null) { furyParticle = HollowPointPrefabs.SpawnObjectFromDictionary("FuryParticlePrefab", HeroController.instance.transform); furyParticle.SetActive(false); } if (furyBurst == null) { furyBurst = HollowPointPrefabs.SpawnObjectFromDictionary("FuryBurstPrefab", HeroController.instance.transform); furyBurst.SetActive(false); } Log("Charm Update Called"); //Initialise stats currentEquippedGun = WeaponSwapAndStatHandler.instance.EquipWeapon(); current_weapon = currentEquippedGun.gunName; current_class = currentEquippedGun.gunSubClass; current_damagePerShot = currentEquippedGun.damageBase; current_damagePerLevel = currentEquippedGun.damageScale; current_energyGainOnHit = currentEquippedGun.energyGainOnHit; current_bulletLifetime = currentEquippedGun.bulletLifetime; current_boostMultiplier = currentEquippedGun.boostMultiplier; current_bulletVelocity = currentEquippedGun.bulletVelocity; current_fireRateCooldown = currentEquippedGun.fireRate; current_soulCostPerShot = currentEquippedGun.soulCostPerShot; current_heatPerShot = currentEquippedGun.heatPerShot; current_soulGainedPerHit = currentEquippedGun.soulGainOnHit; current_soulGainedPerKill = currentEquippedGun.soulGainOnHit; current_soulRegenSpeed = currentEquippedGun.soulRegenSpeed; current_minWeaponSpreadFactor = currentEquippedGun.minWeaponSpreadFactor; current_walkSpeed = 3f; current_class = WeaponSwapAndStatHandler.instance.ChangeClass(current_class); if (pd_instance.equippedCharm_6) //Fury of the Fallen { current_soulGainedPerKill += 10; current_soulRegenSpeed -= 0.10f; current_energyGainOnHit *= 2; } if (pd_instance.equippedCharm_19) //Shaman Stone { current_fireRateCooldown *= 0.75f; current_heatPerShot += 10; } if (pd_instance.equippedCharm_21) //Soul Eater { current_soulGainedPerKill += 24; current_soulGainedPerHit += 3; current_soulRegenSpeed -= 0.015f; current_heatPerShot += 15; current_minWeaponSpreadFactor += 3; } if (pd_instance.equippedCharm_25) //Strength { current_damagePerShot += 3; current_damagePerLevel += 2; current_fireRateCooldown *= 0.75f; current_heatPerShot += 15f; } Log("currentFireCooldown " + current_fireRateCooldown); if (pd_instance.equippedCharm_28) //Shape of Unn { current_bulletVelocity *= 1.2f; current_heatPerShot -= 10; current_minWeaponSpreadFactor -= 3; } if (pd_instance.equippedCharm_27) //Joni { current_soulRegenSpeed -= 0.033f; } //Dash Master if (pd_instance.equippedCharm_31) { current_boostMultiplier *= 1.35f; } //Spell Twister if (pd_instance.equippedCharm_33) { current_soulCostPerShot = (int)(current_soulCostPerShot * 0.75f); } if (pd_instance.equippedCharm_7) { current_energyGainOnHit = (int)(current_energyGainOnHit * 1.5f); } current_energyRequirement = (pd_instance.equippedCharm_34) ? 140 : 100; //Deep Focus current_energyPenalty = (pd_instance.equippedCharm_23) ? 0.7f : 0.5f; // Fragile Heart if (pd_instance.equippedCharm_24) //Fragile Greed { current_soulGainedPerKill *= 3; current_soulGainedPerHit *= 0; current_soulRegenTimer *= 2f; current_fireRateCooldown *= 0.80f; } recentlyKilledTimer = 0; hc_instance.NAIL_CHARGE_TIME_DEFAULT = 0.75f; //Charge Abilities adrenalineCharges = 0; adrenalineEnergy = 0; heal_ChargesDecayTimer = 0; adenalineCooldownTimer = 0; adrenalineOnCooldown = false; fireModeIcon?.Invoke("hudicon_omni.png"); adrenalineChargeIcons?.Invoke("0"); nailArtIcon?.Invoke("true"); PlayerData.instance.focusMP_amount = current_soulCostPerShot; //Minimum value setters, NOTE: soul cost doesnt like having it at 1 so i set it up as 2 minimum if (current_soulCostPerShot < 2) { current_soulCostPerShot = 2; } if (current_walkSpeed < 1) { current_walkSpeed = 1; } if (current_fireRateCooldown < 0.01f) { current_fireRateCooldown = 0.05f; } if (current_soulRegenSpeed < 0.01f) { current_soulRegenSpeed = 0.005f; } if (current_bulletVelocity > 80) { current_bulletVelocity = 80; } if (current_heatPerShot < 1) { current_heatPerShot = 1; } if (current_minWeaponSpreadFactor < 1) { current_minWeaponSpreadFactor = 1; } }
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); }
public void Start() { rb2d = GetComponent <Rigidbody2D>(); bc2d = GetComponent <BoxCollider2D>(); bulletSpriteRenderer = GetComponent <SpriteRenderer>(); bc2d.enabled = !ignoreAllCollisions; gameObject.tag = "Wall Breaker"; // +---| Bullet Origin for Distance Calculation |---+ bulletOriginPosition = gameObject.transform.position; //float size = bulletSizeOverride; gameObject.transform.localScale = size; bc2d.size = size;//Collider size // +---| Air Strike Bullet Modifier |---+ if (fuseTimerXAxis) { HollowPointPrefabs.projectileSprites.TryGetValue("specialbullet.png", out Sprite fireSupportBulletSprite); bulletSpriteRenderer.sprite = fireSupportBulletSprite; bulletSpeed = 120; } /* * else if (isDagger) * { * //HollowPointPrefabs.projectileSprites.TryGetValue("daggerSprite.png", out Sprite fireSupportBulletSprite); * //bulletSprite.sprite = fireSupportBulletSprite; * bulletSpriteRenderer.sprite = HollowPointPrefabs.projectileSprites["bullet_daggerSprite.png"]; * } */ if (!bulletSprite.Equals(BulletSpriteType.soul)) { bulletSpriteRenderer.sprite = HollowPointPrefabs.projectileSprites["sprite_bullet_" + bulletSprite.ToString() + ".png"]; } //Particle Effects if (enableSoulParticles) { string particlePrefabName = (useDefaultParticles) ? "SpellParticlePrefab" : "GrimmParticlePrefab"; GameObject fireballParticles = HollowPointPrefabs.SpawnObjectFromDictionary(particlePrefabName, gameObject.transform.position, Quaternion.identity); fireballParticles.AddComponent <ParticlesController>().parent = gameObject; //fireballParticles.GetComponent<ParticlesController>().size = bullet.size; fireballParticles.SetActive(true); } // +---| Bullet Heat |---+ float deviationFromHeat = (noHeat) ? 0 : (float)Math.Pow(HeatHandler.currentHeat, 2f) / 500; //exponential deviationFromHeat *= (PlayerData.instance.equippedCharm_37) ? 1.25f : 1.15f; //Increase movement penalty when equipping sprint master deviationFromHeat -= (PlayerData.instance.equippedCharm_14 && HeroController.instance.cState.onGround) ? 18 : 0; //Decrease innacuracy when on ground and steady body is equipped float deviation = (perfectAccuracy) ? 0 : (deviationFromHeat); deviation = Mathf.Clamp(deviation, 0, 20); //just set up the minimum value, bullets starts acting weird when deviation is negative //deviation = (deviation < 0) ? 0 : deviation; // +---| Bullet Spread and Recoil |---+ //a moving pivot for where the bullet can spread, with its maximum and minimum deviation, this allows the bullet to smoothly spread instead of being just random bulletPivot = Mathf.Clamp(bulletPivot, deviation * -1, deviation); //Clamps the max/min deviation, shrinking the cone of fire //float bulletPivotDelta = rand.Next(0, 2) * 2 - 1; //gives either -1 or 1 bulletBias = !bulletBias; float bulletPivotDelta = (bulletBias) ? 1 : -1; bulletPivotDelta = (bulletPivot >= deviation || bulletPivot <= (deviation * -1)) ? bulletPivotDelta * -1 : bulletPivotDelta; bulletPivot += bulletPivotDelta * rand.Next(Stats.instance.current_minWeaponSpreadFactor, Stats.instance.current_minWeaponSpreadFactor + 5); //1 can be changed by the amount of distance each bullet deviation should have float degree = bulletDegreeDirection + Mathf.Clamp(bulletPivot, deviation * -1, deviation);; float radian = (float)(degree * Math.PI / 180); xDeg = bulletSpeed * Math.Cos(radian) * bulletSpeedMult; yDeg = bulletSpeed * Math.Sin(radian) * bulletSpeedMult; //Changes the degree of bullet sprite rotation and the bullet direction when wall sliding if (HeroController.instance.cState.wallSliding) { xDeg *= -1; degree = (HeroController.instance.cState.facingRight) ? ((degree <= 90 ? 180 : -180) - degree) : (180 - degree); } rb2d.velocity = new Vector2((float)xDeg, (float)yDeg); //Bullet speed bulletSpriteRenderer.transform.Rotate(0, 0, degree, 0); //Bullet rotation }