public static void ShowHitBox(this SpeculativeRigidbody body) { PixelCollider hitbox = body.HitboxPixelCollider; GameObject hitboxDisplay = GameObject.CreatePrimitive(PrimitiveType.Cube); hitboxDisplay.name = "HitboxDisplay"; hitboxDisplay.transform.SetParent(body.transform); Tools.Print($"{body.name}"); Tools.Print($" Offset: {hitbox.Offset}, Dimesions: {hitbox.Dimensions}"); hitboxDisplay.transform.localScale = new Vector3((float)hitbox.Dimensions.x / 16f, (float)hitbox.Dimensions.y / 16f, 1f); Vector3 localPosition = new Vector3((float)hitbox.Offset.x + (float)hitbox.Dimensions.x * 0.5f, (float)hitbox.Offset.y + (float)hitbox.Dimensions.y * 0.5f, -16f) / 16f; hitboxDisplay.transform.localPosition = localPosition; }
private void HandlePreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { bool flag = otherRigidbody && otherRigidbody.healthHaver; if (flag) { if (myRigidbody.projectile.baseData.damage > otherRigidbody.healthHaver.GetCurrentHealth()) { this.extraDamage = myRigidbody.projectile.baseData.damage - otherRigidbody.healthHaver.GetCurrentHealth(); this.hasExtraDamage = true; Material outlineMaterial = SpriteOutlineManager.GetOutlineMaterial(base.Owner.sprite); outlineMaterial.SetColor("_OverrideColor", new Color32(120, 190, 85, 50)); } } }
private void OnPreCollision(SpeculativeRigidbody otherRigidbody, SpeculativeRigidbody source, CollisionData collisionData) { if (this.m_hasBeenPickedUp) { return; } PlayerController component = otherRigidbody.GetComponent <PlayerController>(); if (component != null) { this.m_hasBeenPickedUp = true; SpriteOutlineManager.RemoveOutlineFromSprite(base.sprite, true); this.Pickup(component); } }
private void OnPreCollison(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody other, PixelCollider otherCollider) { bool flag = Owner != null; if (flag) { Projectile component = other.GetComponent <Projectile>(); bool flag2 = component != null && !(component.Owner is PlayerController); if (flag2) { rockpoints++; AkSoundEngine.PostEvent("Play_WPN_radgun_cool_01", base.gameObject); } } }
private void AssignEnemy(Projectile proj, SpeculativeRigidbody enemyRigidbody, bool fatal) { if (enemyRigidbody == null || enemyRigidbody.aiActor == null) { return; } if (enemyRigidbody != null && enemyRigidbody.aiActor != null) { AIActor aiactor = enemyRigidbody.aiActor; if (aiactor.healthHaver != null && aiactor.healthHaver.IsAlive) { this.lockonEnemy = aiactor; } } }
public void hitenemyhandleruncharge(Projectile proj, SpeculativeRigidbody body, bool yes) { if (yes) { //BecomeOrbitProjectileModifier become = proj.gameObject.AddComponent<BecomeOrbitProjectileModifier>(); OrbitProjectileMotionModule orbiter = proj.gameObject.GetComponent <OrbitProjectileMotionModule>(); orbiter.lifespan = 99999f; orbiter.MaxRadius = 3; orbiter.MinRadius = 3; orbiter.alternateOrbitTarget = body; /// WHY YOU NO SPIN AUUUUUUUUUUUGHHH } }
private void OnHitEnemy(Projectile self, SpeculativeRigidbody enemy, bool fatal) { if (ActiveBullets.Contains(self)) { if (enemy && enemy.gameActor) { float chance = 1f; if (enemy.healthHaver && enemy.healthHaver.IsBoss) { chance = 0.33f; } enemy.gameActor.DeleteOwnedBullets(chance); } } }
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); }
private void HitEnemy(Projectile projectile, SpeculativeRigidbody enemy, bool killed) { PlayerController player = gun.CurrentOwner as PlayerController; BounceProjModifier bounce = projectile.gameObject.GetOrAddComponent <BounceProjModifier>(); if (bounce.numberOfBounces > 1 && !player.HasPickupID(ETGMod.Databases.Items["Floop Bullets"].PickupObjectId)) { bounce.numberOfBounces--; PierceProjModifier orAddComponent = projectile.gameObject.GetOrAddComponent <PierceProjModifier>(); orAddComponent.penetratesBreakables = true; orAddComponent.penetration++; Vector2 dirVec = UnityEngine.Random.insideUnitCircle; projectile.SendInDirection(dirVec, false, true); } }
// Token: 0x0600025B RID: 603 RVA: 0x000196DC File Offset: 0x000178DC public override DebrisObject Drop(PlayerController player) { player.GetComponent <DynamiteGuon.BaBoom>().Destroy(); DynamiteGuon.guonHook.Dispose(); GameManager.Instance.OnNewLevelFullyLoaded -= this.FixGuon; bool flag = this.m_extantOrbital != null; bool flag2 = flag; if (flag2) { SpeculativeRigidbody specRigidbody = this.m_extantOrbital.GetComponent <PlayerOrbital>().specRigidbody; specRigidbody.OnPreRigidbodyCollision = (SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate)Delegate.Remove(specRigidbody.OnPreRigidbodyCollision, new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate(this.OnPreCollison)); } return(base.Drop(player)); }
public static void TutorialEndRedirect(System.Action <FoyerGungeonDoor, SpeculativeRigidbody, SpeculativeRigidbody, CollisionData> orig, FoyerGungeonDoor self, SpeculativeRigidbody specRigidbody, SpeculativeRigidbody sourceSpecRigidbody, CollisionData collisionData) { if (self.ReturnToFoyerFromTutorial) { Module.TutorialDone = true; GameManager.Instance.QuickRestart(); } else { orig(self, specRigidbody, sourceSpecRigidbody, collisionData); } }
private void Start() { if (m_room == null) { m_room = GetAbsoluteParentRoom(); } if (m_room != null) { SpeculativeRigidbody SpecRigidbody = specRigidbody; if (SpecRigidbody) { SpecRigidbody.OnTriggerCollision = (SpeculativeRigidbody.OnTriggerDelegate)Delegate.Combine(SpecRigidbody.OnTriggerCollision, new SpeculativeRigidbody.OnTriggerDelegate(HandleTriggerCollision)); } } }
private void OnHitEnemy(Projectile arg1, SpeculativeRigidbody arg2, bool arg3) { if (arg2 != null && arg2.aiActor != null && Owner != null) { if (BoxOTools.BasicRandom(.85f)) { GameActorWitherEffect witherEffect = wither; if (Owner.PlayerHasActiveSynergy("Withered away")) { wither.duration *= 2; } arg2.aiActor.ApplyEffect(witherEffect, 1f, null); } } }
private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool fuckingsomethingidk) { int bighead = UnityEngine.Random.Range(1, 11); if (bighead == 1) { if (enemy.aiActor.EnemyGuid != "01972dee89fc4404a5c408d50007dad5") { if (enemy.aiActor.healthHaver.IsBoss == false) { enemy.aiActor.Transmogrify(EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"), (GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof")); } } } }
private void OnPostRigidbodyMovement(SpeculativeRigidbody specRigidbody, Vector2 unitDelta, IntVector2 pixelDelta) { if (!m_behaviorSpeculator) { return; } List <CollisionData> list = new List <CollisionData>(); bool flag = false; if (PhysicsEngine.Instance.OverlapCast(m_aiActor.specRigidbody, list, true, true, null, null, false, null, null, new SpeculativeRigidbody[0])) { for (int i = 0; i < list.Count; i++) { SpeculativeRigidbody otherRigidbody = list[i].OtherRigidbody; if (otherRigidbody && otherRigidbody.transform.parent) { if (otherRigidbody.transform.parent.GetComponent <DungeonDoorSubsidiaryBlocker>() || otherRigidbody.transform.parent.GetComponent <DungeonDoorController>()) { flag = true; break; } } } } if (flag) { if (m_collisionNormal.y >= 0.5f) { m_aiActor.transform.position += new Vector3(0f, 0.5f); } if (m_collisionNormal.x <= -0.5f) { m_aiActor.transform.position += new Vector3(-0.3125f, 0f); } if (m_collisionNormal.x >= 0.5f) { m_aiActor.transform.position += new Vector3(0.3125f, 0f); } m_aiActor.specRigidbody.Reinitialize(); } else { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(m_aiActor.specRigidbody, null, false); } SpeculativeRigidbody specRigidbody2 = m_aiActor.specRigidbody; specRigidbody2.OnPostRigidbodyMovement = (Action <SpeculativeRigidbody, Vector2, IntVector2>)Delegate.Remove(specRigidbody2.OnPostRigidbodyMovement, new Action <SpeculativeRigidbody, Vector2, IntVector2>(OnPostRigidbodyMovement)); }
private IEnumerator HandleSwing(PlayerController user, Vector2 aimVec, float rayDamage, float rayLength) { float elapsed = 0f; while (elapsed < .1) { elapsed += BraveTime.DeltaTime; SpeculativeRigidbody hitRigidbody = this.IterativeRaycast(user.CenterPosition, aimVec, rayLength, int.MaxValue, user.specRigidbody); if (hitRigidbody && hitRigidbody.aiActor && !hitRigidbody.aiActor.healthHaver.IsBoss && hitRigidbody.aiActor.IsNormalEnemy) { hitRigidbody.aiActor.healthHaver.ApplyDamage(rayDamage, aimVec, "Hero's Sword", CoreDamageTypes.None, DamageCategory.Normal, false, null, false); user.IsEthereal = true; user.SetIsStealthed(true, "cause they just are"); PassiveItem.IncrementFlag(user, typeof(LiveAmmoItem)); if (modifierController == 0) { user.MovementModifiers += this.NoMotionModifier; user.IsStationary = true; modifierController++; } user.CurrentStoneGunTimer = 9999999f; this.LastOwner.stats.RecalculateStats(LastOwner, true); host = hitRigidbody.aiActor; MindControlEffect orAddComponent = host.gameObject.GetOrAddComponent <MindControlEffect>(); orAddComponent.owner = user; host.CompanionOwner = user; host.aiActor.SetAIMovementContribution(Vector2.zero); host.BaseMovementSpeed = 15; host.IsWorthShootingAt = true; host.IgnoreForRoomClear = true; host.HitByEnemyBullets = true; host.UniquePlayerTargetFlag = true; CompanionisedEnemyBulletModifiers friend = host.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>(); friend.Start(); host.Update(); TargetNumber1(host, user); CamToggle = 1; } yield return(null); } yield break; }
public static SpeculativeRigidbody SetUpSpeculativeRigidbody(this tk2dSprite sprite, IntVector2 offset, IntVector2 dimensions) { SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent <SpeculativeRigidbody>(sprite.gameObject); PixelCollider pixelCollider = new PixelCollider(); pixelCollider.ColliderGenerationMode = 0; pixelCollider.CollisionLayer = CollisionLayer.EnemyCollider; pixelCollider.ManualWidth = dimensions.x; pixelCollider.ManualHeight = dimensions.y; pixelCollider.ManualOffsetX = offset.x; pixelCollider.ManualOffsetY = offset.y; orAddComponent.PixelColliders = new List <PixelCollider> { pixelCollider }; return(orAddComponent); }
private void DoBlankDisappear(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody other, PixelCollider otherCollider) { PlayerController owner = base.Owner; Projectile component = other.GetComponent <Projectile>(); if (component != null && !(component.Owner is PlayerController)) { GameObject silencerVFX = (GameObject)ResourceCache.Acquire("Global VFX/BlankVFX_Ghost"); AkSoundEngine.PostEvent("Play_OBJ_silenceblank_small_01", base.gameObject); GameObject gameObject = new GameObject("silencer"); SilencerInstance silencerInstance = gameObject.AddComponent <SilencerInstance>(); float additionalTimeAtMaxRadius = 0.25f; silencerInstance.TriggerSilencer(myRigidbody.UnitCenter, 25f, 5f, silencerVFX, 0f, 3f, 3f, 3f, 250f, 5f, additionalTimeAtMaxRadius, owner, false, false); } ArmourGuonStone.guonHook.Dispose(); }
private void HandlePreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody.gameObject.name != null) { if (otherRigidbody.gameObject.name == "Table_Vertical" || otherRigidbody.gameObject.name == "Table_Horizontal") { if (!tablesHitAlready.Contains(otherRigidbody)) { tablesHitAlready.Add(otherRigidbody); myRigidbody.projectile.baseData.damage *= 1.2f; myRigidbody.projectile.RuntimeUpdateScale(1.2f); } PhysicsEngine.SkipCollision = true; } } }
private void ControlJammingShots(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody && otherRigidbody.projectile) { if (otherRigidbody.projectile.Owner is AIActor) { if (!otherRigidbody.projectile.IsBlackBullet && otherRigidbody.projectile.CanBecomeBlackBullet) { otherRigidbody.projectile.BecomeBlackBullet(); } } bool isShootableBullet = otherRigidbody.projectile.collidesWithProjectiles; PhysicsEngine.SkipCollision = true; } }
private IEnumerator HandleSwing(PlayerController user, Vector2 aimVec, float rayDamage, float rayLength) { float elapsed = 0f; while (elapsed < 1) { elapsed += BraveTime.DeltaTime; SpeculativeRigidbody hitRigidbody = this.IterativeRaycast(user.CenterPosition, aimVec, rayLength, int.MaxValue, user.specRigidbody); if (hitRigidbody && hitRigidbody.aiActor && hitRigidbody.aiActor.IsNormalEnemy) { hitRigidbody.aiActor.healthHaver.ApplyDamage(rayDamage, aimVec, "Hero's Sword", CoreDamageTypes.None, DamageCategory.Normal, false, null, false); } yield return(null); } yield break; }
private void PostProcessBeam(BeamController beam, SpeculativeRigidbody hitRigidBody, float tickrate) { float procChance = 0.12f; beam.AdjustPlayerBeamTint(ExtendedColours.plaguePurple, 1, 0f); GameActor gameActor = hitRigidBody.gameActor; if (!gameActor) { return; } if (UnityEngine.Random.value < BraveMathCollege.SliceProbability(procChance, tickrate)) { hitRigidBody.gameActor.ApplyEffect(StaticStatusEffects.StandardPlagueEffect); } }
private void PostProcessBeam(BeamController beam, SpeculativeRigidbody hitRigidBody, float tickrate) { float procChance = 0.09f; beam.AdjustPlayerBeamTint(ExtendedColours.vibrantOrange, 1, 0f); GameActor gameActor = hitRigidBody.gameActor; if (!gameActor) { return; } if (UnityEngine.Random.value < BraveMathCollege.SliceProbability(procChance, tickrate)) { hitRigidBody.gameActor.ApplyEffect(StatusEffectHelper.GenerateSizeEffect(10, new Vector2(0.4f, 0.4f))); } }
public bool IsInRange(AIActor enemy) { bool flag; if (enemy == null) { flag = true; } else { SpeculativeRigidbody specRigidbody = enemy.specRigidbody; Vector2?vector = (specRigidbody != null) ? new Vector2?(specRigidbody.UnitCenter) : null; flag = (vector == null); } return(!flag && Vector2.Distance(this.m_aiActor.specRigidbody.UnitCenter, enemy.specRigidbody.UnitCenter) <= this.GetMinReadyRange()); }
private void MaybeReflect(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { if (otherRigidbody.projectile != null) { Projectile proj = otherRigidbody.projectile; if (!proj.IsBlackBullet) { PassiveReflectItem.ReflectBullet(proj, true, this.m_owner, 20f, 1, 1.25f, 0); } else if (this.m_advancedSynergyUpgradeActive) { PassiveReflectItem.ReflectBullet(proj, true, this.m_owner, 10f, 1f, 1f, 0f); } PhysicsEngine.SkipCollision = true; } }
public void OnBeamTick(BeamController bem, SpeculativeRigidbody enemy, float what) { if (Owner && Owner.CurrentGoop != null) { if (Owner.CurrentGoop.HealthModifierEffect != null && Owner.CurrentGoop.AppliesDamageOverTime && !(Owner.CurrentGoop.HealthModifierEffect is GameActorPlagueEffect)) { if (bem.GetComponent <Projectile>()) { if (enemy.GetComponent <GameActor>()) { enemy.GetComponent <GameActor>().ApplyEffect(Owner.CurrentGoop.HealthModifierEffect); } } } } }
private void HandleTriggerEntered(SpeculativeRigidbody specRigidbody, SpeculativeRigidbody sourceSpecRigidbody, CollisionData collisionData) { PlayerController component = specRigidbody.GetComponent <PlayerController>(); if (component) { if (IsSecretGlitchFloorPit) { GameManager.Instance.InjectedFlowPath = "secretglitchfloor_flow"; ExpandUtility.RatDungeon = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat"); ExpandUtility.RatDungeon.LevelOverrideType = GameManager.LevelOverrideState.NONE; ExpandPrefabs.InitCanyonTileSet(ExpandUtility.RatDungeon, GlobalDungeonData.ValidTilesets.PHOBOSGEON); } component.LevelToLoadOnPitfall = targetLevelName; } }
public IntVector2 GetFlipDirection(SpeculativeRigidbody kickerRigidbody, out int quadrant) { Vector2 inVec = new Vector2(0, 1); if (specRigidbody != null) { inVec = specRigidbody.UnitCenter - kickerRigidbody.UnitCenter; } else if (sprite != null) { inVec = sprite.WorldCenter - kickerRigidbody.UnitCenter; } quadrant = BraveMathCollege.VectorToQuadrant(inVec); return(IntVector2.Cardinals[quadrant]); }
public void PostProcessBeamTick(BeamController beam, SpeculativeRigidbody hitRigidbody, float tickRate) { GameActor gameActor = hitRigidbody.gameActor; if (!gameActor) { return; } if (UnityEngine.Random.value < BraveMathCollege.SliceProbability(this.chanceFromBeamPerSecond, tickRate)) { if (this.AppliesFire) { gameActor.ApplyEffect(this.FireModifierEffect, 1f, null); } } }
private void ReflectProjectile(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { Projectile component = otherRigidbody.GetComponent <Projectile>(); if (component != null && !(component.Owner is PlayerController)) { if (UnityEngine.Random.value < .16f) { PassiveReflectItem.ReflectBullet(component, true, Owner.specRigidbody.gameActor, 40f, 1f, .5f, 0f); PhysicsEngine.SkipCollision = true; Material outlineMaterial = SpriteOutlineManager.GetOutlineMaterial(component.sprite); Color specialPink = new Color(254, 126, 229, 50f); outlineMaterial.SetColor("_OverrideColor", specialPink); } } }