public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { base.OnEffectApplied(actor, effectData, partialAmount); effectData.OnActorPreDeath = delegate(Vector2 dir) { GameActorWitherEffect.DestroyFlames(effectData); }; actor.healthHaver.OnPreDeath += effectData.OnActorPreDeath; { if (effectData.vfxObjects == null) { effectData.vfxObjects = new List <Tuple <GameObject, float> >(); } effectData.OnFlameAnimationCompleted = delegate(tk2dSpriteAnimator spriteAnimator, tk2dSpriteAnimationClip clip) { if (effectData.destroyVfx || !actor) { spriteAnimator.AnimationCompleted = (Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>)Delegate.Remove(spriteAnimator.AnimationCompleted, effectData.OnFlameAnimationCompleted); UnityEngine.Object.Destroy(spriteAnimator.gameObject); return; } if (UnityEngine.Random.value < this.flameMoveChance) { Vector2 a = actor.specRigidbody.HitboxPixelCollider.UnitDimensions / 2f; Vector2 b = BraveUtility.RandomVector2(-a + this.flameBuffer, a - this.flameBuffer); Vector2 v = actor.specRigidbody.HitboxPixelCollider.UnitCenter + b; spriteAnimator.transform.position = v; } spriteAnimator.Play(clip, 0f, clip.fps * UnityEngine.Random.Range(1f - this.flameFpsVariation, 1f + this.flameFpsVariation), false); }; } }
protected override void DoEffect(PlayerController user) { Vector2 unitBottomLeft2 = user.sprite.WorldBottomCenter; Vector2 unitTopRight2 = user.sprite.WorldTopCenter; GameObject prefab2 = BraveUtility.RandomElement <GameObject>(this.bigExplosionVfx); Vector2 v2 = BraveUtility.RandomVector2(unitBottomLeft2, unitTopRight2, new Vector2(1f, 1f)); tk2dBaseSprite component2 = SpawnManager.SpawnVFX(prefab2, v2, Quaternion.identity).GetComponent <tk2dBaseSprite>(); component2.HeightOffGround = 3f; this.sprite.AttachRenderer(component2); this.sprite.UpdateZDepth(); //GameManager.Instance.LoadCustomLevel("bny_abyss_chamber"); this.StoredGunId = user.CurrentGun.PickupObjectId; BunnyModule.Log("Gun ID:" + this.StoredGunId); }
private IEnumerator OnDeathExplosionsCR() { // PastLabMarineController plmc = FindObjectOfType<PastLabMarineController>(); PixelCollider collider = specRigidbody.HitboxPixelCollider; for (int i = 0; i < explosionCount; i++) { Vector2 minPos = collider.UnitBottomLeft; Vector2 maxPos = collider.UnitTopRight; GameObject vfxPrefab = BraveUtility.RandomElement(explosionVfx); Vector2 pos = BraveUtility.RandomVector2(minPos, maxPos, new Vector2(0.5f, 0.5f)); GameObject vfxObj = SpawnManager.SpawnVFX(vfxPrefab, pos, Quaternion.identity); tk2dBaseSprite vfxSprite = vfxObj.GetComponent <tk2dBaseSprite>(); vfxSprite.HeightOffGround = 3f; sprite.AttachRenderer(vfxSprite); sprite.UpdateZDepth(); if (i < explosionCount - 1) { yield return(new WaitForSeconds(explosionMidDelay)); } } for (int j = 0; j < bigExplosionCount; j++) { Vector2 minPos2 = collider.UnitBottomLeft; Vector2 maxPos2 = collider.UnitTopRight; GameObject vfxPrefab2 = BraveUtility.RandomElement(bigExplosionVfx); Vector2 pos2 = BraveUtility.RandomVector2(minPos2, maxPos2, new Vector2(1f, 1f)); GameObject vfxObj2 = SpawnManager.SpawnVFX(vfxPrefab2, pos2, Quaternion.identity); tk2dBaseSprite vfxSprite2 = vfxObj2.GetComponent <tk2dBaseSprite>(); vfxSprite2.HeightOffGround = 3f; sprite.AttachRenderer(vfxSprite2); sprite.UpdateZDepth(); if (j < bigExplosionCount - 1) { yield return(new WaitForSeconds(bigExplosionMidDelay)); } } healthHaver.DeathAnimationComplete(null, null); Destroy(gameObject); yield return(new WaitForSeconds(2f)); // Pixelator.Instance.FadeToColor(2f, Color.white, false, 0f); // plmc.OnBossKilled(); yield break; }
// Token: 0x06004CA9 RID: 19625 RVA: 0x00199234 File Offset: 0x00197434 public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { if (actor.FreezeAmount > 0f) { actor.FreezeAmount = Mathf.Max(0f, actor.FreezeAmount - BraveTime.DeltaTime * actor.FreezeDispelFactor); if (!actor.IsFrozen) { if (actor.FreezeAmount > 100f && actor.healthHaver.IsAlive) { actor.FreezeAmount = 100f; if (this.FreezeCrystals.Count > 0) { if (effectData.vfxObjects == null) { effectData.vfxObjects = new List <global::Tuple <GameObject, float> >(); } int num = this.crystalNum; if (effectData.actor && effectData.actor.specRigidbody && effectData.actor.specRigidbody.HitboxPixelCollider != null) { float num2 = effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.x * effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.y; num = Mathf.Max(this.crystalNum, (int)((float)this.crystalNum * (0.5f + num2 / 4f))); } for (int i = 0; i < num; i++) { GameObject prefab = BraveUtility.RandomElement <GameObject>(this.FreezeCrystals); Vector2 vector = actor.specRigidbody.HitboxPixelCollider.UnitCenter; Vector2 vector2 = BraveUtility.RandomVector2(-this.crystalVariation, this.crystalVariation); vector += vector2; float num3 = BraveMathCollege.QuantizeFloat(vector2.ToAngle(), 360f / (float)this.crystalRot); Quaternion rotation = Quaternion.Euler(0f, 0f, num3); GameObject gameObject = SpawnManager.SpawnVFX(prefab, vector, rotation, true); gameObject.transform.parent = actor.transform; tk2dSprite component = gameObject.GetComponent <tk2dSprite>(); if (component) { actor.sprite.AttachRenderer(component); component.HeightOffGround = 0.1f; } if (effectData.actor && effectData.actor.specRigidbody && effectData.actor.specRigidbody.HitboxPixelCollider != null) { Vector2 unitCenter = effectData.actor.specRigidbody.HitboxPixelCollider.UnitCenter; float num4 = (float)i * (360f / (float)num); Vector2 normalized = BraveMathCollege.DegreesToVector(num4, 1f).normalized; normalized.x *= effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.x / 2f; normalized.y *= effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.y / 2f; float magnitude = normalized.magnitude; Vector2 vector3 = unitCenter + normalized; vector3 += (unitCenter - vector3).normalized * (magnitude * UnityEngine.Random.Range(0.15f, 0.85f)); gameObject.transform.position = vector3.ToVector3ZUp(0f); gameObject.transform.rotation = Quaternion.Euler(0f, 0f, num4); } effectData.vfxObjects.Add(global::Tuple.Create <GameObject, float>(gameObject, num3)); } } if (this.ShouldVanishOnDeath(actor)) { actor.StealthDeath = true; } if (actor.behaviorSpeculator) { if (actor.behaviorSpeculator.IsInterruptable) { actor.behaviorSpeculator.InterruptAndDisable(); } else { actor.behaviorSpeculator.enabled = false; } } if (actor is AIActor) { AIActor aiactor = actor as AIActor; aiactor.ClearPath(); aiactor.BehaviorOverridesVelocity = false; } actor.IsFrozen = true; } } else if (actor.IsFrozen) { if (actor.FreezeAmount <= 0f) { return; } if (actor.IsFalling) { if (effectData.vfxObjects != null && effectData.vfxObjects.Count > 0) { this.DestroyCrystals(effectData, false); } if (actor.aiAnimator) { actor.aiAnimator.FpsScale = 1f; } } } } if (!actor.healthHaver.IsDead) { float num5 = (!actor.healthHaver.IsBoss) ? 100f : 75f; float num6 = (!actor.IsFrozen) ? Mathf.Clamp01((100f - actor.FreezeAmount) / 100f) : 0f; float num7 = (!actor.IsFrozen) ? Mathf.Clamp01(actor.FreezeAmount / num5) : 1f; if (actor.aiAnimator) { actor.aiAnimator.FpsScale = ((!actor.IsFalling) ? num6 : 1f); } if (actor.aiShooter) { actor.aiShooter.AimTimeScale = num6; } if (actor.behaviorSpeculator) { actor.behaviorSpeculator.CooldownScale = num6; } if (actor.bulletBank) { actor.bulletBank.TimeScale = num6; } if (this.AppliesTint) { float num8 = actor.FreezeAmount / actor.FreezeDispelFactor; Color overrideColor = this.TintColor; if (num8 < 0.1f) { overrideColor = Color.black; } else if (num8 < 0.2f) { overrideColor = Color.white; } overrideColor.a *= num7; actor.RegisterOverrideColor(overrideColor, this.effectIdentifier); } } }
private IEnumerator BecomeMimic() { if (m_hands == null) { StartCoroutine(DoIntro()); } if (!ChaosConsole.WallMimicsUseRewardManager) { m_ChaosModeActive = true; } if (m_GlitchModeActive) { m_ItemDropOdds += 0.2f; m_FriendlyMimicOdds += 0.2f; } m_isHidden = false; SpeculativeRigidbody specRigidbody = this.specRigidbody; specRigidbody.OnRigidbodyCollision = (SpeculativeRigidbody.OnRigidbodyCollisionDelegate)Delegate.Remove(specRigidbody.OnRigidbodyCollision, new SpeculativeRigidbody.OnRigidbodyCollisionDelegate(HandleRigidbodyCollision)); SpeculativeRigidbody specRigidbody2 = this.specRigidbody; specRigidbody2.OnBeamCollision = (SpeculativeRigidbody.OnBeamCollisionDelegate)Delegate.Remove(specRigidbody2.OnBeamCollision, new SpeculativeRigidbody.OnBeamCollisionDelegate(HandleBeamCollision)); AIAnimator tongueAnimator = aiAnimator.ChildAnimator; tongueAnimator.renderer.enabled = true; tongueAnimator.spriteAnimator.enabled = true; AIAnimator spitAnimator = tongueAnimator.ChildAnimator; spitAnimator.renderer.enabled = true; spitAnimator.spriteAnimator.enabled = true; tongueAnimator.PlayUntilFinished("spawn", false, null, -1f, false); float delay = tongueAnimator.CurrentClipLength; float timer = 0f; bool hasPlayedVFX = false; while (timer < delay) { yield return(null); timer += BraveTime.DeltaTime; if (!hasPlayedVFX && delay - timer < 0.1f) { hasPlayedVFX = true; if (WallDisappearVFX) { Vector2 zero = Vector2.zero; Vector2 zero2 = Vector2.zero; DungeonData.Direction facingDirection = m_facingDirection; if (facingDirection != DungeonData.Direction.SOUTH) { if (facingDirection != DungeonData.Direction.EAST) { if (facingDirection == DungeonData.Direction.WEST) { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } } else { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } } else { zero = new Vector2(0f, -1f); zero2 = new Vector2(0f, 1f); } Vector2 min = Vector2.Min(pos1.ToVector2(), pos2.ToVector2()) + zero; Vector2 max = Vector2.Max(pos1.ToVector2(), pos2.ToVector2()) + new Vector2(1f, 1f) + zero2; for (int i = 0; i < 5; i++) { Vector2 v = BraveUtility.RandomVector2(min, max, new Vector2(0.25f, 0.25f)) + new Vector2(0f, 1f); GameObject gameObject = SpawnManager.SpawnVFX(WallDisappearVFX, v, Quaternion.identity); tk2dBaseSprite tk2dBaseSprite = (!gameObject) ? null : gameObject.GetComponent <tk2dBaseSprite>(); if (tk2dBaseSprite) { tk2dBaseSprite.HeightOffGround = 8f; tk2dBaseSprite.UpdateZDepth(); } } } } } if (!m_failedWallConfigure && m_GlitchModeActive) { if (aiActor.ParentRoom != null && GlitchEnemyList != null && GlitchEnemyList.Count > 0 && UnityEngine.Random.value <= m_spawnGitchEnemyOdds) { float RandomIntervalFloat = UnityEngine.Random.Range(0.02f, 0.06f); float RandomDispFloat = UnityEngine.Random.Range(0.1f, 0.16f); float RandomDispIntensityFloat = UnityEngine.Random.Range(0.1f, 0.4f); float RandomColorProbFloat = UnityEngine.Random.Range(0.05f, 0.2f); float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f); int count2 = this.specRigidbody.PixelColliders.Count; this.specRigidbody.PixelColliders.RemoveAt(count2 - 1); this.specRigidbody.PixelColliders.RemoveAt(count2 - 2); StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform); Destroy(m_fakeWall); Destroy(m_fakeCeiling); Vector3 targetPosForSpawn = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3(); while (timer < delay) { aiAnimator.LockFacingDirection = true; aiAnimator.FacingDirection = DungeonData.GetAngleFromDirection(m_facingDirection); yield return(null); timer += BraveTime.DeltaTime; transform.position = Vector3.Lerp(m_startingPos, targetPosForSpawn, Mathf.InverseLerp(0.42f, 0.58f, timer)); this.specRigidbody.Reinitialize(); } yield return(null); Vector3 FinalSpawnLocation = transform.position; Vector3 VFXExplosionLocation = transform.position; Vector2 VFXExplosionSource = Vector2.zero; DungeonData.Direction CurrentDirection = m_facingDirection; if (CurrentDirection == DungeonData.Direction.WEST) { FinalSpawnLocation += new Vector3(2.5f, 3.5f); VFXExplosionLocation += new Vector3(3.5f, 3.5f); VFXExplosionSource = new Vector2(1, 0); } else if (CurrentDirection == DungeonData.Direction.EAST) { FinalSpawnLocation += new Vector3(4f, 3.5f); VFXExplosionLocation += new Vector3(3f, 3.5f); } else if (CurrentDirection == DungeonData.Direction.NORTH) { FinalSpawnLocation += new Vector3(3.5f, 4f); VFXExplosionLocation += new Vector3(3.5f, 3f); VFXExplosionSource = new Vector2(0, 1); } else if (CurrentDirection == DungeonData.Direction.SOUTH) { FinalSpawnLocation += new Vector3(3.5f, 1.5f); VFXExplosionLocation += new Vector3(3.5f, 2.5f); } yield return(null); string SelectedEnemy = BraveUtility.RandomElement(GlitchEnemyList); ExplosionData wallMimicExplosionData = new ExplosionData(); wallMimicExplosionData.CopyFrom(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData); wallMimicExplosionData.damage = 0f; wallMimicExplosionData.force /= 1.6f; if (SelectedEnemy != "RATCORPSE") { Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None); GameObject SpawnVFXObject = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>(); SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter); SpawnVFXObjectComponent.HeightOffGround = 1f; SpawnVFXObjectComponent.UpdateZDepth(); AIActor glitchActor = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(SelectedEnemy), FinalSpawnLocation, aiActor.ParentRoom, true, AIActor.AwakenAnimationType.Awaken, true); /*if (aiActor.ParentRoom != null && !aiActor.ParentRoom.IsSealed && !glitchActor.IgnoreForRoomClear) { * if (GameManager.Instance.PrimaryPlayer.CurrentRoom == aiActor.ParentRoom && aiActor.ParentRoom.EverHadEnemies) { * aiActor.ParentRoom.SealRoom(); * } * }*/ PickupObject.ItemQuality targetGlitchEnemyItemQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable glitchEnemyLootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject glitchEnemyItem = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetGlitchEnemyItemQuality, glitchEnemyLootTable, false); /*if (BraveUtility.RandomBool()) { * ChaosUtility.MakeCompanion(glitchActor); * } else { * ChaosShaders.Instance.ApplyGlitchShader(glitchActor, glitchActor.sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); * }*/ ChaosShaders.Instance.ApplyGlitchShader(glitchActor, glitchActor.sprite, true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); if (glitchEnemyItem) { glitchActor.AdditionalSafeItemDrops.Add(glitchEnemyItem); } } else { Exploder.Explode(VFXExplosionLocation, wallMimicExplosionData, VFXExplosionSource, ignoreQueues: true, damageTypes: CoreDamageTypes.None); GameObject SpawnVFXObject = Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); tk2dBaseSprite SpawnVFXObjectComponent = SpawnVFXObject.GetComponent <tk2dBaseSprite>(); SpawnVFXObjectComponent.PlaceAtPositionByAnchor(FinalSpawnLocation + new Vector3(0f, 0.5f, 0f), tk2dBaseSprite.Anchor.MiddleCenter); SpawnVFXObjectComponent.HeightOffGround = 1f; SpawnVFXObjectComponent.UpdateZDepth(); GameObject spawnedRatCorpseObject = Instantiate(ChaosPrefabs.RatCorpseNPC, FinalSpawnLocation, Quaternion.identity); TalkDoerLite talkdoerComponent = spawnedRatCorpseObject.GetComponent <TalkDoerLite>(); talkdoerComponent.transform.position.XY().GetAbsoluteRoom().RegisterInteractable(talkdoerComponent); talkdoerComponent.transform.position.XY().GetAbsoluteRoom().TransferInteractableOwnershipToDungeon(talkdoerComponent); talkdoerComponent.playmakerFsm.SetState("Set Mode"); ChaosUtility.AddHealthHaver(talkdoerComponent.gameObject, 60, flashesOnDamage: false, exploderSpawnsItem: true); } yield return(null); Destroy(aiActor.gameObject); yield break; } } PickupObject.ItemQuality targetQuality = (UnityEngine.Random.value >= 0.2f) ? ((!BraveUtility.RandomBool()) ? PickupObject.ItemQuality.C : PickupObject.ItemQuality.D) : PickupObject.ItemQuality.B; GenericLootTable lootTable = (!BraveUtility.RandomBool()) ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable; PickupObject item = LootEngine.GetItemOfTypeAndQuality <PickupObject>(targetQuality, lootTable, false); if (item) { if (m_ChaosModeActive) { if (UnityEngine.Random.value <= m_ItemDropOdds) { aiActor.AdditionalSafeItemDrops.Add(item); } else { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); if (BraveUtility.RandomBool()) { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); } if (m_GlitchModeActive) { aiActor.AdditionalSafeItemDrops.Add(PickupObjectDatabase.GetById(70)); } } if (UnityEngine.Random.value <= m_FriendlyMimicOdds) { m_isFriendlyMimic = true; } } else { aiActor.AdditionalSafeItemDrops.Add(item); } } else { if (m_ChaosModeActive && UnityEngine.Random.value <= m_FriendlyMimicOdds) { m_isFriendlyMimic = true; } } aiActor.enabled = true; behaviorSpeculator.enabled = true; if (aiActor.ParentRoom != null && aiActor.ParentRoom.IsSealed && !m_isFriendlyMimic) { aiActor.IgnoreForRoomClear = false; } // if (m_isFriendlyMimic) { ChaosUtility.MakeCompanion(aiActor); } if (m_isFriendlyMimic) { aiActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); } if (!m_failedWallConfigure) { int count = this.specRigidbody.PixelColliders.Count; for (int j = 0; j < count - 2; j++) { this.specRigidbody.PixelColliders[j].Enabled = true; } this.specRigidbody.PixelColliders.RemoveAt(count - 1); this.specRigidbody.PixelColliders.RemoveAt(count - 2); StaticReferenceManager.AllShadowSystemDepthHavers.Remove(m_fakeWall.transform); Destroy(m_fakeWall); Destroy(m_fakeCeiling); } else { int count = this.specRigidbody.PixelColliders.Count; for (int j = 0; j < count; j++) { this.specRigidbody.PixelColliders[j].Enabled = true; } } for (int k = 0; k < m_hands.Length; k++) { m_hands[k].gameObject.SetActive(true); } aiActor.ToggleRenderers(true); if (aiShooter) { aiShooter.ToggleGunAndHandRenderers(true, "ChaosWallMimicController"); } aiActor.IsGone = false; healthHaver.IsVulnerable = true; aiActor.State = AIActor.ActorState.Normal; for (int l = 0; l < m_hands.Length; l++) { m_hands[l].gameObject.SetActive(false); } m_isFinished = true; delay = 0.58f; timer = 0f; Vector3 targetPos = m_startingPos + DungeonData.GetIntVector2FromDirection(m_facingDirection).ToVector3(); while (timer < delay) { aiAnimator.LockFacingDirection = true; aiAnimator.FacingDirection = DungeonData.GetAngleFromDirection(m_facingDirection); yield return(null); timer += BraveTime.DeltaTime; transform.position = Vector3.Lerp(m_startingPos, targetPos, Mathf.InverseLerp(0.42f, 0.58f, timer)); this.specRigidbody.Reinitialize(); } aiAnimator.LockFacingDirection = false; knockbackDoer.SetImmobile(false, "ChaosWallMimicController"); aiActor.CollisionDamage = 0.5f; aiActor.CollisionKnockbackStrength = m_collisionKnockbackStrength; yield break; }