private IEnumerator waitAndDestroy(FlippableCover table) { yield return(null); DoSpawn(table); table.DestroyCover(); }
private void GiveWoodGuon(FlippableCover obj) { PlayerController owner = base.Owner; var woodGuon = Gungeon.Game.Items["nn:wood_guon_stone"]; owner.AcquirePassiveItemPrefabDirectly(woodGuon as PassiveItem); }
private void Flip(FlippableCover table) { if (gun && gun.GunPlayerOwner() && gun.GunPlayerOwner().PlayerHasActiveSynergy("Table Salt")) { tableDamageBonusDuration += 7; } }
private void HandleHeatEffects(TableTechChaosEffectIdentifier identifier, FlippableCover table) { if (identifier == TableTechChaosEffectIdentifier.HEAT && table) { table.StartCoroutine(this.HandleHeatEffectsCR(table)); } }
private void HandleStealthEffect(TableTechChaosEffectIdentifier identifier, FlippableCover obj) { if (identifier == TableTechChaosEffectIdentifier.STEALTH) { PlayerController owner = base.Owner; this.BreakStealth(owner); owner.OnItemStolen += this.BreakStealthOnSteal; owner.ChangeSpecialShaderFlag(1, 1f); owner.healthHaver.OnDamaged += this.OnDamaged; owner.SetIsStealthed(true, "table tech chaos"); owner.SetCapableOfStealing(true, "table tech chaos", null); GameManager.Instance.StartCoroutine(this.Unstealthy()); if (base.Owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { float num; RoomHandler room = obj.transform.position.GetAbsoluteRoom(); if (room != null) { AIActor aiactor = room.GetNearestEnemy(obj.specRigidbody.UnitCenter, out num, true, true); if (aiactor != null) { aiactor.PlayEffectOnActor(RedpoofVFX, Vector3.zero, false, true, false); aiactor.healthHaver.ApplyDamage(UnityEngine.Random.Range(15, 30), obj.specRigidbody.UnitCenter - aiactor.sprite.WorldCenter, "Hidden Tech Assassin", CoreDamageTypes.None, DamageCategory.Unstoppable, true, null, false); } } } } }
// private void DoEffect(FlippableCover obj) { } private void DoEffectCompleted(FlippableCover obj) { if (!obj.gameObject.name.ToLower().Contains("folding")) { StartCoroutine(HandleExpand(obj)); } }
private void OnFlip(FlippableCover obj) { bool ignoreFlocking = this.GetIgnoreFlocking(obj); TableTechChaosEffect effect = TableTechChaosEffect.PickRandomEffect(ignoreFlocking); if (effect.IsForFlipCompletion) { TableTechChaosFlipCompletionIdentifier completionIdentifier = obj.gameObject.AddComponent <TableTechChaosFlipCompletionIdentifier>(); completionIdentifier.effect = effect; } else { this.HandleBlankEffect(effect.identifier, obj); this.HandleStunEffect(effect.identifier); this.HandleRageEffect(effect.identifier); this.HandleVolleyEffect(effect.identifier); base.StartCoroutine(this.HandleDelayedEffect(0.25f, this.HandleTableVolley, effect.identifier, obj)); this.HandleTemporalEffects(effect.identifier); this.HandleHeatEffects(effect.identifier, obj); this.HandleStealthEffect(effect.identifier, obj); base.StartCoroutine(this.HandleDelayedEffect(0.25f, this.HandleBlackHoleEffect, effect.identifier, obj)); if (effect.identifier == TableTechChaosEffectIdentifier.TIME_SLOW && this.m_owner && this.m_owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { this.RadialSlow.DoRadialSlow(base.Owner.CenterPosition, base.Owner.CurrentRoom); } } }
private void HandleFlip(FlippableCover table) { bool flag2 = base.Owner.PlayerHasActiveSynergy("Hidden Tech Landmine"); if (flag2) { SpawnObjectPlayerItem component = PickupObjectDatabase.GetById(66).GetComponent <SpawnObjectPlayerItem>(); GameObject gameObject = component.objectToSpawn.gameObject; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject, table.sprite.WorldBottomCenter, Quaternion.identity); tk2dBaseSprite component2 = gameObject2.GetComponent <tk2dBaseSprite>(); bool flag3 = component2; if (flag3) { component2.PlaceAtPositionByAnchor(table.sprite.WorldBottomCenter, tk2dBaseSprite.Anchor.MiddleCenter); } } else { int num = 108; SpawnObjectPlayerItem component = PickupObjectDatabase.GetById(num).GetComponent <SpawnObjectPlayerItem>(); GameObject gameObject = component.objectToSpawn.gameObject; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject, table.sprite.WorldBottomCenter, Quaternion.identity); tk2dBaseSprite component2 = gameObject2.GetComponent <tk2dBaseSprite>(); bool flag4 = component2; if (flag4) { component2.PlaceAtPositionByAnchor(table.sprite.WorldBottomCenter, tk2dBaseSprite.Anchor.MiddleCenter); } } }
private void HandleBlankEffect(TableTechChaosEffectIdentifier identifier, FlippableCover table) { if (identifier == TableTechChaosEffectIdentifier.BLANK) { GameManager.Instance.StartCoroutine(this.DelayedBlankEffect(table)); } }
private void CheckForSynergy(FlippableCover obj) { if (Owner.HasPickupID(666)) { IgniteAll(Owner); } }
private void HandleMoneyEffect(TableTechChaosEffectIdentifier identifier, FlippableCover sourceCover) { if (identifier == TableTechChaosEffectIdentifier.MONEY) { int amountToDrop = UnityEngine.Random.Range(1, 5); LootEngine.SpawnCurrency(sourceCover.specRigidbody.UnitCenter, amountToDrop, false); } }
private void TurnTableIntoRocket(FlippableCover table) { GameObject gameObject = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Table_Exhaust"); Vector2 vector = DungeonData.GetIntVector2FromDirection(table.DirectionFlipped).ToVector2(); float num = BraveMathCollege.Atan2Degrees(vector); Vector3 zero = Vector3.zero; switch (table.DirectionFlipped) { case DungeonData.Direction.NORTH: zero = Vector3.zero; break; case DungeonData.Direction.EAST: zero = new Vector3(-0.5f, 0.25f, 0f); break; case DungeonData.Direction.SOUTH: zero = new Vector3(0f, 0.5f, 1f); break; case DungeonData.Direction.WEST: zero = new Vector3(0.5f, 0.25f, 0f); break; } GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject, table.specRigidbody.UnitCenter.ToVector3ZisY(0f) + zero, Quaternion.Euler(0f, 0f, num)); gameObject2.transform.parent = table.specRigidbody.transform; Projectile projectile = table.specRigidbody.gameObject.AddComponent <Projectile>(); projectile.Shooter = Owner.specRigidbody; projectile.Owner = Owner; projectile.baseData.damage = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().DirectHitBonusDamage; projectile.baseData.range = 1000f; projectile.baseData.speed = 20f; projectile.baseData.force = 50f; projectile.baseData.UsesCustomAccelerationCurve = true; projectile.baseData.AccelerationCurve = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().CustomAccelerationCurve; projectile.baseData.CustomAccelerationCurveDuration = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().CustomAccelerationCurveDuration; projectile.shouldRotate = false; projectile.Start(); projectile.SendInDirection(vector, true, true); projectile.collidesWithProjectiles = true; projectile.projectileHitHealth = 20; Action <Projectile> value = delegate(Projectile p) { if (table && table.shadowSprite) { table.shadowSprite.renderer.enabled = false; } }; projectile.OnDestruction += value; ExplosiveModifier explosiveModifier = projectile.gameObject.AddComponent <ExplosiveModifier>(); explosiveModifier.explosionData = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().ProjectileExplosionData; table.PreventPitFalls = true; }
private void UnhandleRadialIndicator(FlippableCover table) { if (this.m_radialIndicators.ContainsKey(table)) { HeatIndicatorController heatIndicatorController = this.m_radialIndicators[table]; heatIndicatorController.EndEffect(); this.m_radialIndicators.Remove(table); } }
private void TableChicken(FlippableCover obj) { PlayerController player = this.Owner; if (player.HasPickupID(400)) { HandleChickenEffect(); } }
public void AmpedCover(FlippableCover obj) { if (obj != null) { SpeculativeRigidbody cover = obj.specRigidbody; obj.specRigidbody.OnPreRigidbodyCollision += this.OnPreCollison; } }
private void BloodTable(FlippableCover obj) { obj.specRigidbody.CanBePushed = false; obj.specRigidbody.PrimaryPixelCollider.CollisionLayer = CollisionLayer.BulletBlocker; foreach (PixelCollider collider in obj.specRigidbody.GetPixelColliders()) { collider.CollisionLayer = CollisionLayer.BulletBlocker; } }
public void Update() { if (m_WasKicked) { if (GetAbsoluteParentRoom() == null) { m_WasKicked = false; willDefinitelyExplode = true; SelfDestructOnKick(); } FlippableCover m_Table = GetComponent <FlippableCover>(); if (m_Table) { if (m_Table.IsBroken) { m_WasKicked = false; willDefinitelyExplode = true; SelfDestructOnKick(); } } } if (m_shouldDisplayOutline) { int num; DungeonData.Direction inverseDirection = DungeonData.GetInverseDirection(DungeonData.GetDirectionFromIntVector2(GetFlipDirection(m_lastInteractingPlayer.specRigidbody, out num))); if (inverseDirection != m_lastOutlineDirection || sprite.spriteId != m_lastSpriteId) { SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); SpriteOutlineManager.AddSingleOutlineToSprite <tk2dSprite>(sprite, DungeonData.GetIntVector2FromDirection(inverseDirection), Color.white, 0.25f, 0f); } m_lastOutlineDirection = inverseDirection; m_lastSpriteId = sprite.spriteId; } if (leavesGoopTrail && specRigidbody.Velocity.magnitude > 0.1f) { m_goopElapsed += BraveTime.DeltaTime; if (m_goopElapsed > goopFrequency) { m_goopElapsed -= BraveTime.DeltaTime; if (m_goopManager == null) { m_goopManager = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(goopType); } m_goopManager.AddGoopCircle(sprite.WorldCenter, goopRadius + 0.1f, -1, false, -1); } if (AllowTopWallTraversal && GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(sprite.WorldCenter.ToIntVector2(VectorConversions.Floor)) && GameManager.Instance.Dungeon.data[sprite.WorldCenter.ToIntVector2(VectorConversions.Floor)].IsFireplaceCell) { MinorBreakable component = GetComponent <MinorBreakable>(); if (component && !component.IsBroken) { component.Break(Vector2.zero); GameStatsManager.Instance.SetFlag(GungeonFlags.FLAG_ROLLED_BARREL_INTO_FIREPLACE, true); } } } }
private IEnumerator HandleExpand(FlippableCover target) { string TableName = target.gameObject.name; yield return(new WaitForSeconds(0.15f)); if (target && target.specRigidbody) { AkSoundEngine.PostEvent("Play_WPN_woodbeam_extend_01", gameObject); target.specRigidbody.CanBePushed = false; // Vector3 SpriteOffset = target.transform.position; DungeonData.Direction DirectionFlipped = target.DirectionFlipped; // SpriteOffset -= new Vector3(1.4f, 1.6f, 0); // target.transform.position = SpriteOffset; yield return(null); // if (target.specRigidbody) { target.specRigidbody.CanBePushed = false; } float elapsed = 0f; Vector2 scaleAmount = new Vector2(TableScaleAmount, TableScaleAmount); if (!target) { yield break; } Vector2 startScale = target.transform.localScale; while (elapsed < TableExpandSpeed) { if (!target) { yield break; } elapsed += BraveTime.DeltaTime; target.transform.localScale = Vector2.Lerp(startScale, scaleAmount, (elapsed * TableExpandSpeed)); /*if (DirectionFlipped == DungeonData.Direction.EAST && TableName.ToLower().Contains("horizontal")) { * target.transform.position -= new Vector3(0.04f, 0.02f, 0); * } else { * target.transform.position -= new Vector3(0.02f, 0.02f, 0); * }*/ if (target.sprite) { target.sprite.UpdateZDepth(); } if (target.specRigidbody) { target.specRigidbody.UpdateCollidersOnRotation = true; target.specRigidbody.UpdateCollidersOnScale = true; target.specRigidbody.RegenerateColliders = true; // target.specRigidbody.UpdateColliderPositions(); target.specRigidbody.Reinitialize(); } yield return(null); } } yield break; }
private void HandleFlip(FlippableCover table) { PlayerController player = (GameManager.Instance.PrimaryPlayer); bool flag = this.shield != null && this.shield.gameObject; if (flag) { this.shield.ThrowShield(); } this.shield = this.CreateEffect(player, 4, 2f); }
private void TableQuest(FlippableCover cover) { if (Table == true) { TableNum += 1; if (TableNum == TableReq) { QuestComplete = true; RewardDue = true; } } }
private void StealthEffect(FlippableCover obj) { PlayerController player = this.Owner; this.BreakStealth(player); player.OnItemStolen += this.BreakStealthOnSteal; player.ChangeSpecialShaderFlag(1, 1f); player.healthHaver.OnDamaged += this.OnDamaged; player.SetIsStealthed(true, "table"); player.SetCapableOfStealing(true, "table", null); GameManager.Instance.StartCoroutine(this.Unstealthy()); }
private void SpeedEffect(FlippableCover obj) { int ammoToGive = -1; if (Owner.HasPickupID(134)) { ammoToGive = UnityEngine.Random.Range(5, 10); } else { ammoToGive = UnityEngine.Random.Range(1, 5); } Owner.CurrentGun.GainAmmo(ammoToGive); }
private void HandleMirrorEffect(TableTechChaosEffectIdentifier identifier, FlippableCover obj) { if (identifier == TableTechChaosEffectIdentifier.MIRROR) { AkSoundEngine.PostEvent("Play_WPN_kthulu_soul_01", obj.gameObject); obj.sprite.usesOverrideMaterial = true; tk2dSprite tk2dSprite = obj.sprite as tk2dSprite; tk2dSprite.GenerateUV2 = true; Material material = Instantiate <Material>(obj.sprite.renderer.material); material.DisableKeyword("TINTING_OFF"); material.EnableKeyword("TINTING_ON"); material.SetColor("_OverrideColor", new Color(0f, 1f, 1f)); material.DisableKeyword("EMISSIVE_OFF"); material.EnableKeyword("EMISSIVE_ON"); material.SetFloat("_EmissivePower", 1.75f); material.SetFloat("_EmissiveColorPower", 1f); obj.sprite.renderer.material = material; Shader shader = Shader.Find("Brave/ItemSpecific/MetalSkinLayerShader"); MeshRenderer component = obj.sprite.GetComponent <MeshRenderer>(); Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if (sharedMaterials[i].shader == shader) { return; } } Array.Resize <Material>(ref sharedMaterials, sharedMaterials.Length + 1); Material material2 = new Material(shader); material2.SetTexture("_MainTex", sharedMaterials[0].GetTexture("_MainTex")); sharedMaterials[sharedMaterials.Length - 1] = material2; component.sharedMaterials = sharedMaterials; tk2dSprite.ForceBuild(); obj.specRigidbody.OnPreRigidbodyCollision += new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate( delegate(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody.projectile != null && !(otherRigidbody.projectile.Owner is PlayerController) && base.Owner != null) { PassiveReflectItem.ReflectBullet(otherRigidbody.projectile, true, base.Owner, 10f, 1f, 1f, 0f); otherRigidbody.RegisterSpecificCollisionException(obj.specRigidbody); PhysicsEngine.SkipCollision = true; } } ); if (base.Owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { obj.gameObject.AddComponent <MirrorBreakSynergyProcessor>().Initialize(); } } }
private void OnFlipCompleted(FlippableCover obj) { TableTechChaosFlipCompletionIdentifier completionIdentifier = obj.GetComponent <TableTechChaosFlipCompletionIdentifier>(); if (completionIdentifier != null) { TableTechChaosEffect effect = completionIdentifier.effect; this.HandleMoneyEffect(effect.identifier, obj); this.HandleProjectileEffect(effect.identifier, obj); this.HandleTableFlocking(effect.identifier, obj); this.HandleMirrorEffect(effect.identifier, obj); Destroy(completionIdentifier); } }
private void HandleTableFlocking(TableTechChaosEffectIdentifier identifier, FlippableCover table) { if (identifier == TableTechChaosEffectIdentifier.FLOCKING) { RoomHandler currentRoom = base.Owner.CurrentRoom; ReadOnlyCollection <IPlayerInteractable> roomInteractables = currentRoom.GetRoomInteractables(); for (int i = 0; i < roomInteractables.Count; i++) { if (currentRoom.IsRegistered(roomInteractables[i])) { FlippableCover flippableCover = roomInteractables[i] as FlippableCover; if (flippableCover != null && !flippableCover.IsFlipped && !flippableCover.IsGilded) { if (flippableCover.flipStyle == FlippableCover.FlipStyle.ANY) { flippableCover.ForceSetFlipper(base.Owner); flippableCover.Flip(table.DirectionFlipped); } else if (flippableCover.flipStyle == FlippableCover.FlipStyle.ONLY_FLIPS_LEFT_RIGHT) { if (table.DirectionFlipped == DungeonData.Direction.NORTH || table.DirectionFlipped == DungeonData.Direction.SOUTH) { flippableCover.ForceSetFlipper(base.Owner); flippableCover.Flip((UnityEngine.Random.value <= 0.5f) ? DungeonData.Direction.WEST : DungeonData.Direction.EAST); } else { flippableCover.ForceSetFlipper(base.Owner); flippableCover.Flip(table.DirectionFlipped); } } else if (flippableCover.flipStyle == FlippableCover.FlipStyle.ONLY_FLIPS_UP_DOWN) { if (table.DirectionFlipped == DungeonData.Direction.EAST || table.DirectionFlipped == DungeonData.Direction.WEST) { flippableCover.ForceSetFlipper(base.Owner); flippableCover.Flip((UnityEngine.Random.value <= 0.5f) ? DungeonData.Direction.SOUTH : DungeonData.Direction.NORTH); } else { flippableCover.ForceSetFlipper(base.Owner); flippableCover.Flip(table.DirectionFlipped); } } } } } } }
private void HandleTableVolley(TableTechChaosEffectIdentifier identifier, FlippableCover table) { if (identifier == TableTechChaosEffectIdentifier.TABLE_VOLLEY) { IntVector2 intVector2FromDirection = DungeonData.GetIntVector2FromDirection(table.DirectionFlipped); ProjectileVolleyData sourceVolley = this.Volley; float d = 1f; if (this.m_owner && this.m_owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { sourceVolley = this.VolleyOverride; d = 2f; } VolleyUtility.FireVolley(sourceVolley, table.sprite.WorldCenter + intVector2FromDirection.ToVector2() * d, intVector2FromDirection.ToVector2(), this.m_owner, false); } }
private void SpawnFoldingTable() { Vector2 nearbyPoint = Owner.CenterPosition + (Owner.unadjustedAimPoint.XY() - Owner.CenterPosition).normalized; IntVector2? nearestAvailableCell = Owner.CurrentRoom.GetNearestAvailableCell(nearbyPoint, new IntVector2?(IntVector2.One), new CellTypes?(CellTypes.FLOOR), false, null); FoldingTableItem component6 = PickupObjectDatabase.GetById(644).GetComponent <FoldingTableItem>(); GameObject gameObject5 = component6.TableToSpawn.gameObject; GameObject gameObject6 = UnityEngine.Object.Instantiate <GameObject>(gameObject5.gameObject, nearestAvailableCell.Value.ToVector2(), Quaternion.identity); SpeculativeRigidbody componentInChildren = gameObject6.GetComponentInChildren <SpeculativeRigidbody>(); FlippableCover component7 = gameObject6.GetComponent <FlippableCover>(); component7.transform.position.XY().GetAbsoluteRoom().RegisterInteractable(component7); component7.ConfigureOnPlacement(component7.transform.position.XY().GetAbsoluteRoom()); componentInChildren.Initialize(); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(componentInChildren, null, false); }
public void FlipHook(Action <FlippableCover, SpeculativeRigidbody> orig, FlippableCover self, SpeculativeRigidbody flipperRigidbody) { try { orig(self, flipperRigidbody); if (self && flipperRigidbody && flipperRigidbody.gameObject.GetComponent <AIActor>()) { AkSoundEngine.PostEvent("Play_EX_TableAssassin_01", self.gameObject); GameManager.Instance.StartCoroutine(HandleDelayedTableExplosion(self, flipperRigidbody, 1)); } } catch (Exception ex) { ETGModConsole.Log("[ExpandTheGungeon] WARNING: Excpetion caught in TableTechAssassinHook.FlipHook!"); Debug.Log("[ExpandTheGungeon] WARNING: Excpetion caught in TableTechAssassinHook.FlipHook!"); Debug.LogException(ex, self); } }
private void HandleRadialIndicator(FlippableCover table) { if (this.m_radialIndicators == null) { this.m_radialIndicators = new Dictionary <FlippableCover, HeatIndicatorController>(); } if (!this.m_radialIndicators.ContainsKey(table)) { Vector3 position = (!table.sprite) ? table.transform.position : table.sprite.WorldCenter.ToVector3ZisY(0f); this.m_radialIndicators.Add(table, ((GameObject)UnityEngine.Object.Instantiate(ResourceCache.Acquire("Global VFX/HeatIndicator"), position, Quaternion.identity, table.transform)).GetComponent <HeatIndicatorController>()); int num = -1; float currentRadius = (!Toolbox.AnyoneHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS", out num)) ? 5f : 20f; this.m_radialIndicators[table].CurrentRadius = currentRadius; } }
private void SpeedEffect(FlippableCover obj) { PlayerController owner = base.Owner; owner.PlayEffectOnActor(EasyVFXDatabase.SpeedUpVFX, new Vector3(0, 0.25f, 0), true, true); PlayerToolbox tools = owner.GetComponent <PlayerToolbox>(); if (tools) { float time = 7f; if (owner.PlayerHasActiveSynergy("Sound Barrier")) { time = 14f; } tools.DoTimedStatModifier(PlayerStats.StatType.MovementSpeed, 2f, time, StatModifier.ModifyMethod.ADDITIVE); } }