private IEnumerator SpwanEnemyAirDrop(float delay = 0.05f) { Vector3 RoomOffset = m_room.area.basePosition.ToVector3(); string EnemyGUID1 = "88b6b6a93d4b4234a67844ef4728382c"; // bandana_bullet_kin string EnemyGUID2 = "4d37ce3d666b4ddda8039929225b7ede"; // grenade_kin string EnemyGUID3 = "01972dee89fc4404a5c408d50007dad5"; // bullet_kin string EnemyGUID4 = "128db2f0781141bcb505d8f00f9e4d47"; // red_shotgun_kin if (UnityEngine.Random.value <= 0.5f) { EnemyGUID1 = ExpandCustomEnemyDatabase.BootlegBulletManBandanaGUID; } if (UnityEngine.Random.value <= 0.1f) { EnemyGUID2 = ExpandCustomEnemyDatabase.BootlegShotgunManBlueGUID; } if (UnityEngine.Random.value <= 0.5f) { EnemyGUID3 = ExpandCustomEnemyDatabase.BootlegBulletManGUID; } if (UnityEngine.Random.value <= 0.5f) { EnemyGUID4 = ExpandCustomEnemyDatabase.BootlegShotgunManRedGUID; } ExpandUtility.SpawnParaDrop(m_room, (RoomOffset + new Vector3(4, 3, 0)), null, EnemyGUID1); ExpandUtility.SpawnParaDrop(m_room, (RoomOffset + new Vector3(4, 9, 0)), null, EnemyGUID2); ExpandUtility.SpawnParaDrop(m_room, (RoomOffset + new Vector3(13, 3, 0)), null, EnemyGUID3); ExpandUtility.SpawnParaDrop(m_room, (RoomOffset + new Vector3(13, 9, 0)), null, EnemyGUID4); yield return(new WaitForSeconds(delay)); if (!m_room.IsSealed) { m_room.SealRoom(); } yield break; }
private IEnumerator Trigger() { if (m_triggered) { yield break; } if (!string.IsNullOrEmpty(TriggerAnimation)) { spriteAnimator.Play(TriggerAnimation); } if (!string.IsNullOrEmpty(TriggerSFX)) { AkSoundEngine.PostEvent(TriggerSFX, gameObject); } m_triggered = true; Vector2 SpawnOffset = Vector2.zero; if (EnemySpawnOffset.HasValue) { SpawnOffset = EnemySpawnOffset.Value; } if (TriggerVFX) { if (useAirDropSpawn) { m_TriggerVFX = SpawnManager.SpawnVFX(TriggerVFX, specRigidbody.UnitBottomCenter - new Vector2(0, 0.25f), Quaternion.identity); } else { m_TriggerVFX = SpawnManager.SpawnVFX(TriggerVFX, specRigidbody.UnitBottomCenter + SpawnOffset, Quaternion.identity); } } if (useAirDropSpawn) { Vector2 SpawnPosition = transform.position; DungeonPlaceable selectedPlacable = null; bool isExplodyBarrel = false; if (EnemySpawnPlacableOverride) { selectedPlacable = EnemySpawnPlacableOverride; } else { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; selectedPlacable = BraveUtility.RandomElement(targetIdea.ValidEasyEnemyPlaceables); } DungeonPlaceableVariant selectedVarient = BraveUtility.RandomElement(selectedPlacable.variantTiers); if (selectedVarient != null && UnityEngine.Random.value > 0.2f) { if (!string.IsNullOrEmpty(selectedVarient.enemyPlaceableGuid)) { GameObject enemyObject = Instantiate(EnemyDatabase.GetOrLoadByGuid(selectedVarient.enemyPlaceableGuid).gameObject, SpawnPosition, Quaternion.identity); enemyObject.GetComponent <AIActor>().ConfigureOnPlacement(m_room); ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, enemyObject, DropHorizontalOffset: 10, useLandingVFX: false); } else if (selectedVarient.nonDatabasePlaceable) { GameObject ParaDroppedObject = Instantiate(selectedVarient.nonDatabasePlaceable, SpawnPosition, Quaternion.identity); ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, ParaDroppedObject, DropHorizontalOffset: 10, useLandingVFX: false); } else { ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, DropHorizontalOffset: 10, useLandingVFX: false); isExplodyBarrel = true; } } else { ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, DropHorizontalOffset: 10, useLandingVFX: false); isExplodyBarrel = true; } if (!m_room.IsSealed && !isExplodyBarrel) { m_room.SealRoom(); } yield return(null); DestroyMushroom(); } else { AIActor selectedEnemy = null; if (EnemySpawnPlacableOverride) { DungeonPlaceableVariant enemyVariant = EnemySpawnPlacableOverride.SelectFromTiersFull(); selectedEnemy = enemyVariant.GetOrLoadPlaceableObject.GetComponent <AIActor>(); } else { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; DungeonPlaceable backupEnemyPlaceable = targetIdea.ValidEasyEnemyPlaceables[UnityEngine.Random.Range(0, targetIdea.ValidEasyEnemyPlaceables.Length)]; DungeonPlaceableVariant enemyVariant = backupEnemyPlaceable.SelectFromTiersFull(); } if (selectedEnemy) { AIActor targetAIActor = AIActor.Spawn(selectedEnemy, specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor) + SpawnOffset.ToIntVector2(), m_room, true, AIActor.AwakenAnimationType.Spawn, true); targetAIActor.reinforceType = AIActor.ReinforceType.SkipVfx; targetAIActor.HandleReinforcementFallIntoRoom(0.8f); if (!m_room.IsSealed) { m_room.SealRoom(); } while (targetAIActor.IsGone) { yield return(null); } DestroyMushroom(); } } yield break; }