protected override void Update() { if (this.m_extantOrbital != null & Owner) { if (Owner.IsInCombat && extantBeam == null) { extantBeam = BeamToolbox.FreeFireBeamFromAnywhere(InfraredBeam, Owner, this.m_extantOrbital, Vector2.zero, false, 0, float.MaxValue); extantBeam.projectile.gameObject.AddComponent <AlwaysPointAwayFromPlayerBeam>(); if (Owner.PlayerHasActiveSynergy("Infraredder Guon Stone")) { extantBeam.projectile.baseData.damage *= 2; } if (Owner.PlayerHasActiveSynergy("Xenochrome")) { extantBeam.GetComponent <BasicBeamController>().penetration++; extantBeam.GetComponent <BasicBeamController>().reflections++; } } else if (!Owner.IsInCombat && extantBeam != null) { extantBeam.CeaseAttack(); extantBeam = null; } } else if (((m_extantOrbital == null) || (Owner == null)) && extantBeam != null) { extantBeam.CeaseAttack(); extantBeam = null; } base.Update(); }
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; }
private IEnumerator HandleFreeFiringBeam(BeamController beam, SpeculativeRigidbody otherShooter, float duration) { float elapsed = 0f; yield return(null); while (elapsed < duration) { Vector2 sourcePos; if (otherShooter == null) { break; } if (!otherShooter.GetComponentInParent <FlippableCover>()) { break; } if (otherShooter.GetComponentInParent <FlippableCover>().IsBroken) { break; } else { sourcePos = otherShooter.UnitCenter; } elapsed += BraveTime.DeltaTime; if (sourcePos != null) { beam.Origin = sourcePos; beam.LateUpdatePosition(sourcePos); } else { ETGModConsole.Log("SOURCEPOS WAS NULL IN BEAM FIRING HANDLER"); } yield return(null); } beam.CeaseAttack(); yield break; }
private static IEnumerator HandleFreeFiringBeam(BeamController beam, SpeculativeRigidbody otherShooter, Vector2 fixedPosition, bool usesFixedPosition, float targetAngle, float duration, bool followProjDir, float projFollowOffset) { float elapsed = 0f; yield return(null); while (elapsed < duration) { Vector2 sourcePos; if (otherShooter == null) { break; } if (usesFixedPosition) { sourcePos = fixedPosition; } else { sourcePos = otherShooter.UnitCenter; } elapsed += BraveTime.DeltaTime; if (sourcePos != null) { if (otherShooter != null && !usesFixedPosition && otherShooter.GetComponent <Projectile>() && followProjDir) { beam.Direction = (otherShooter.GetComponent <Projectile>().Direction.ToAngle() + projFollowOffset).DegreeToVector2(); } beam.Origin = sourcePos; beam.LateUpdatePosition(sourcePos); } else { ETGModConsole.Log("SOURCEPOS WAS NULL IN BEAM FIRING HANDLER"); } yield return(null); } beam.CeaseAttack(); yield break; }
public static IEnumerator HandleFreeFiringBeam(BeamController beam, GameObject otherShooter, Vector2 fixedPosition, bool usesFixedPosition, float targetAngle, float duration) { float elapsed = 0f; yield return(null); while (elapsed < duration) { Vector2 sourcePos; if (otherShooter == null || otherShooter.GetComponent <SpeculativeRigidbody>() == null) { break; } if (usesFixedPosition) { sourcePos = fixedPosition; } else { sourcePos = otherShooter.GetComponent <SpeculativeRigidbody>().UnitCenter; } elapsed += BraveTime.DeltaTime; if (sourcePos != null) { beam.Origin = sourcePos; beam.LateUpdatePosition(sourcePos); } else { ETGModConsole.Log("SOURCEPOS WAS NULL IN BEAM FIRING HANDLER"); } yield return(null); } beam.CeaseAttack(); yield break; }
private void CeaseBeam(BeamController beam) { beam.CeaseAttack(); }