private IEnumerator DelayedDestroyEnemy(AIActor enemy, tk2dSpriteAnimator vfxAnimator) { if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = false; vfxAnimator.sprite.HeightOffGround = -1f; } while (enemy && vfxAnimator && vfxAnimator.sprite.GetCurrentSpriteDef().name != "kthuliber_tentacles_010") { vfxAnimator.sprite.UpdateZDepth(); yield return(null); } if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = true; vfxAnimator.sprite.HeightOffGround = 1.5f; vfxAnimator.sprite.UpdateZDepth(); } this.enemiesToEat.Remove(enemy); if (enemy) { if (enemy.healthHaver != null && enemy.healthHaver.IsBoss) { enemy.healthHaver.ApplyDamage(100, Vector2.zero, "Erasure", CoreDamageTypes.None, DamageCategory.Unstoppable, true, null, true); } else { enemy.EraseFromExistence(false); } } yield break; }
private IEnumerator DelayedDestroyEnemy(AIActor enemy, tk2dSpriteAnimator vfxAnimator) { if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = false; vfxAnimator.sprite.HeightOffGround = -1f; } while (enemy && vfxAnimator && vfxAnimator.sprite.GetCurrentSpriteDef().name != "kthuliber_tentacles_010") { vfxAnimator.sprite.UpdateZDepth(); yield return(null); } if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = true; vfxAnimator.sprite.HeightOffGround = 1.5f; vfxAnimator.sprite.UpdateZDepth(); } if (enemy) { if (enemy.healthHaver.IsBoss) { AkSoundEngine.PostEvent("Play_WPN_kthulu_blast_01", enemy.gameObject); enemy.healthHaver.ApplyDamage(this.damageToBosses, Vector2.zero, "Being too Weak", CoreDamageTypes.None, DamageCategory.Unstoppable, true, null, this.bossDamageIgnoresDamageCap); } else { enemy.EraseFromExistence(false); } } yield break; }
private void ProcessEnemy(AIActor target, float distance) { PlayerController player = this.gun.CurrentOwner as PlayerController; for (int i = 0; i < this.TargetEnemiesBLK.Count; i++) { bool not_in = target.EnemyGuid == this.TargetEnemiesBLK[i]; if (not_in) { wastrue = true; break; } } bool health_check = target.CompanionOwner != player && !target.healthHaver.IsBoss; if (wastrue != true && health_check) { player.GiveItem("casing"); player.GiveItem("casing"); GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } }
private void DEVOUR(AIActor target, float distance) { { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } }
private void ProcessEnemy(AIActor target, float distance) { if (target != null && !target.healthHaver.IsBoss) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } }
private IEnumerator EatEnemy(AIActor targetEnemy) { float elapsed = 0f; float duration = 0.5f; Vector3 startPos = targetEnemy.transform.position; Vector3 finalOffset = sprite.WorldCenter - startPos.XY(); tk2dSprite targetSprite = targetEnemy.GetComponentInChildren <tk2dSprite>(); if (targetEnemy.behaviorSpeculator) { targetEnemy.behaviorSpeculator.enabled = false; } RoomHandler m_ParentRoom = targetEnemy.GetAbsoluteParentRoom(); if (m_ParentRoom != null) { m_ParentRoom.DeregisterEnemy(targetEnemy); } // Destroy(targetEnemy); // Destroy(targetEnemy.specRigidbody); targetEnemy.specRigidbody.CollideWithOthers = false; spriteAnimator.PlayForDuration("baby_dragun_weak_eat", -1f, "baby_dragun_weak_idle", false); AkSoundEngine.PostEvent("Play_NPC_BabyDragun_Munch_01", gameObject); while (elapsed < duration) { elapsed += BraveTime.DeltaTime; if (!targetSprite || !targetSprite.transform) { m_currentlyEatingEnemy = false; yield break; } targetSprite.transform.localScale = Vector3.Lerp(Vector3.one, new Vector3(0.01f, 0.01f, 1f), elapsed / duration); targetSprite.transform.position = Vector3.Lerp(startPos, startPos + finalOffset, elapsed / duration); yield return(null); } if (!targetSprite || !targetSprite.transform) { m_currentlyEatingEnemy = false; yield break; } yield return(null); // Destroy(targetSprite.gameObject); m_ParentRoom.DeregisterEnemy(targetEnemy); targetEnemy.EraseFromExistence(true); m_enemiesEaten++; if (m_enemiesEaten >= RequiredEnemies) { while (spriteAnimator.IsPlaying("baby_dragun_weak_eat")) { yield return(null); } LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(ItemID).gameObject, GameManager.Instance.BestActivePlayer); Destroy(gameObject); } yield return(null); m_currentlyEatingEnemy = false; yield break; }
private bool AdjustRigidbodyVelocity(SpeculativeRigidbody other, Vector2 myCenter) { bool result = false; Vector2 a = other.UnitCenter - myCenter; float effectRadius = 10f; float num = Vector2.SqrMagnitude(a); if (num >= effectRadius * effectRadius) { return(result); } float gravitationalForce = 500f; Vector2 vector = other.Velocity; AIActor aiactor = other.aiActor; if (aiactor == null) { return(false); } aiactor.CollisionDamage = 0; if (other.GetComponent <BlackHoleDoer>() != null) { return(false); } if (vector == Vector2.zero) { Vector2 lhs = myCenter - other.UnitCenter; if (lhs == Vector2.zero) { lhs = new Vector2(UnityEngine.Random.value - 0.5f, UnityEngine.Random.value - 0.5f); } vector = lhs.normalized * 3f; } if (num < 4f) { aiactor.EraseFromExistence(true); result = true; } Vector2 frameAccelerationForRigidbody = this.GetFrameAccelerationForRigidbody(other.UnitCenter, myCenter, Mathf.Sqrt(num), gravitationalForce); float d = Mathf.Clamp(BraveTime.DeltaTime, 0f, 0.02f); Vector2 b = frameAccelerationForRigidbody * d; Vector2 vector2 = vector + b; if (BraveTime.DeltaTime > 0.02f) { vector2 *= 0.02f / BraveTime.DeltaTime; } aiactor.knockbackDoer.ApplyKnockback(vector2, 2 * (aiactor.knockbackDoer.weight / 10f), true); if (aiactor.behaviorSpeculator != null) { aiactor.behaviorSpeculator.Stun(0.1f, false); } if (aiactor != null) { aiactor.CollisionDamage = 0; } return(result); }
public static void KillRoom(string[] notused) { RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; List <AIActor> activeenemies_typeall = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); for (int e = 0; e < activeenemies_typeall.Count; e++) { AIActor enemy = activeenemies_typeall[e]; enemy.EraseFromExistence(false); } }
private void ProcessEnemy(AIActor target, float distance) { for (int i = 0; i < this.TargetEnemies.Count; i++) { if (target.EnemyGuid == this.TargetEnemies[i]) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); break; } } }
private void ProcessEnemy(AIActor target) { PlayerController player = this.gun.CurrentOwner as PlayerController; for (int i = 0; i < this.TargetEnemiesBLK.Count; i++) { bool not_in = target.EnemyGuid == this.TargetEnemiesBLK[i]; if (not_in) { wastrue = true; break; } } bool health_check = target.CompanionOwner != player && !target.healthHaver.IsBoss && (target.healthHaver.GetCurrentHealth() <= target.healthHaver.GetMaxHealth() * .75); if (wastrue != true && health_check) { succ.Add(target.EnemyGuid.ToString()); int sfx = rng.Next(1, 3); if (sfx == 1) { AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_01", base.gameObject); } if (sfx == 2) { AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_02", base.gameObject); } if (sfx == 3) { AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); AkSoundEngine.PostEvent("Play_pwoomp_03", base.gameObject); } GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } }
private void ProcessEnemy(AIActor target, float distance) { if (target && target.healthHaver && !target.healthHaver.IsBoss && EasyEnemyTypeLists.ModInclusiveBlobsALL.Contains(target.EnemyGuid)) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); int AmmoWorth = 0; if (EasyEnemyTypeLists.BlobulonEnemiesSMALL.Contains(target.EnemyGuid)) { AmmoWorth = 5; } else if (EasyEnemyTypeLists.BlobulonEnemiesMEDIUM.Contains(target.EnemyGuid)) { AmmoWorth = 14; } else if (EasyEnemyTypeLists.ModInclusiveBlobsLARGE.Contains(target.EnemyGuid)) { AmmoWorth = 20; } else if (EasyEnemyTypeLists.BlobulonEnemiesMEGA.Contains(target.EnemyGuid)) { AmmoWorth = 30; } if (AmmoWorth > 0) { gun.ammo += AmmoWorth; } } else if (target.EnemyGuid == EnemyGuidDatabase.Entries["chicken"]) { if (gun.CurrentOwner && (gun.CurrentOwner as PlayerController).PlayerHasActiveSynergy("Chickadoo")) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); gun.ammo += 5; } } }
private void ProcessEnemy(AIActor target, float distance) { for (int i = 0; i < this.TargetEnemies.Count; i++) { bool flag = target.EnemyGuid == this.TargetEnemies[i]; if (flag) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); int amt = rng.Next(0, 1); money((PlayerController)this.gun.CurrentOwner, amt); break; } } }
private void DelayedDestroyEnemy(AIActor enemy) { if (enemy && base.Owner) { this.TelefragVFXPrefab = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Tentacleport"); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.TelefragVFXPrefab); gameObject.GetComponent <tk2dBaseSprite>().PlaceAtLocalPositionByAnchor(enemy.sprite.WorldCenter, tk2dBaseSprite.Anchor.LowerCenter); gameObject.transform.position = gameObject.transform.position.Quantize(0.0625f); gameObject.GetComponent <tk2dBaseSprite>().UpdateZDepth(); if (enemy) { enemy.EraseFromExistence(false); } } }
private IEnumerator DelayedDestroyEnemy(AIActor enemy, tk2dSpriteAnimator vfxAnimator) { if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = false; vfxAnimator.sprite.HeightOffGround = -1f; } while (enemy && vfxAnimator && vfxAnimator.sprite.GetCurrentSpriteDef().name != "kthuliber_tentacles_010") { vfxAnimator.sprite.UpdateZDepth(); yield return(null); } if (vfxAnimator) { vfxAnimator.sprite.IsPerpendicular = true; vfxAnimator.sprite.HeightOffGround = 1.5f; vfxAnimator.sprite.UpdateZDepth(); } if (enemy) { enemy.EraseFromExistence(false); } yield break; }
private IEnumerator HandleTimer(AIActor self, float duration) { float elapsed = 0; while (elapsed < duration) { elapsed += BraveTime.DeltaTime; if (self.healthHaver.IsDead) { yield break; } yield return(null); } if (self.healthHaver.IsDead) { yield break; } GameObject gameObject = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Teleport_Beam"); SpawnManager.SpawnVFX(gameObject, self.specRigidbody.UnitCenter, Quaternion.Euler(0, 0, 0)); self.healthHaver.PreventAllDamage = false; self.EraseFromExistence(true); yield break; }
private void ProcessEnemy(AIActor target, float distance) { if (target.GetComponent <AliveBullets.DumbEnemyBehavior>() == null) { if (this.m_owner.CurrentGun.AmmoType == GameUIAmmoType.AmmoType.CUSTOM) { if (BigChamber.customTypesEnemies.ContainsKey(this.m_owner.CurrentGun.DefaultModule.customAmmoType)) { if (BigChamber.customTypesEnemies[this.m_owner.CurrentGun.DefaultModule.customAmmoType].Contains(target.EnemyGuid)) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } } else if (this.m_owner.CurrentGun.DefaultModule.customAmmoType != "pot") { if (typesEnemies[GameUIAmmoType.AmmoType.SMALL_BULLET].Contains(target.EnemyGuid)) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } } } else { if (BigChamber.typesEnemies[this.m_owner.CurrentGun.DefaultModule.ammoType].Contains(target.EnemyGuid)) { if (BigChamber.typesEnemies[this.m_owner.CurrentGun.DefaultModule.ammoType].Contains(target.EnemyGuid)) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } else { if (typesEnemies[GameUIAmmoType.AmmoType.SMALL_BULLET].Contains(target.EnemyGuid)) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } } } } } else { if (target.GetComponent <AliveBullets.DumbEnemyBehavior>().usesNewUsesSynergy) { if (this.m_owner.CurrentGun.DefaultModule.ammoType == target.GetComponent <AliveBullets.DumbEnemyBehavior>().sourceAmmoType) { if (this.m_owner.CurrentGun.DefaultModule.ammoType == GameUIAmmoType.AmmoType.CUSTOM) { if (target.GetComponent <AliveBullets.DumbEnemyBehavior>().customAmmoType != null) { if (this.m_owner.CurrentGun.DefaultModule.customAmmoType == target.GetComponent <AliveBullets.DumbEnemyBehavior>().customAmmoType) { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } } } else { GameManager.Instance.Dungeon.StartCoroutine(this.HandleEnemySuck(target)); target.EraseFromExistence(true); } } } } }
public static void AIActorPostSpawn(AIActor AIActor) { if (CurrentChallenge == ChallengeType.WHAT_ARMY) { bool isParachuting = (AIActor.gameObject.transform.parent != null && AIActor.gameObject.transform.parent.gameObject.name.Contains("EX_Parachute")); if (AIActor && AIActor.healthHaver && !AIActor.healthHaver.IsBoss && !AIActor.healthHaver.IsSubboss && !AIActor.IsSecretlyTheMineFlayer()) { if (AIActor.gameObject.GetComponent <HasBeenAffectedByCurrentChallenge>() == null && AIActor.gameObject.GetComponent <CompanionController>() == null && !isParachuting) { float proc = 1; if (AIActor.GetAbsoluteParentRoom().area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS && AIActor.GetAbsoluteParentRoom().RoomContainsMineFlayer()) { proc = 0.2f; } if (UnityEngine.Random.value <= proc) { List <string> ChaosPalette = GenerateChaosPalette(); string guid = BraveUtility.RandomElement(ChaosPalette); var enemyPrefab = EnemyDatabase.GetOrLoadByGuid(guid); AIActor aiactor = AIActor.Spawn(enemyPrefab, AIActor.gameActor.CenterPosition.ToIntVector2(VectorConversions.Floor), AIActor.GetAbsoluteParentRoom(), true, AIActor.AwakenAnimationType.Default, true); aiactor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>(); aiactor.AssignedCurrencyToDrop = AIActor.AssignedCurrencyToDrop; aiactor.AdditionalSafeItemDrops = AIActor.AdditionalSafeItemDrops; aiactor.AdditionalSimpleItemDrops = AIActor.AdditionalSimpleItemDrops; aiactor.CanTargetEnemies = AIActor.CanTargetEnemies; aiactor.CanTargetPlayers = AIActor.CanTargetPlayers; if (aiactor.EnemyGuid == "556e9f2a10f9411cb9dbfd61e0e0f1e1") { aiactor.HandleReinforcementFallIntoRoom(0f); } else if (AIActor.IsInReinforcementLayer) { aiactor.invisibleUntilAwaken = true; aiactor.specRigidbody.CollideWithOthers = false; aiactor.IsGone = true; aiactor.HandleReinforcementFallIntoRoom(0f); } if (aiactor.EnemyGuid == "22fc2c2c45fb47cf9fb5f7b043a70122") { aiactor.CollisionDamage = 0f; } if (AIActor.GetComponent <ExplodeOnDeath>() != null) { UnityEngine.Object.Destroy(AIActor.GetComponent <ExplodeOnDeath>()); } AIActor.EraseFromExistence(true); } } } } else if (CurrentChallenge == ChallengeType.TOIL_AND_TROUBLE) { if (AIActor && AIActor.healthHaver && !AIActor.healthHaver.IsBoss && !AIActor.healthHaver.IsSubboss && !AIActor.IsSecretlyTheMineFlayer()) { if (AIActor.GetComponent <CompanionController>() == null && AIActor.GetComponent <HasBeenAffectedByCurrentChallenge>() == null && AIActor.GetComponent <DisplacedImageController>() == null && AIActor.GetComponent <WitchsBrew.HasBeenDoubledByWitchsBrew>() == null && AIActor.GetComponent <MirrorImageController>() == null) { GameManager.Instance.StartCoroutine(ToilEnemyDupe(AIActor)); } } else if (AIActor && AIActor.healthHaver && (AIActor.healthHaver.IsBoss || AIActor.healthHaver.IsSubboss) && !AIActor.IsSecretlyTheMineFlayer()) { if (AIActor.GetComponent <HasBeenAffectedByCurrentChallenge>() == null) { if (ValidDoubleableBosses.Contains(AIActor.EnemyGuid)) { string guid = AIActor.EnemyGuid; var enemyPrefab = EnemyDatabase.GetOrLoadByGuid(guid); AIActor aiactor = AIActor.Spawn(enemyPrefab, AIActor.gameActor.CenterPosition.ToIntVector2(VectorConversions.Floor), AIActor.GetAbsoluteParentRoom(), true, AIActor.AwakenAnimationType.Default, true); HasBeenAffectedByCurrentChallenge challengitude = aiactor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>(); challengitude.linkedOther = AIActor; HasBeenAffectedByCurrentChallenge challengitude2 = AIActor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>(); challengitude2.linkedOther = aiactor; aiactor.AssignedCurrencyToDrop = AIActor.AssignedCurrencyToDrop; aiactor.AdditionalSafeItemDrops = AIActor.AdditionalSafeItemDrops; aiactor.AdditionalSimpleItemDrops = AIActor.AdditionalSimpleItemDrops; if (AIActor.GetComponent <BroController>()) { aiactor.gameObject.GetOrAddComponent <BroController>(); } float actorOrigHP = AIActor.healthHaver.GetMaxHealth(); float actorNewHP = aiactor.healthHaver.GetMaxHealth(); AIActor.healthHaver.SetHealthMaximum(actorOrigHP * 0.5f); AIActor.healthHaver.ForceSetCurrentHealth(actorOrigHP * 0.5f); aiactor.healthHaver.SetHealthMaximum(actorNewHP * 0.5f); aiactor.healthHaver.ForceSetCurrentHealth(actorNewHP * 0.5f); } else { float actorHP = AIActor.healthHaver.GetMaxHealth(); AIActor.healthHaver.SetHealthMaximum(actorHP * 1.5f); AIActor.healthHaver.ForceSetCurrentHealth(actorHP * 1.5f); } } } } }
public static AIActor AdvancedTransmogrify(this AIActor startEnemy, AIActor EnemyPrefab, GameObject EffectVFX, string audioEvent = "Play_ENM_wizardred_appear_01", bool ignoreAlreadyTransmogged = false, bool canTransmogMimics = false, bool defuseExplosives = true, bool carryOverRewards = false, bool maintainHealthPercent = false, bool maintainsJammedState = false, bool giveIsTransmogrifiedBool = true, bool logEverything = false) { if (startEnemy == null) { Debug.LogError("Tried to transmog a null enemy!"); return(null); } if (EnemyPrefab == null) { Debug.LogError("Tried to transmog to a null prefab!"); return(startEnemy); } if (startEnemy.EnemyGuid == EnemyPrefab.EnemyGuid) { if (logEverything) { Debug.Log($"Tried to transmog an enemy into an actor with the same guid!"); } return(startEnemy); } if (ignoreAlreadyTransmogged && startEnemy.IsTransmogrified) { if (logEverything) { Debug.Log("Tried to transmog an enemy that has already been transmogged."); } return(startEnemy); } if (!startEnemy.healthHaver || startEnemy.healthHaver.IsBoss || startEnemy.ParentRoom == null) { if (logEverything) { Debug.Log("Either the healthhaver or parent room on the target was null, or they were a boss!"); } return(startEnemy); } Vector2 centerPosition = startEnemy.CenterPosition; if (EffectVFX != null) { SpawnManager.SpawnVFX(EffectVFX, centerPosition, Quaternion.identity); } AIActor aiactor = AIActor.Spawn(EnemyPrefab, centerPosition.ToIntVector2(VectorConversions.Floor), startEnemy.ParentRoom, true, AIActor.AwakenAnimationType.Default, true); if (aiactor) { if (giveIsTransmogrifiedBool) { aiactor.IsTransmogrified = true; } if (maintainHealthPercent) { float healthPercent = startEnemy.healthHaver.GetCurrentHealthPercentage(); //ETGModConsole.Log("HP Percent: " + healthPercent); float aiactorHP = aiactor.healthHaver.GetMaxHealth(); float resultHP = aiactorHP * healthPercent; aiactor.healthHaver.ForceSetCurrentHealth(resultHP); } } if (!string.IsNullOrEmpty(audioEvent)) { AkSoundEngine.PostEvent(audioEvent, startEnemy.gameObject); } if (maintainsJammedState) { if (startEnemy.IsBlackPhantom && !aiactor.IsBlackPhantom) { aiactor.BecomeBlackPhantom(); } if (!startEnemy.IsBlackPhantom && aiactor.IsBlackPhantom) { aiactor.UnbecomeBlackPhantom(); } } if (defuseExplosives && startEnemy.GetComponent <ExplodeOnDeath>() != null) { UnityEngine.Object.Destroy(startEnemy.GetComponent <ExplodeOnDeath>()); } if (carryOverRewards && aiactor) { aiactor.CanDropCurrency = startEnemy.CanDropCurrency; aiactor.AssignedCurrencyToDrop = startEnemy.AssignedCurrencyToDrop; aiactor.AdditionalSafeItemDrops = startEnemy.AdditionalSafeItemDrops; aiactor.AdditionalSimpleItemDrops = startEnemy.AdditionalSimpleItemDrops; aiactor.AdditionalSingleCoinDropChance = startEnemy.AdditionalSingleCoinDropChance; aiactor.CanDropDuplicateItems = startEnemy.CanDropDuplicateItems; aiactor.CanDropItems = startEnemy.CanDropItems; aiactor.ChanceToDropCustomChest = startEnemy.ChanceToDropCustomChest; aiactor.CustomLootTableMaxDrops = startEnemy.CustomLootTableMaxDrops; aiactor.CustomLootTableMinDrops = startEnemy.CustomLootTableMinDrops; aiactor.CustomLootTable = startEnemy.CustomLootTable; aiactor.SpawnLootAtRewardChestPos = startEnemy.SpawnLootAtRewardChestPos; if (startEnemy.GetComponent <KeyBulletManController>()) { KeyBulletManController controller = startEnemy.GetComponent <KeyBulletManController>(); int numberOfIterations = 1; if (startEnemy.IsBlackPhantom && controller.doubleForBlackPhantom) { numberOfIterations++; } for (int i = 0; i < numberOfIterations; i++) { GameObject objToAdd = null; if (controller.lootTable) { objToAdd = controller.lootTable.SelectByWeight(false); } else if (controller.lookPickupId > -1) { objToAdd = PickupObjectDatabase.GetById(controller.lookPickupId).gameObject; } if (objToAdd != null) { aiactor.AdditionalSafeItemDrops.Add(objToAdd.GetComponent <PickupObject>()); } } } startEnemy.EraseFromExistence(false); } else { startEnemy.EraseFromExistenceWithRewards(false); } return(aiactor); }