private IEnumerator HandleFiringBeam(BeamController beam) { float elapsed = 0f; yield return(null); while (m_Player && m_Player.IsFiring && this && m_AIActor.sprite && m_AIActor.healthHaver && !m_IsDisconnected) { elapsed += BraveTime.DeltaTime; if (!m_AIActor.TargetRigidbody) { m_AIActor.PlayerTarget = m_Player; } if (!m_MirrorGunToggle) { beam.CeaseAttack(); beam.DestroyBeam(); yield break; } if (m_AIActor.CurrentGun) { beam.Origin = m_AIActor.CurrentGun.sprite.WorldCenter; beam.LateUpdatePosition(m_AIActor.CurrentGun.sprite.WorldCenter); } else { beam.Origin = m_AIActor.specRigidbody.UnitCenter; beam.LateUpdatePosition(m_AIActor.specRigidbody.UnitCenter); } // beam.Origin = m_AIActor.specRigidbody.UnitCenter; // beam.LateUpdatePosition(m_AIActor.specRigidbody.UnitCenter); if (m_Player) { float angle = ((m_AIActor.TargetRigidbody.GetUnitCenter(ColliderType.HitBox) - m_AIActor.specRigidbody.UnitCenter).ToAngle()); if (m_AIActor.CurrentGun) { angle = ((m_AIActor.TargetRigidbody.GetUnitCenter(ColliderType.HitBox) - m_AIActor.CurrentGun.sprite.WorldCenter).ToAngle()); } if (m_InvertSweepAngle) { angle = (angle + m_BeamSweepAngle); } else { angle = (angle - m_BeamSweepAngle); } beam.Direction = BraveMathCollege.DegreesToVector(angle, 1); if (m_Player.IsDodgeRolling) { beam.CeaseAttack(); beam.DestroyBeam(); yield break; } } yield return(null); } beam.CeaseAttack(); beam.DestroyBeam(); yield break; }
public IEnumerator HandleDash(PlayerController target, Projectile projectile) { float duration = 1f; float elapsed = -BraveTime.DeltaTime; float angle = gun.CurrentOwner.CurrentGun.CurrentAngle; float adjSpeed = 100; this.gun.CanBeDropped = false; target.inventory.GunLocked.SetOverride("Nen Dash", true, null); target.ReceivesTouchDamage = false; target.SetIsFlying(true, "nen fist", true, false); duration = .15f; adjSpeed = 90; SpeculativeRigidbody specRigidbody = target.specRigidbody; specRigidbody.OnPreRigidbodyCollision = (SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate)Delegate.Combine(specRigidbody.OnPreRigidbodyCollision, new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate(this.OnPreCollision)); target.healthHaver.IsVulnerable = false; while (elapsed < duration) { elapsed += BraveTime.DeltaTime; gun.CurrentOwner.specRigidbody.Velocity = BraveMathCollege.DegreesToVector(angle).normalized *adjSpeed; yield return(null); } target.ReceivesTouchDamage = true; this.gun.CanBeDropped = true; target.inventory.GunLocked.RemoveOverride("Nen Dash"); if (adjSpeed == 90) { target.healthHaver.IsVulnerable = true; SpeculativeRigidbody specRigidbody2 = target.specRigidbody; specRigidbody2.OnPreRigidbodyCollision = (SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate)Delegate.Remove(specRigidbody2.OnPreRigidbodyCollision, new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate(this.OnPreCollision)); } target.SetIsFlying(false, "nen fist", true, false); }
public void SpawnAdditionalProjectile(Projectile proj, SpeculativeRigidbody hitEnemy, bool fatal) { if (UnityEngine.Random.value <= 0.35f) { float randomAngle = UnityEngine.Random.Range(0f, 360f); Vector2 spawnPosition = hitEnemy.UnitCenter + BraveMathCollege.DegreesToVector(randomAngle, 3f); float spawnAngle = randomAngle - 180f; GameObject obj = SpawnManager.SpawnProjectile(projectileToSpawn.gameObject, spawnPosition, Quaternion.Euler(0f, 0f, spawnAngle), true); Projectile proj2 = obj.GetComponent <Projectile>(); if (proj2 != null) { proj2.Owner = proj.Owner; proj2.Shooter = proj.Shooter; if (proj.sprite != null) { proj2.shouldRotate = proj.shouldRotate; proj2.shouldFlipHorizontally = proj.shouldFlipHorizontally; proj2.shouldFlipVertically = proj.shouldFlipVertically; proj2.sprite.SetSprite(proj.sprite.Collection, proj.sprite.spriteId); Vector2 vector = proj2.transform.position.XY() - proj2.sprite.WorldCenter; proj2.transform.position += vector.ToVector3ZUp(0f); proj2.specRigidbody.Reinitialize(); } proj2.baseData.damage = proj.baseData.damage; proj2.baseData.speed = proj.baseData.speed; proj2.baseData.force = proj.baseData.force; } } }
private Vector2 ModVeloc(Vector2 inVel) { Vector2 vector = inVel; if (m_projectile.GetElapsedDistance() > (distanceLastChecked + 1)) { float addition; if (recalcDriftPerCheck) { addition = UnityEngine.Random.Range(minDriftPerTile, maxDriftPerTile); } else { addition = staticAngle; } if (randomiseInverseEachCheck && UnityEngine.Random.value <= 0.5f) { addition *= -1; } float targetAngle = inVel.ToAngle() + addition; vector = BraveMathCollege.DegreesToVector(targetAngle, inVel.magnitude); base.transform.rotation = Quaternion.Euler(0f, 0f, targetAngle); distanceLastChecked = m_projectile.GetElapsedDistance(); } return(vector); }
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; }
public override BehaviorResult Update() { SpeculativeRigidbody targetRigidbody = this.m_aiActor.TargetRigidbody; if (!(targetRigidbody != null)) { return(BehaviorResult.Continue); } float desiredCombatDistance = this.m_aiActor.DesiredCombatDistance; if (this.StopWhenInRange && this.m_aiActor.DistanceToTarget <= desiredCombatDistance) { this.m_aiActor.ClearPath(); return(BehaviorResult.Continue); } if (this.m_repathTimer <= 0f) { Vector2 targetPosition; if (!this.m_otherBro) { m_otherBro = ExpandWesternBroController.GetOtherWesternBros(this.m_aiActor).FirstOrDefault(); } if (!this.m_otherBro) { targetPosition = targetRigidbody.UnitCenter; } else { Vector2 unitCenter = this.m_aiActor.TargetRigidbody.specRigidbody.GetUnitCenter(ColliderType.HitBox); Vector2 unitCenter2 = this.m_aiActor.specRigidbody.UnitCenter; Vector2 unitCenter3 = this.m_otherBro.specRigidbody.UnitCenter; float num = (unitCenter2 - unitCenter).ToAngle(); float num2 = (unitCenter3 - unitCenter).ToAngle(); float num3 = (num + num2) / 2f; float angle; if (BraveMathCollege.ClampAngle180(num - num3) > 0f) { angle = num3 + 90f; } else { angle = num3 - 90f; } targetPosition = unitCenter + BraveMathCollege.DegreesToVector(angle, 1f) * this.DesiredCombatDistance; } this.m_aiActor.PathfindToPosition(targetPosition, null, true, null, null, null, false); this.m_repathTimer = this.PathInterval; } return(BehaviorResult.SkipRemainingClassBehaviors); }
private void ContinueFiringBeam(BeamController beam, float angle, Vector2 overrideSpawnPoint) { Vector2 vector = overrideSpawnPoint; beam.Direction = BraveMathCollege.DegreesToVector(angle, 1f); beam.Origin = vector; beam.LateUpdatePosition(vector); }
private void ContinueFiringBeam(BeamController beam, PlayerController source, float angle, Vector2?overrideSpawnPoint) { Vector2 vector = (overrideSpawnPoint == null) ? source.CenterPosition : overrideSpawnPoint.Value; beam.Direction = BraveMathCollege.DegreesToVector(angle, 1f); beam.Origin = vector; beam.LateUpdatePosition(vector); }
// Token: 0x06004B93 RID: 19347 RVA: 0x00191F90 File Offset: 0x00190190 public override BehaviorResult Update() { this.m_startingAngle = BraveMathCollege.ClampAngle360(BraveUtility.RandomElement <float>(this.startingAngles)); this.m_aiActor.BehaviorOverridesVelocity = true; this.m_aiActor.BehaviorVelocity = BraveMathCollege.DegreesToVector(this.m_startingAngle, this.m_aiActor.MovementSpeed); this.m_isBouncing = true; return(BehaviorResult.RunContinuousInClass); }
public static BeamController FreeFireBeamFromAnywhere(Projectile projectileToSpawn, PlayerController owner, GameObject otherShooter, Vector2 fixedPosition, bool usesFixedPosition, float targetAngle, float duration, bool skipChargeTime = false, bool followDirOnProjectile = false, float angleOffsetFromProjectileAngle = 0) { Vector2 sourcePos = Vector2.zero; SpeculativeRigidbody rigidBod = null; if (usesFixedPosition) { sourcePos = fixedPosition; } else { if (otherShooter.GetComponent <SpeculativeRigidbody>()) { rigidBod = otherShooter.GetComponent <SpeculativeRigidbody>(); } else if (otherShooter.GetComponentInChildren <SpeculativeRigidbody>()) { rigidBod = otherShooter.GetComponentInChildren <SpeculativeRigidbody>(); } if (rigidBod) { sourcePos = rigidBod.UnitCenter; } } if (sourcePos != Vector2.zero) { GameObject gameObject = SpawnManager.SpawnProjectile(projectileToSpawn.gameObject, sourcePos, Quaternion.identity, true); Projectile component = gameObject.GetComponent <Projectile>(); component.Owner = owner; BeamController component2 = gameObject.GetComponent <BeamController>(); if (skipChargeTime) { component2.chargeDelay = 0f; component2.usesChargeDelay = false; } component2.Owner = owner; component2.HitsPlayers = false; component2.HitsEnemies = true; Vector3 vector = BraveMathCollege.DegreesToVector(targetAngle, 1f); if (otherShooter != null && !usesFixedPosition && otherShooter.GetComponent <Projectile>() && followDirOnProjectile) { component2.Direction = (otherShooter.GetComponent <Projectile>().Direction.ToAngle() + angleOffsetFromProjectileAngle).DegreeToVector2(); } else { component2.Direction = vector; } component2.Origin = sourcePos; GameManager.Instance.Dungeon.StartCoroutine(BeamToolbox.HandleFreeFiringBeam(component2, rigidBod, fixedPosition, usesFixedPosition, targetAngle, duration, followDirOnProjectile, angleOffsetFromProjectileAngle)); return(component2); } else { ETGModConsole.Log("ERROR IN BEAM FREEFIRE CODE. SOURCEPOS WAS NULL, EITHER DUE TO INVALID FIXEDPOS OR SOURCE GAMEOBJECT."); return(null); } }
protected override IEnumerator Top() { if (this.BulletBank && this.BulletBank.aiActor && this.BulletBank.aiActor.TargetRigidbody) { base.BulletBank.Bullets.Add(EnemyDatabase.GetOrLoadByGuid("880bbe4ce1014740ba6b4e2ea521e49d").bulletBank.GetBullet("grenade")); } base.PostWwiseEvent("Play_BOSS_lasthuman_volley_01", null); float airTime = base.BulletBank.GetBullet("grenade").BulletObject.GetComponent <ArcProjectile>().GetTimeInFlight(); Vector2 vector = this.BulletManager.PlayerPosition(); Bullet bullet2 = new Bullet("grenade", false, false, false); float direction2 = (vector - base.Position).ToAngle(); base.Fire(new Direction(direction2, DirectionType.Absolute, -1f), new Speed(1f, SpeedType.Absolute), bullet2); (bullet2.Projectile as ArcProjectile).AdjustSpeedToHit(vector); bullet2.Projectile.ImmuneToSustainedBlanks = true; //yield return base.Wait(150); for (int a = 0; a < 2; a++) { base.PostWwiseEvent("Play_BOSS_lasthuman_volley_01", null); for (int i = 0; i < 4; i++) { for (int h = 0; h < 2; h++) { base.Fire(new Direction(UnityEngine.Random.Range(-75f, 75f), DirectionType.Aim, -1f), new Speed(7.5f + h, SpeedType.Absolute), new WallBullet()); yield return(base.Wait(1)); } yield return(base.Wait(12)); Vector2 targetVelocity = this.BulletManager.PlayerVelocity(); float startAngle; float dist; if (targetVelocity != Vector2.zero && targetVelocity.magnitude > 0.5f) { startAngle = targetVelocity.ToAngle(); dist = targetVelocity.magnitude * airTime; } else { startAngle = base.RandomAngle(); dist = (7f * a) * airTime; } float angle = base.SubdivideCircle(startAngle, 4, i, 1f, false); Vector2 targetPoint = this.BulletManager.PlayerPosition() + BraveMathCollege.DegreesToVector(angle, dist); float direction = (targetPoint - base.Position).ToAngle(); if (i > 0) { direction += UnityEngine.Random.Range(-12.5f, 12.5f); } Bullet bullet = new Bullet("grenade", false, false, false); base.Fire(new Direction(direction, DirectionType.Absolute, -1f), new Speed(1f, SpeedType.Absolute), bullet); (bullet.Projectile as ArcProjectile).AdjustSpeedToHit(targetPoint); bullet.Projectile.ImmuneToSustainedBlanks = true; } } yield break; }
protected override void DoEffect(PlayerController user) { if (this.numberOfUses == 3 || this.position == Vector2.zero) { this.position = user.sprite.WorldCenter; } DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(SpillOJar.goopDef).TimedAddGoopLine(this.position, this.position + BraveMathCollege.DegreesToVector(user.FacingDirection, 8f), 2f, 0.75f); this.position += BraveMathCollege.DegreesToVector(user.FacingDirection, 6); }
public override Vector2 GetBoneOffset(BasicBeamController.BeamBone bone, BeamController sourceBeam, bool inverted) { float num2 = bone.PosX - this.oscillateOffsetPerSecond * (Time.timeSinceLevelLoad % 600000f); float to = (this.pulseAmplitude * 1.666f) * Mathf.Sin(num2 * 3.14159274f / this.pulseWavelength * 4f); return(BraveMathCollege.DegreesToVector(bone.RotationAngle + 00f, Mathf.SmoothStep(0f, to, bone.PosX))); //return new Vector2(0f, 0f); }
public static Vector2 GetBonePosition(this BasicBeamController beam, BasicBeamController.BeamBone bone) { if (!beam.UsesBones) { return(beam.Origin + BraveMathCollege.DegreesToVector(beam.Direction.ToAngle(), bone.PosX)); } if (beam.ProjectileAndBeamMotionModule != null) { return(bone.Position + beam.ProjectileAndBeamMotionModule.GetBoneOffset(bone, beam, beam.projectile.Inverted)); } return(bone.Position); }
private void Update() { degrees = degrees + (BraveTime.DeltaTime * degreesPerSecond); //if (degrees >= 360) //{ // degrees -= 360; //} Vector2 vector = BraveMathCollege.DegreesToVector(degrees, magnitude); //creates vector for the first point line.SetVector("_WavePoint1", new Vector4(screenCenter.x + vector.x, screenCenter.y + vector.y, 1f, 1f)); //Sets first point line.SetVector("_WavePoint2", new Vector4(screenCenter.x - vector.x, screenCenter.y - vector.y, 1f, 1f)); //sets second point }
public static void DoubleKeys(Action <KeyBulletPickup> acshon, KeyBulletPickup key) { acshon(key); foreach (PassiveItem passives in GameManager.Instance.GetActivePlayerClosestToPoint(key.specRigidbody.UnitCenter, true).passiveItems) { if (passives is UnluckyKey) { key.specRigidbody.Velocity = BraveMathCollege.DegreesToVector(Vector2.Angle(key.specRigidbody.UnitCenter, GameManager.Instance.GetActivePlayerClosestToPoint(key.specRigidbody.UnitCenter, true).specRigidbody.UnitCenter) + 180); key.specRigidbody.CollideWithTileMap = true; } } }
private void DoKatana(Projectile sourceProjectile, SpeculativeRigidbody enemy, bool fatal) { Vector2 vector = (!enemy.aiActor) ? enemy.transform.position.XY() : enemy.aiActor.CenterPosition; Debug.LogError(vector); Vector2 vector2 = (!sourceProjectile) ? ((!enemy.healthHaver) ? BraveMathCollege.DegreesToVector(base.Owner.FacingDirection, 1f) : enemy.healthHaver.lastIncurredDamageDirection) : sourceProjectile.LastVelocity.normalized; if (vector2.magnitude < 0.05f) { vector2 = UnityEngine.Random.insideUnitCircle.normalized; } GameManager.Instance.Dungeon.StartCoroutine(this.HandleChainExplosion(enemy, vector, vector2.normalized)); }
public IEnumerator HandleDash(PlayerController user, Projectile projectile) { float duration = .30f; float adjSpeed = 30; float elapsed = -BraveTime.DeltaTime; float angle = user.CurrentGun.CurrentAngle; while (elapsed < duration) { elapsed += BraveTime.DeltaTime; this.LastOwner.specRigidbody.Velocity = BraveMathCollege.DegreesToVector(angle).normalized *adjSpeed; yield return(null); } }
private void ProcessEye(GameObject eye, float angleOffset = 90f) { Vector2 vector = BraveMathCollege.DegreesToVector((player.unadjustedAimPoint.XY() - player.CenterPosition).ToAngle() + angleOffset, 1f); float lerp = 0f; Vector2 exceptedEndPoint = this.FindExpectedEndPoint(vector); if (angleOffset == 90f) { float a = 0.5f - (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)); a = a.Normalize(); this.lerp = (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)); /*bool flag5 = Mathf.Abs(Toolbox.Distance(0.5f, (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)))) < 0.02f; * if (flag5) * { * this.velocity = Mathf.Lerp(this.velocity, 0f, 0.5f); * } * else * { * }*/ this.velocity = Mathf.Lerp(this.velocity, a * eyeMoveSpeed, 0.1f); this.lerp += this.velocity * BraveTime.DeltaTime; lerp = this.lerp; } else if (angleOffset == -90f) { float a = 0.5f - (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)); a = a.Normalize(); this.lerpRight = (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)); /*bool flag5 = Mathf.Abs(Toolbox.Distance(0.5f, (Vector2.Distance(eye.transform.position, player.CenterPosition) / Vector2.Distance(exceptedEndPoint, player.CenterPosition)))) < 0.02f; * if (flag5) * { * this.velocityRight = Mathf.Lerp(this.velocityRight, 0f, 0.5f); * } * else * { * }*/ this.velocityRight = Mathf.Lerp(this.velocityRight, a * eyeMoveSpeed, 0.3f); this.lerpRight += this.velocityRight * BraveTime.DeltaTime; lerp = this.lerpRight; } Vector2 vector2 = Vector2.LerpUnclamped(player.CenterPosition, player.CenterPosition + BraveMathCollege.DegreesToVector((player.unadjustedAimPoint.XY() - player.CenterPosition).ToAngle() + angleOffset, Vector2.Distance(exceptedEndPoint, player.CenterPosition)), lerp); eye.transform.position = vector2; AimAt(eye, player.unadjustedAimPoint.XY()); }
protected override IEnumerator Top() { this.ManualControl = true; Vector2 truePosition = this.Position; float startVal = 1; for (int i = 0; i < 360; i++) { float offsetMagnitude = Mathf.SmoothStep(-.75f, .75f, Mathf.PingPong(startVal + (float)i / 90f * 3f, 1f)); truePosition += BraveMathCollege.DegreesToVector(this.Direction, this.Speed / 90f); this.Position = truePosition + (this.reverse ? BraveMathCollege.DegreesToVector(this.Direction + 90f, offsetMagnitude) : BraveMathCollege.DegreesToVector(this.Direction - 90f, offsetMagnitude)); yield return(this.Wait(1)); } this.Vanish(false); yield break; }
// Token: 0x0600008C RID: 140 RVA: 0x00004098 File Offset: 0x00002298 protected override IEnumerator Top() { base.ManualControl = true; yield return(base.Wait(this.delay)); Vector2 truePosition = base.Position; for (int i = 0; i < 360; i++) { float offsetMagnitude = Mathf.SmoothStep(-1.6f, 1.6f, Mathf.PingPong(0.5f + (float)i / 60f * 3f, 1f)); truePosition += BraveMathCollege.DegreesToVector(this.Direction, this.Speed / 60f); base.Position = truePosition + BraveMathCollege.DegreesToVector(this.Direction - 90f, offsetMagnitude); yield return(base.Wait(1)); } base.Vanish(false); yield break; }
// Token: 0x0600001B RID: 27 RVA: 0x00003110 File Offset: 0x00001310 private void UpdateAimTargetPosition() { PlayerController playerController = this.owner; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(playerController.PlayerIDX); GungeonActions activeActions = instanceForPlayer.ActiveActions; Vector3 position = this.m_aiActor.CenterPosition + BraveMathCollege.DegreesToVector(this.owner.FacingDirection, 1f) * 5f; bool flag = instanceForPlayer.IsKeyboardAndMouse(false); if (flag) { this.m_fakeTargetRigidbody.transform.position = position; } else { this.m_fakeTargetRigidbody.transform.position = position; } this.m_fakeTargetRigidbody.Reinitialize(); }
public override void OnPostFired(PlayerController player, Gun gun) { RoomHandler room = player.CurrentRoom; if (!room.HasActiveEnemies(RoomHandler.ActiveEnemyType.All)) { return; } foreach (var enemy in room.GetActiveEnemies(RoomHandler.ActiveEnemyType.All)) { if (Vector2.Distance(enemy.specRigidbody.UnitCenter, player.unadjustedAimPoint) <= 2) { float angle = Vector2.Angle(enemy.specRigidbody.UnitCenter, player.unadjustedAimPoint); float speed = Vector2.Distance(enemy.specRigidbody.UnitCenter, player.unadjustedAimPoint) * 3; enemy.specRigidbody.Velocity = BraveMathCollege.DegreesToVector(angle).normalized *speed; } } }
private BeamController BeginFiringBeam(Projectile projectileToSpawn, PlayerController source, float targetAngle, Vector2?overrideSpawnPoint) { Vector2 vector = (overrideSpawnPoint == null) ? source.CenterPosition : overrideSpawnPoint.Value; GameObject gameObject = SpawnManager.SpawnProjectile(projectileToSpawn.gameObject, vector, Quaternion.identity, true); Projectile component = gameObject.GetComponent <Projectile>(); component.Owner = source; BeamController component2 = gameObject.GetComponent <BeamController>(); component2.Owner = source; component2.HitsPlayers = false; component2.HitsEnemies = true; Vector3 v = BraveMathCollege.DegreesToVector(targetAngle, 1f); component2.Direction = v; component2.Origin = vector; return(component2); }
private static IEnumerator HandleSlash(Vector2 position, float angle, PlayerController owner, float knockbackForce, ProjInteractMode intmode, float damageToDeal, float enemyKnockback, List <GameActorEffect> statusEffects, float jammedDMGMult, float bossDMGMult, float SlashRange, float SlashDimensions) { int slashId = Time.frameCount; List <SpeculativeRigidbody> alreadyHit = new List <SpeculativeRigidbody>(); if (knockbackForce != 0f && owner != null) { owner.knockbackDoer.ApplyKnockback(BraveMathCollege.DegreesToVector(angle, 1f), knockbackForce, 0.25f, false); } float ela = 0f; while (ela < 0.2f) { ela += BraveTime.DeltaTime; HandleHeroSwordSlash(alreadyHit, position, angle, slashId, owner, intmode, damageToDeal, enemyKnockback, statusEffects, jammedDMGMult, bossDMGMult, SlashRange, SlashDimensions); yield return(null); } yield break; }
private IEnumerator BackBlast(PlayerController target) { float duration = 0f; float elapsed = -BraveTime.DeltaTime; float angle = gun.CurrentOwner.CurrentGun.CurrentAngle + 180; float adjSpeed = 0; this.gun.CanBeDropped = false; target.inventory.GunLocked.SetOverride("Be Free", true, null); duration = .15f; adjSpeed = 90; while (elapsed < duration) { elapsed += BraveTime.DeltaTime; gun.CurrentOwner.specRigidbody.Velocity = BraveMathCollege.DegreesToVector(angle).normalized * adjSpeed; yield return null; } this.gun.CanBeDropped = true; target.inventory.GunLocked.RemoveOverride("Be Free"); }
private static IEnumerator HandleSlash(Vector2 position, float angle, GameActor owner, SlashData slashParameters) { int slashId = Time.frameCount; List <SpeculativeRigidbody> alreadyHit = new List <SpeculativeRigidbody>(); if (slashParameters.playerKnockbackForce != 0f && owner != null) { owner.knockbackDoer.ApplyKnockback(BraveMathCollege.DegreesToVector(angle, 1f), slashParameters.playerKnockbackForce, 0.25f, false); } float ela = 0f; while (ela < 0.2f) { ela += BraveTime.DeltaTime; HandleHeroSwordSlash(alreadyHit, position, angle, slashId, owner, slashParameters); yield return(null); } yield break; }
public static Vector2 GetIndexedBonePosition(this BasicBeamController beam, int boneIndex) { LinkedList <BasicBeamController.BeamBone> bones; bones = OMITBReflectionHelpers.ReflectGetField <LinkedList <BasicBeamController.BeamBone> >(typeof(BasicBeamController), "m_bones", beam); if (bones.ElementAt(boneIndex) == null) { Debug.LogError("Attempted to fetch the position of a beam bone at an invalid index"); return(Vector2.zero); } if (!beam.UsesBones) { return(beam.Origin + BraveMathCollege.DegreesToVector(beam.Direction.ToAngle(), bones.ElementAt(boneIndex).PosX)); } if (beam.ProjectileAndBeamMotionModule != null) { return(bones.ElementAt(boneIndex).Position + beam.ProjectileAndBeamMotionModule.GetBoneOffset(bones.ElementAt(boneIndex), beam, beam.projectile.Inverted)); } return(bones.ElementAt(boneIndex).Position); }
void CreateTentacleAtBone(int boneIndex) { //ETGModConsole.Log("Attempted to create tentacle at bone: " + boneIndex); Vector2 bonePosition = selfBasicBeam.GetIndexedBonePosition(boneIndex); float boneAngle = selfBasicBeam.GetIndexedBone(boneIndex).RotationAngle; float variedAngle = boneAngle; if (UnityEngine.Random.value <= 0.5f) { variedAngle += UnityEngine.Random.Range(0f, 45f); } else { variedAngle -= UnityEngine.Random.Range(0f, 45f); } if (PhysicsEngine.Instance.Raycast(bonePosition, BraveMathCollege.DegreesToVector(variedAngle), 20, out hit)) { if (hit.OtherPixelCollider.IsTileCollider) { var cable = ETGModMainBehaviour.Instance.gameObject.AddComponent <TentacleDraw>(); var i = new GameObject("holdPoint"); i.transform.position = hit.Contact; GameObject NewStickler = new GameObject("TentacleStickler"); TentacleBoneSticker NewSticklerComp = NewStickler.AddComponent <TentacleBoneSticker>(); NewSticklerComp.parentBeam = selfBasicBeam; NewSticklerComp.parentBeamBoneIndex = boneIndex; NewSticklerComp.cable = cable; NewStickler.transform.position = bonePosition; cable.Initialize(NewStickler.transform, i.transform); tentes.Add(cable); RaycastResult.Pool.Free(ref hit); } //ETGModConsole.Log("Succeeded in placing Tentacle"); } }
private void Update() { if (m_projectile != null) { if (timer > 0) { timer -= BraveTime.DeltaTime; } if (timer <= 0) { this.tongue = this.DoTongueFlick(m_projectile); cooldownTime *= 2f; timer = cooldownTime; hasKnockedBackEnemy = false; } if (tongue != null && !this.hasKnockedBackEnemy) { RaidenBeamController slurp = tongue.GetComponent <RaidenBeamController>(); List <AIActor> targets = Stuff.ReflectGetField <List <AIActor> >(typeof(RaidenBeamController), "m_targets", slurp); foreach (AIActor enemy in targets) { if (enemy && enemy.healthHaver && enemy.healthHaver.IsAlive && enemy.knockbackDoer && !enemy.gameActor.behaviorSpeculator.IsStunned) { hasKnockedBackEnemy = true; float origWeight = enemy.knockbackDoer.weight; enemy.knockbackDoer.weight = 10; enemy.knockbackDoer.shouldBounce = false; float distance = m_projectile.baseData.speed * 0.2f; Vector2 angle = m_projectile.Direction; Vector2 vector = BraveMathCollege.DegreesToVector(angle.ToAngle(), distance); enemy.knockbackDoer.ApplyKnockback((enemy.specRigidbody.UnitCenter - (m_projectile.sprite.WorldCenter + vector)), -5f * Vector2.Distance(enemy.specRigidbody.UnitCenter, m_projectile.sprite.WorldCenter)); if (!enemy.gameActor.behaviorSpeculator.IsStunned) { enemy.gameActor.behaviorSpeculator.Stun(2f, true); } enemy.knockbackDoer.weight = origWeight; } } } } }