protected Vector2 AdjustInputVector(Vector2 rawInput, float cardinalMagnetAngle, float ordinalMagnetAngle) { float num = BraveMathCollege.ClampAngle360(BraveMathCollege.Atan2Degrees(rawInput)); float num2 = num % 90f; float num3 = (num + 45f) % 90f; float num4 = 0f; if (cardinalMagnetAngle > 0f) { if (num2 < cardinalMagnetAngle) { num4 = -num2; } else if (num2 > 90f - cardinalMagnetAngle) { num4 = 90f - num2; } } if (ordinalMagnetAngle > 0f) { if (num3 < ordinalMagnetAngle) { num4 = -num3; } else if (num3 > 90f - ordinalMagnetAngle) { num4 = 90f - num3; } } num += num4; return((Quaternion.Euler(0f, 0f, num) * Vector3.right).XY() * rawInput.magnitude); }
public override void OnReloadPressedSafe(PlayerController player, Gun gun, bool manualReload) { if ((gun.ClipCapacity == gun.ClipShotsRemaining) || (gun.CurrentAmmo == gun.ClipShotsRemaining)) { if (gun.CurrentAmmo >= 5) { if (this.m_extantReticleQuad) //If the cursor is there, then do the teleport { gun.CurrentAmmo -= 5; Vector2 worldCenter = this.m_extantReticleQuad.WorldCenter; UnityEngine.Object.Destroy(this.m_extantReticleQuad.gameObject); worldCenter += new Vector2(1.5f, 1.5f); //worldCenter = new Vector2(Mathf.FloorToInt(worldCenter.x), Mathf.FloorToInt(worldCenter.y)); // UnityEngine.Object.Instantiate<GameObject>((PickupObjectDatabase.GetById(Pencil.pencilID) as Gun).DefaultModule.projectiles[0].gameObject, new Vector3(worldCenter.x, worldCenter.y), Quaternion.identity); TeleportPlayerToCursorPosition.StartTeleport(player, worldCenter); } else //If the cursor is not there, make it { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.reticleQuad); this.m_extantReticleQuad = gameObject.GetComponent <tk2dBaseSprite>(); this.m_currentAngle = BraveMathCollege.Atan2Degrees(player.unadjustedAimPoint.XY() - player.CenterPosition); this.m_currentDistance = 5f; this.UpdateReticlePosition(); } } } }
void Update() { if (projectile) { Vector2 position = projectile.specRigidbody.UnitCenter; Vector2 direction = projectile.LastVelocity.normalized; int thePointOfTheMaskIs = CollisionMask.LayerToMask(CollisionLayer.HighObstacle, CollisionLayer.BulletBlocker, CollisionLayer.EnemyHitBox, CollisionLayer.BulletBreakable); PhysicsEngine.Instance.Raycast(position, direction, 100f, out RaycastResult result, true, true, thePointOfTheMaskIs); if (result != null && result.Contact != null) { tk2dTiledSprite component = SpawnManager.SpawnVFX(linkVFXPrefab, false).GetComponent <tk2dTiledSprite>(); PostBeamRender(component); Vector2 unitCenter = position; Vector2 unitCenter2 = result.Contact; component.transform.position = unitCenter; Vector2 vector = unitCenter2 - unitCenter; float num = BraveMathCollege.Atan2Degrees(vector.normalized); int num2 = Mathf.RoundToInt(vector.magnitude / 0.0625f); component.dimensions = new Vector2((float)num2, component.dimensions.y); component.transform.rotation = Quaternion.Euler(0f, 0f, num); component.UpdateZDepth(); ETGMod.StartGlobalCoroutine(doTimerMagic(component.gameObject, wait)); OnBeamHit(result.Contact, projectile); } projectile.DieInAir(); } }
private static bool ObjectWasHitBySlash(Vector2 ObjectPosition, Vector2 SlashPosition, float slashAngle, float SlashRange, float SlashDimensions) { if (Vector2.Distance(ObjectPosition, SlashPosition) < SlashRange) { float num7 = BraveMathCollege.Atan2Degrees(ObjectPosition - SlashPosition); float minRawAngle = Math.Min(SlashDimensions, -SlashDimensions); float maxRawAngle = Math.Max(SlashDimensions, -SlashDimensions); bool isInRange = false; float actualMaxAngle = slashAngle + maxRawAngle; float actualMinAngle = slashAngle + minRawAngle; if (num7.IsBetweenRange(actualMinAngle, actualMaxAngle)) { isInRange = true; } if (actualMaxAngle > 180) { float Overflow = actualMaxAngle - 180; if (num7.IsBetweenRange(-180, (-180 + Overflow))) { isInRange = true; } } if (actualMinAngle < -180) { float Underflow = actualMinAngle + 180; if (num7.IsBetweenRange((180 + Underflow), 180)) { isInRange = true; } } return(isInRange); } return(false); }
protected override void DoEffect(PlayerController player) { Vector2 vector = player.unadjustedAimPoint.XY() - player.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); player.StartCoroutine(this.HandleSwing(player, vector, 1f, 20f)); }
public static bool PositionBetweenRelativeValidAngles(this Vector2 positionToCheck, Vector2 startPosition, float centerAngle, float range, float validAngleVariation) { if (Vector2.Distance(positionToCheck, startPosition) < range) { float num7 = BraveMathCollege.Atan2Degrees(positionToCheck - startPosition); float minRawAngle = Math.Min(validAngleVariation, -validAngleVariation); float maxRawAngle = Math.Max(validAngleVariation, -validAngleVariation); bool isInRange = false; float actualMaxAngle = centerAngle + maxRawAngle; float actualMinAngle = centerAngle + minRawAngle; if (num7.IsBetweenRange(actualMinAngle, actualMaxAngle)) { isInRange = true; } if (actualMaxAngle > 180) { float Overflow = actualMaxAngle - 180; if (num7.IsBetweenRange(-180, (-180 + Overflow))) { isInRange = true; } } if (actualMinAngle < -180) { float Underflow = actualMinAngle + 180; if (num7.IsBetweenRange((180 + Underflow), 180)) { isInRange = true; } } return(isInRange); } return(false); }
private IEnumerator HandleFireShortBeam(Projectile projectileToSpawn, float duration) { float elapsed = 0f; float num2 = -1f; AIActor aiactor2 = this.m_extantOrbital.transform.position.GetAbsoluteRoom().GetNearestEnemy(this.m_extantOrbital.GetComponent <tk2dBaseSprite>().WorldCenter, out num2, true, true); BeamController beam = this.BeginFiringBeam(projectileToSpawn, this.m_owner, BraveMathCollege.Atan2Degrees(aiactor2.sprite.WorldCenter - this.m_extantOrbital.GetComponent <tk2dSprite>().WorldCenter), this.m_extantOrbital.GetComponent <tk2dBaseSprite>().WorldCenter); yield return(null); while (elapsed < duration) { if (!this || !this.m_extantOrbital || this.m_extantOrbital.transform.position.GetAbsoluteRoom() == null) { break; } float num = -1f; AIActor aiactor = this.m_extantOrbital.transform.position.GetAbsoluteRoom().GetNearestEnemy(this.m_extantOrbital.GetComponent <tk2dBaseSprite>().WorldCenter, out num, true, true); if (aiactor == null) { break; } elapsed += BraveTime.DeltaTime; this.ContinueFiringBeam(beam, BraveMathCollege.Atan2Degrees(aiactor.sprite.WorldCenter - this.m_extantOrbital.GetComponent <tk2dSprite>().WorldCenter), this.m_extantOrbital.GetComponent <tk2dBaseSprite>().WorldCenter); yield return(null); } this.CeaseBeam(beam); yield break; }
protected override void DoActiveEffect(PlayerController user) { base.DoActiveEffect(user); if (user.healthHaver != null) { user.healthHaver.TriggerInvulnerabilityPeriod(0.5f); } this.m_currentlyHeldEnemy.Dismount(); AIActor aiActor = this.m_currentlyHeldEnemy; KnockbackDoer knockbackDoer = aiActor.knockbackDoer; if (aiActor) { if (aiActor.specRigidbody != null) { aiActor.specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask(CollisionLayer.EnemyHitBox)); aiActor.specRigidbody.OnPreRigidbodyCollision += new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate(this.HandleHitEnemyHitEnemy); aiActor.specRigidbody.OnPreTileCollision += new SpeculativeRigidbody.OnPreTileCollisionDelegate(this.HandleHitTile); } } if (knockbackDoer) { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(GameManager.Instance.PrimaryPlayer.PlayerIDX); bool flag2 = instanceForPlayer == null; if (!flag2) { Vector2 vector = GameManager.Instance.PrimaryPlayer.unadjustedAimPoint.XY() - user.CenterPosition; Vector2 direction = BraveMathCollege.DegreesToVector(BraveMathCollege.Atan2Degrees(vector), 1); knockbackDoer.ApplyKnockback(direction, 800f, true); } } this.m_currentlyHeldEnemy = null; }
private void AimAt(GameObject obj, Vector2 point) { Vector2 v = point - obj.transform.position.XY(); float currentAimTarget = BraveMathCollege.Atan2Degrees(v); obj.transform.rotation = Quaternion.Euler(0f, 0f, currentAimTarget); }
private void UpdateReticlePosition() { PlayerController user = this.gun.GunPlayerOwner(); if (user) { if (BraveInput.GetInstanceForPlayer(user.PlayerIDX).IsKeyboardAndMouse(false)) { Vector2 vector = user.unadjustedAimPoint.XY(); Vector2 vector2 = vector - this.m_extantReticleQuad.GetBounds().extents.XY(); this.m_extantReticleQuad.transform.position = vector2; } else { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(user.PlayerIDX); Vector2 vector3 = user.CenterPosition + (Quaternion.Euler(0f, 0f, this.m_currentAngle) * Vector2.right).XY() * this.m_currentDistance; vector3 += instanceForPlayer.ActiveActions.Aim.Vector * 12f * BraveTime.DeltaTime; this.m_currentAngle = BraveMathCollege.Atan2Degrees(vector3 - user.CenterPosition); this.m_currentDistance = Vector2.Distance(vector3, user.CenterPosition); this.m_currentDistance = Mathf.Min(this.m_currentDistance, 100); vector3 = user.CenterPosition + (Quaternion.Euler(0f, 0f, this.m_currentAngle) * Vector2.right).XY() * this.m_currentDistance; Vector2 vector4 = vector3 - this.m_extantReticleQuad.GetBounds().extents.XY(); this.m_extantReticleQuad.transform.position = vector4; } } }
protected override void DoEffect(PlayerController player) { if (numberOfUses == 2) { Vector2 vector = player.unadjustedAimPoint.XY() - player.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); player.StartCoroutine(this.HandleSwing(player, vector, 0f, 20f)); } if (numberOfUses == 1) { player.CurrentStoneGunTimer = 1f; player.MovementModifiers -= this.NoMotionModifier; player.IsStationary = false; modifierController = 0; player.IsEthereal = false; if (host != null) { host.healthHaver.ApplyDamage(99999, Vector2.zero, "unbound", CoreDamageTypes.Magic, DamageCategory.Unstoppable, true, null, false); } player.SetIsStealthed(false, "cause they just are"); PassiveItem.DecrementFlag(player, typeof(LiveAmmoItem)); this.LastOwner.stats.RecalculateStats(LastOwner, true); CamToggle = 0; GameManager.Instance.MainCameraController.StartTrackingPlayer(); GameManager.Instance.MainCameraController.SetManualControl(false, true); } }
protected override void DoEffect(PlayerController user) { Projectile proj = ((Gun)ETGMod.Databases.Items["burning_hand"]).DefaultModule.projectiles[0]; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(this.LastOwner.PlayerIDX); bool flag2 = instanceForPlayer == null; float z = 0; if (!flag2) { bool flag3 = instanceForPlayer.IsKeyboardAndMouse(false); Vector2 a; if (flag3) { a = this.LastOwner.unadjustedAimPoint.XY() - base.sprite.WorldCenter; } else { bool flag4 = instanceForPlayer.ActiveActions == null; if (flag4) { return; } a = instanceForPlayer.ActiveActions.Aim.Vector; } a.Normalize(); z = BraveMathCollege.Atan2Degrees(a); } GameObject obj = SpawnManager.SpawnProjectile(proj.gameObject, user.sprite.WorldCenter, Quaternion.Euler(0, 0, z)); Projectile component = obj.GetComponent <Projectile>(); if (component != null) { component.Owner = user; component.Shooter = user.specRigidbody; component.AppliesFire = false; component.FireApplyChance = 0f; component.baseData.damage = 20f; if (UnityEngine.Random.value < 0.26f) { component.damageTypes = CoreDamageTypes.Void; component.AdditionalScaleMultiplier *= 2f; component.baseData.speed *= 2f; component.DefaultTintColor = Color.black; component.HasDefaultTint = true; } else { component.damageTypes = CoreDamageTypes.None; component.DefaultTintColor = Color.white; component.HasDefaultTint = true; } PierceProjModifier component2 = component.GetComponent <PierceProjModifier>(); if (component2 != null) { component2.penetratesBreakables = true; } } this.usesLeft -= 1; }
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; }
// Token: 0x06000120 RID: 288 RVA: 0x0000AC74 File Offset: 0x00008E74 private void Attack() { bool flag = this.Owner == null; if (flag) { this.Owner = this.m_aiActor.GetComponent <GlowingWomb.WombBehavior>().Owner; } float num = -1f; List <AIActor> activeEnemies = this.Owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); bool flag2 = activeEnemies == null | activeEnemies.Count <= 0; if (!flag2) { AIActor nearestEnemy = this.GetNearestEnemy(activeEnemies, this.m_aiActor.sprite.WorldCenter, out num, null); bool flag3 = nearestEnemy && num < 10f; if (flag3) { bool flag4 = this.IsInRange(nearestEnemy); if (flag4) { bool flag5 = !nearestEnemy.IsHarmlessEnemy && nearestEnemy.IsNormalEnemy && !nearestEnemy.healthHaver.IsDead && nearestEnemy != this.m_aiActor; if (flag5) { Vector2 unitCenter = this.m_aiActor.specRigidbody.UnitCenter; Vector2 unitCenter2 = nearestEnemy.specRigidbody.HitboxPixelCollider.UnitCenter; float z = BraveMathCollege.Atan2Degrees((unitCenter2 - unitCenter).normalized); Projectile projectile = ((Gun)ETGMod.Databases.Items[377]).DefaultModule.projectiles[0]; GameObject gameObject = SpawnManager.SpawnProjectile(projectile.gameObject, this.m_aiActor.sprite.WorldCenter, Quaternion.Euler(0f, 0f, z), true); Projectile component = gameObject.GetComponent <Projectile>(); bool flag6 = component != null; bool flag7 = flag6; if (flag7) { component.Owner = Owner; component.Shooter = this.m_aiActor.specRigidbody; if (Owner.HasPickupID(402) || Owner.HasPickupID(636)) { component.baseData.damage = 4f; component.AdditionalScaleMultiplier = 0.5f; } else { component.baseData.damage = 4f; component.AdditionalScaleMultiplier = 0.5f; } component.baseData.force = 1f; component.collidesWithPlayer = false; } } } } } }
// Token: 0x06000120 RID: 288 RVA: 0x0000AC74 File Offset: 0x00008E74 private void Attack() { bool flag = this.Owner == null; if (flag) { this.Owner = this.m_aiActor.GetComponent <BabyGoodShellicopter.ChopperBehavior>().Owner; } float num = -1f; List <AIActor> activeEnemies = this.Owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); bool flag2 = activeEnemies == null | activeEnemies.Count <= 0; if (!flag2) { AIActor nearestEnemy = this.GetNearestEnemy(activeEnemies, this.m_aiActor.sprite.WorldCenter, out num, null); bool flag3 = nearestEnemy && num < 10f; if (flag3) { bool flag4 = this.IsInRange(nearestEnemy); if (flag4) { bool flag5 = !nearestEnemy.IsHarmlessEnemy && nearestEnemy.IsNormalEnemy && !nearestEnemy.healthHaver.IsDead && nearestEnemy != this.m_aiActor; if (flag5) { if (UnityEngine.Random.value <= 0.1f) { this.m_aiActor.StartCoroutine(this.sayVoiceLine()); } float x = UnityEngine.Random.value; Vector2 unitCenter = this.m_aiActor.specRigidbody.UnitCenter; Vector2 unitCenter2 = nearestEnemy.specRigidbody.HitboxPixelCollider.UnitCenter; float z = BraveMathCollege.Atan2Degrees((unitCenter2 - unitCenter).normalized); if (x <= 0.2f) { this.m_aiActor.StartCoroutine(this.IgniteColumn1(z)); this.m_aiActor.StartCoroutine(this.IgniteColumn2(z)); DeadlyDeadlyGoopManager gooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(BabyGoodShellicopter.napalmGoop); gooper.TimedAddGoopLine(this.m_aiActor.sprite.WorldCenter, this.m_aiActor.sprite.WorldCenter + BraveMathCollege.DegreesToVector(z, 8), 0.8f, 2f); } else if (x <= 0.4f) { this.m_aiActor.StartCoroutine(shootRockets(z)); } else if (x <= 0.7f) { this.m_aiActor.StartCoroutine(eightShots()); } else { this.m_aiActor.StartCoroutine(eightShots2(z)); } } } } } }
public override void OnPostFired(PlayerController player, Gun gun) { AkSoundEngine.PostEvent("Stop_WPN_All", base.gameObject); gun.PreventNormalFireAudio = true; targetPoint = player.unadjustedAimPoint; if (shotcountcontroller == 1) { AkSoundEngine.PostEvent("Play_OBJ_hook_shot_01", base.gameObject); Projectile projectile1 = ((Gun)ETGMod.Databases.Items[25]).DefaultModule.projectiles[0]; GameObject gameObject1 = SpawnManager.SpawnProjectile(projectile1.gameObject, player.CurrentGun.sprite.WorldTopLeft, Quaternion.Euler(0f, 0f, (player.CurrentGun == null) ? 0f : player.CurrentGun.CurrentAngle), true); Projectile component1 = gameObject1.GetComponent <Projectile>(); setup = setup + 1; PierceProjModifier stab = component1.GetComponent <PierceProjModifier>(); stab.MaxBossImpacts = 0; stab.penetration = 0; bool flag = component1 != null; if (flag) { component1.Owner = player; component1.Shooter = player.specRigidbody; component1.baseData.speed = 30f; component1.baseData.range *= 1f; component1.baseData.damage = 10f; component1.AppliedStunDuration = 1f; component1.AppliesStun = true; component1.pierceMinorBreakables = true; } current_ball = component1; shotcountcontroller = 0; Gun gun3 = (Gun)PickupObjectDatabase.GetByEncounterName("Silencer"); gun.muzzleFlashEffects = gun3.muzzleFlashEffects; } else { Vector2 vector = player.unadjustedAimPoint.XY() - player.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); player.StartCoroutine(this.HandleSwing(player, vector, 100f, 2.25f)); if (Hooked_enemy != null) { Hooked_enemy.knockbackDoer.ApplyKnockback(-1 * vector, 100f); } Gun gun3 = (Gun)PickupObjectDatabase.GetByEncounterName("Silencer"); gun.muzzleFlashEffects = gun3.muzzleFlashEffects; gun.Update(); } current_ball.OnHitEnemy = (Action <Projectile, SpeculativeRigidbody, bool>)Delegate.Combine(current_ball.OnHitEnemy, new Action <Projectile, SpeculativeRigidbody, bool>(this.attach)); }
private void HandleShooting() { if (GameManager.Instance.IsPaused || !this.owner || this.owner.CurrentInputState != PlayerInputState.AllInput || this.owner.IsInputOverridden) { return; } if (targetToShoot == null) { return; } if (owner.IsStealthed) { return; } Projectile projectile = projectiles[currentShootIndex]; if (firingMode == FiringSequenceMode.SEQUENCE) { currentShootIndex++; if (currentShootIndex == projectiles.Count) { currentShootIndex = 0; } } else { projectile = projectiles[UnityEngine.Random.Range(0, projectiles.Count)]; } Vector2 a = FindPredictedTargetPosition(projectile); canShoot = false; if (!doesBurstshot && !doesMultishot) { Shoot(a, Vector2.zero, projectile.gameObject); isOnCooldown = true; } else if (!doesBurstshot && doesMultishot) { for (int i = 0; i < multishotAmount; i++) { Shoot(a, Vector2.zero, projectile.gameObject); } isOnCooldown = true; } else if (doesBurstshot) { GameManager.Instance.StartCoroutine(HandleBurstShot(a, Vector2.zero, projectile.gameObject)); } if (this.shouldRotate) { float num = BraveMathCollege.Atan2Degrees(targetToShoot.CenterPosition - base.transform.position.XY()); base.transform.localRotation = Quaternion.Euler(0f, 0f, num - 90f); } //Do burst shot and burst shot + multishot code! shouldnt be too bad. also f*****g do collision stuff you nerd }
private void HandleAttachedSpriteDepth(float gunAngle) { if (hatDepthType == HatDepthType.BehindWhenFacingBack || hatDepthType == HatDepthType.InFrontWhenFacingBack) { float num = 1f; if (hatOwner.CurrentGun is null) { Vector2 m_playerCommandedDirection = commandedField.GetTypedValue <Vector2>(hatOwner); Vector2 m_lastNonzeroCommandedDirection = lastNonZeroField.GetTypedValue <Vector2>(hatOwner); gunAngle = BraveMathCollege.Atan2Degrees((!(m_playerCommandedDirection == Vector2.zero)) ? m_playerCommandedDirection : m_lastNonzeroCommandedDirection); } float num2; if (gunAngle <= 155f && gunAngle >= 25f) { num = -1f; if (gunAngle < 120f && gunAngle >= 60f) { num2 = 0.15f; } else { num2 = 0.15f; } } else if (gunAngle <= -60f && gunAngle >= -120f) { num2 = -0.15f; } else { num2 = -0.15f; } if (hatDepthType == HatDepthType.BehindWhenFacingBack) { hatSprite.HeightOffGround = num2 + num * 1; } else { hatSprite.HeightOffGround = num2 + num * -1; } } else { if (hatDepthType == HatDepthType.AlwaysInFront) { hatSprite.HeightOffGround = 0.6f; } else { hatSprite.HeightOffGround = -0.6f; } } }
static void Postfix(Projectile __instance) { if (firstRun["Projectile.Update"]) { logger.LogInfo("Loaded ETGPlugin Projectile Update()"); firstRun["Projectile.Update"] = false; } if (__instance.Owner is PlayerController) { __instance.ResetDistance(); BounceProjModifier bounceMod = __instance.gameObject.GetOrAddComponent <BounceProjModifier>(); if (bounceMod != null) { bounceMod.numberOfBounces = 1; } //HomingModifier homingMod = __instance.placeholderGameObject.GetOrAddComponent<HomingModifier>(); //if (homingMod != null) //{ // homingMod.AngularVelocity = 90; // homingMod.HomingRadius = 100; //} if (SPLIT_SHOTS) { float lifetime = __instance.baseData.range / __instance.Speed; if (splitProjs.ContainsKey(__instance)) { float remainingTime = splitProjs[__instance]; if (remainingTime <= 0) { float projectileAngle = BraveMathCollege.Atan2Degrees(__instance.Direction); float fuzzyAngle = projectileAngle + UnityEngine.Random.Range(-MAX_DEVIATION, MAX_DEVIATION); splitProjs[__instance] = lifetime; ShootSingleProjectile(__instance, __instance.transform.position, fuzzyAngle); } else { splitProjs[__instance] = remainingTime - BraveTime.DeltaTime; } } else { Dictionary <Projectile, float> aliveProjs = (from kvp in splitProjs where kvp.Key != null select kvp).ToDictionary(kv => kv.Key, kv => kv.Value); splitProjs = aliveProjs; splitProjs.Add(__instance, lifetime / (1 + SHOTS_PER_LIFE)); } } } }
// Token: 0x06000120 RID: 288 RVA: 0x0000AC74 File Offset: 0x00008E74 private void Attack() { bool flag = this.Owner == null; if (flag) { this.Owner = this.m_aiActor.GetComponent <PointZero.PointZeroBehaviour>().Owner; } float num = -1f; List <AIActor> activeEnemies = this.Owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); bool flag2 = activeEnemies == null | activeEnemies.Count <= 0; if (!flag2) { AIActor nearestEnemy = this.GetNearestEnemy(activeEnemies, this.m_aiActor.sprite.WorldCenter, out num, null); bool flag3 = nearestEnemy && num < 10f; if (flag3) { bool flag4 = this.IsInRange(nearestEnemy); if (flag4) { bool flag5 = !nearestEnemy.IsHarmlessEnemy && nearestEnemy.IsNormalEnemy && !nearestEnemy.healthHaver.IsDead && nearestEnemy != this.m_aiActor; if (flag5) { Vector2 unitCenter = this.m_aiActor.specRigidbody.UnitCenter; Vector2 unitCenter2 = nearestEnemy.specRigidbody.HitboxPixelCollider.UnitCenter; float z = BraveMathCollege.Atan2Degrees((unitCenter2 - unitCenter).normalized); Projectile projectile = ((Gun)ETGMod.Databases.Items[576]).DefaultModule.projectiles[0]; GameObject gameObject = SpawnManager.SpawnProjectile(projectile.gameObject, this.m_aiActor.sprite.WorldCenter, Quaternion.Euler(0f, 0f, z + UnityEngine.Random.Range(-60, 60)), true); Projectile component = gameObject.GetComponent <Projectile>(); HomingModifier homing = component.gameObject.AddComponent <HomingModifier>(); homing.HomingRadius = 300; homing.AngularVelocity = 300; PierceProjModifier spook = component.gameObject.AddComponent <PierceProjModifier>(); spook.penetration = 10; BounceProjModifier bouncy = component.gameObject.AddComponent <BounceProjModifier>(); bouncy.numberOfBounces = 10; bool flag6 = component != null; bool flag7 = flag6; if (flag7) { { component.baseData.damage = 4f; } component.baseData.force = .5f; component.collidesWithPlayer = false; } } } } } }
private static void PreMoveProjectileModifier(Projectile p) { PlayerController player = this_gun.CurrentOwner as PlayerController; if (player && p && p.Owner is PlayerController) { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(player.PlayerIDX); if (instanceForPlayer == null) { return; } Vector2 vector = Vector2.zero; if (instanceForPlayer.IsKeyboardAndMouse(false)) { vector = (p.Owner as PlayerController).unadjustedAimPoint.XY() - p.specRigidbody.UnitCenter; } else { if (instanceForPlayer.ActiveActions == null) { return; } vector = instanceForPlayer.ActiveActions.Aim.Vector; } float target = vector.ToAngle(); float current = BraveMathCollege.Atan2Degrees(p.Direction); float num = 0f; if (p.ElapsedTime < trackingTime) { num = trackingCurve.Evaluate(p.ElapsedTime / trackingTime) * trackingSpeed; } float target2 = Mathf.MoveTowardsAngle(current, target, num * BraveTime.DeltaTime); Vector2 vector2 = Quaternion.Euler(0f, 0f, Mathf.DeltaAngle(current, target2)) * p.Direction; if (p is HelixProjectile) { HelixProjectile helixProjectile = p as HelixProjectile; helixProjectile.AdjustRightVector(Mathf.DeltaAngle(current, target2)); } if (p.OverrideMotionModule != null) { p.OverrideMotionModule.AdjustRightVector(Mathf.DeltaAngle(current, target2)); } p.Direction = vector2.normalized; if (p.shouldRotate) { p.transform.eulerAngles = new Vector3(0f, 0f, p.Direction.ToAngle()); } } }
// Token: 0x060003A3 RID: 931 RVA: 0x0001E604 File Offset: 0x0001C804 private void Attack() { bool flag = this.Owner == null; bool flag2 = flag; if (flag2) { this.Owner = this.m_aiActor.GetComponent <AbilityRebel.AllyBehavior>().Owner; } float num = -1f; List <AIActor> activeEnemies = this.Owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); bool flag3 = activeEnemies == null | activeEnemies.Count <= 0; bool flag4 = !flag3; if (flag4) { AIActor nearestEnemy = this.GetNearestEnemy(activeEnemies, this.m_aiActor.sprite.WorldCenter, out num, null); bool flag5 = nearestEnemy && num < 10f; bool flag6 = flag5; if (flag6) { bool flag7 = this.IsInRange(nearestEnemy); bool flag8 = flag7; if (flag8) { bool flag9 = !nearestEnemy.IsHarmlessEnemy && nearestEnemy.IsNormalEnemy && !nearestEnemy.healthHaver.IsDead && nearestEnemy != this.m_aiActor; bool flag10 = flag9; if (flag10) { Vector2 worldBottomLeft = this.m_aiActor.specRigidbody.sprite.WorldBottomLeft; Vector2 unitCenter = nearestEnemy.specRigidbody.HitboxPixelCollider.UnitCenter; float z = BraveMathCollege.Atan2Degrees((unitCenter - worldBottomLeft).normalized); Projectile projectile = ((Gun)ETGMod.Databases.Items["ak-47"]).DefaultModule.projectiles[0]; GameObject gameObject = SpawnManager.SpawnProjectile(projectile.gameObject, this.m_aiActor.sprite.WorldBottomLeft, Quaternion.Euler(0.5f, 0f, z), true); Projectile component = gameObject.GetComponent <Projectile>(); bool flag11 = component != null; bool flag12 = flag11; bool flag13 = flag12; if (flag13) { component.baseData.damage = 5f; component.baseData.force = 1f; component.collidesWithPlayer = false; } } } } } }
private void UpdateLink(PlayerController target, tk2dTiledSprite m_extantLink) { Vector2 unitCenter = base.specRigidbody.UnitCenter; Vector2 unitCenter2 = target.specRigidbody.HitboxPixelCollider.UnitCenter; m_extantLink.transform.position = unitCenter; Vector2 vector = unitCenter2 - unitCenter; float num = BraveMathCollege.Atan2Degrees(vector.normalized); int num2 = Mathf.RoundToInt(vector.magnitude / 0.0625f); m_extantLink.dimensions = new Vector2((float)num2, m_extantLink.dimensions.y); m_extantLink.transform.rotation = Quaternion.Euler(0f, 0f, num); m_extantLink.UpdateZDepth(); this.ApplyLinearDamage(unitCenter, unitCenter2); }
protected override void DoActiveEffect(PlayerController user) { base.DoActiveEffect(user); if (this.isStabbing) { return; } Vector2 vector = user.unadjustedAimPoint.XY() - user.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); float rayDamage = 300f; float rayLength = 1.6875f; this.stabVfx.SpawnAtPosition(user.CenterPosition, zRotation, user.transform, null, null, new float?(1f), false, null, user.sprite, true); user.StartCoroutine(this.HandleSwing(user, vector, rayDamage, rayLength)); }
private void Update() { if (sourceRigidbody) { Vector2 unitCenter = sourceRigidbody.UnitCenter; Vector2 unitCenter2 = Vector2.zero; if (usesVector && targetVector != Vector2.zero) { unitCenter2 = targetVector; } else if (targetRigidbody) { unitCenter2 = targetRigidbody.UnitCenter; } if (unitCenter2 != Vector2.zero) { tiledSprite.transform.position = unitCenter; Vector2 vector = unitCenter2 - unitCenter; float num = BraveMathCollege.Atan2Degrees(vector.normalized); int num2 = Mathf.RoundToInt(vector.magnitude / 0.0625f); tiledSprite.dimensions = new Vector2((float)num2, tiledSprite.dimensions.y); tiledSprite.transform.rotation = Quaternion.Euler(0f, 0f, num); tiledSprite.UpdateZDepth(); } else { if (eraseSpriteIfTargetOrSourceNull) { UnityEngine.Object.Destroy(tiledSprite.gameObject); } else if (eraseComponentIfTargetOrSourceNull) { UnityEngine.Object.Destroy(this); } } } else { if (eraseSpriteIfTargetOrSourceNull) { UnityEngine.Object.Destroy(tiledSprite.gameObject); } else if (eraseComponentIfTargetOrSourceNull) { UnityEngine.Object.Destroy(this); } } }
public static void InvokerHook(Action <Invoker, PlayerController> orig, Invoker self, PlayerController user) { if (user.HasPickupID(203)) { self.damageCooldown = 200; } else { self.damageCooldown = 400; } orig(self, user); if (user.HasPickupID(203)) { Projectile proj = (PickupObjectDatabase.GetById(38) as Gun).DefaultModule.projectiles[0]; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(user.PlayerIDX); bool flag2 = instanceForPlayer == null; float z = 0; if (!flag2) { bool flag3 = instanceForPlayer.IsKeyboardAndMouse(false); Vector2 a; if (flag3) { a = user.unadjustedAimPoint.XY() - self.sprite.WorldCenter; } else { bool flag4 = instanceForPlayer.ActiveActions == null; if (flag4) { return; } a = instanceForPlayer.ActiveActions.Aim.Vector; } a.Normalize(); z = BraveMathCollege.Atan2Degrees(a); } GameObject obj = SpawnManager.SpawnProjectile(proj.gameObject, user.sprite.WorldCenter, Quaternion.Euler(0, 0, z)); Projectile proj2 = obj.GetComponent <Projectile>(); if (proj2 != null) { proj2.Owner = user; proj2.Shooter = user.specRigidbody; proj2.baseData.damage *= ((user.stats.GetStatValue(PlayerStats.StatType.Coolness) / 2) + 1); } } }
// Token: 0x060076A2 RID: 30370 RVA: 0x002E4F90 File Offset: 0x002E3190 private void HandleCombat() { if (GameManager.Instance.IsPaused || !this.m_owner || this.m_owner.CurrentInputState != PlayerInputState.AllInput || this.m_owner.IsInputOverridden) { return; } if (this.shootProjectile == null) { return; } if (this.m_retargetTimer <= 0f) { this.m_currentTarget = null; } if (this.m_currentTarget == null || !this.m_currentTarget || this.m_currentTarget.healthHaver.IsDead) { this.AcquireTarget(); } if (this.m_currentTarget == null || !this.m_currentTarget) { return; } if (this.m_shootTimer <= 0f) { this.m_shootTimer = this.GetModifiedCooldown(); Vector2 a = this.FindPredictedTargetPosition(); if (!this.m_owner.IsStealthed) { int numberToFire = this.GetNumberToFire(); for (int i = 0; i < numberToFire; i++) { Vector2 vector = Vector2.zero; if (i > 0) { vector = UnityEngine.Random.insideUnitCircle.normalized; } this.Shoot(a + vector, vector); } } } if (this.shouldRotate) { float num = BraveMathCollege.Atan2Degrees(this.m_currentTarget.CenterPosition - base.transform.position.XY()); base.transform.localRotation = Quaternion.Euler(0f, 0f, num - 90f); } }
private void LateUpdate() { if (this.m_pickedUp && this.LastOwner != null) { if (this.extantObj == null) { this.extantObj = UnityEngine.Object.Instantiate <GameObject>(GungeonCompass.arrowObj, this.LastOwner.transform.position, Quaternion.identity); LootEngine.DoDefaultItemPoof(this.LastOwner.sprite.WorldTopCenter + new Vector2(0f, 1f)); } this.extantObj.GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(this.LastOwner.sprite.WorldTopCenter + new Vector2(0f, 1f), tk2dBaseSprite.Anchor.MiddleCenter); Vector2 coords = new Vector2(); bool found = false; foreach (RoomHandler room in GameManager.Instance.Dungeon.data.rooms) { //ETGModConsole.Log("still searching!"); if ((room.area.PrototypeRoomCategory == this.currentSearchObject)) { coords = room.GetCenterCell().ToVector2(); found = true; break; } } if (found) { Vector2 offset = this.extantObj.GetComponent <tk2dBaseSprite>().WorldCenter - coords; this.extantObj.transform.Rotate(this.LastOwner.sprite.WorldTopCenter + Vector2.up, BraveMathCollege.Atan2Degrees(offset), Space.World); this.extantObj.transform.rotation = Quaternion.Euler(0, 0, BraveMathCollege.Atan2Degrees(offset)); } else { this.extantObj.transform.rotation = Quaternion.Euler(0, 0, 0); } } else { if (this.extantObj != null) { UnityEngine.Object.Destroy(this.extantObj); this.extantObj = null; } } }
protected override void DoEffect(PlayerController user) { this.thrown = true; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(this.LastOwner.PlayerIDX); bool flag2 = instanceForPlayer == null; float z = 0; if (!flag2) { bool flag3 = instanceForPlayer.IsKeyboardAndMouse(false); Vector2 a; if (flag3) { a = this.LastOwner.unadjustedAimPoint.XY() - base.sprite.WorldCenter; } else { bool flag4 = instanceForPlayer.ActiveActions == null; if (flag4) { return; } a = instanceForPlayer.ActiveActions.Aim.Vector; } a.Normalize(); z = BraveMathCollege.Atan2Degrees(a); } GameObject obj = SpawnManager.SpawnProjectile((PickupObjectDatabase.GetById(38) as Gun).DefaultModule.projectiles[0].gameObject, user.sprite.WorldCenter, Quaternion.Euler(0, 0, z)); Projectile proj = obj.GetComponent <Projectile>(); if (proj != null) { proj.Owner = user; proj.Shooter = user.specRigidbody; proj.baseData.damage = 0; proj.baseData.force = 0; CatchProjectileBehaviour pokemonBehaviour = proj.gameObject.AddComponent <CatchProjectileBehaviour>(); pokemonBehaviour.thrower = user; pokemonBehaviour.parentItem = this; pokemonBehaviour.hasEvolutionSynergy = user.PlayerHasActiveSynergy("#GEN_2"); } }
public override void PostProcessProjectile(Projectile projectile) { if (projectile.baseData.range == 4f && projectile.gameObject.GetComponent <UnchangeableRangeController>()) { PlayerController player = this.Owner as PlayerController; Vector2 vector = player.unadjustedAimPoint.XY() - player.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); player.StartCoroutine(this.HandleSwing(player, vector, 15f, 2.25f)); this.gun.CurrentOwner.StartCoroutine(HandleDash(this.gun.CurrentOwner as PlayerController, 1)); } if (projectile.baseData.range == 7f && projectile.gameObject.GetComponent <UnchangeableRangeController>()) { PlayerController player = this.Owner as PlayerController; Vector2 vector = player.unadjustedAimPoint.XY() - player.CenterPosition; float zRotation = BraveMathCollege.Atan2Degrees(vector); player.StartCoroutine(this.HandleSwing(player, vector, 25f, 2.25f)); this.gun.CurrentOwner.StartCoroutine(HandleDash(this.gun.CurrentOwner as PlayerController, 2)); } base.PostProcessProjectile(projectile); }