// Token: 0x060048A1 RID: 18593 RVA: 0x00179164 File Offset: 0x00177364 public override ContinuousBehaviorResult ContinuousUpdate() { for (int i = this.m_bulletPositions.Count - 1; i >= 0; i--) { float num = this.m_bulletPositions[i].Second + this.m_deltaTime * (float)this.BulletCircleSpeed; this.m_bulletPositions[i].Second = num; Projectile first = this.m_bulletPositions[i].First; if (!(first == null)) { if (!first) { this.m_bulletPositions[i] = null; } else { Vector2 bulletPosition = this.GetBulletPosition(num); first.specRigidbody.Velocity = (bulletPosition.ToVector3XUp() - first.transform.position) / BraveTime.DeltaTime; if (first.shouldRotate) { first.transform.rotation = Quaternion.Euler(0f, 0f, 180f + (Quaternion.Euler(0f, 0f, 90f) * (this.ShootPoint.position.XY() - bulletPosition)).XY().ToAngle()); } first.ResetDistance(); } } } if (this.State == WizardSpinShootBehavior2.SpinShootState.Spawn) { while (this.m_stateTimer <= 0f && this.State == WizardSpinShootBehavior2.SpinShootState.Spawn) { AIBulletBank.Entry bullet = (EnemyDatabase.GetOrLoadByGuid("c4fba8def15e47b297865b18e36cbef8").bulletBank.GetBullet("default")); GameObject bulletObject = bullet.BulletObject; float num2 = 0f; if (this.m_bulletPositions.Count > 0) { num2 = BraveMathCollege.ClampAngle360(this.m_bulletPositions[this.m_bulletPositions.Count - 1].Second - this.BulletAngleDelta); } GameObject gameObject = SpawnManager.SpawnProjectile(bulletObject, this.GetBulletPosition(num2), Quaternion.Euler(0f, 0f, 0f), true); Projectile component = gameObject.GetComponent <Projectile>(); if (bullet != null && bullet.OverrideProjectile) { component.baseData.SetAll(bullet.ProjectileData); } component.Shooter = this.m_aiActor.specRigidbody; component.specRigidbody.Velocity = Vector2.zero; component.ManualControl = true; component.specRigidbody.CollideWithTileMap = false; component.collidesWithEnemies = this.m_isCharmed; component.UpdateCollisionMask(); this.m_bulletPositions.Add(Tuple.Create <Projectile, float>(component, num2)); this.m_stateTimer += this.SpawnDelay; if (this.m_bulletPositions.Count >= this.NumBullets) { this.bottleowhiskey(SpinShootState.Prefire); } } } else if (this.State == WizardSpinShootBehavior2.SpinShootState.Prefire) { if (this.m_stateTimer <= 0f) { this.bottleowhiskey(SpinShootState.Fire); } } else if (this.State == WizardSpinShootBehavior2.SpinShootState.Fire) { if (this.m_behaviorSpeculator.TargetBehaviors != null && this.m_behaviorSpeculator.TargetBehaviors.Count > 0) { this.m_behaviorSpeculator.TargetBehaviors[0].Update(); } if (this.m_bulletPositions.All((Tuple <Projectile, float> t) => t.First == null)) { return(ContinuousBehaviorResult.Finished); } while (this.m_stateTimer <= 0f) { Vector2 vector = this.ShootPoint.position.XY(); Vector2 b = vector + ((!this.m_aiActor.TargetRigidbody) ? Vector2.zero : (this.m_aiActor.TargetRigidbody.UnitCenter - vector)).normalized * this.BulletCircleRadius; int num3 = -1; float num4 = float.MaxValue; for (int j = 0; j < this.m_bulletPositions.Count; j++) { Projectile first2 = this.m_bulletPositions[j].First; if (!(first2 == null)) { float sqrMagnitude = (first2.specRigidbody.UnitCenter - b).sqrMagnitude; if (sqrMagnitude < num4) { num4 = sqrMagnitude; num3 = j; } } } if (num3 >= 0) { Projectile first3 = this.m_bulletPositions[num3].First; first3.ManualControl = false; first3.specRigidbody.CollideWithTileMap = true; if (this.m_aiActor.TargetRigidbody) { Vector2 unitCenter = this.m_aiActor.TargetRigidbody.specRigidbody.GetUnitCenter(ColliderType.HitBox); float speed = first3.Speed; float d = Vector2.Distance(first3.specRigidbody.UnitCenter, unitCenter) / speed; Vector2 b2 = unitCenter + this.m_aiActor.TargetRigidbody.specRigidbody.Velocity * d; Vector2 a = Vector2.Lerp(unitCenter, b2, this.LeadAmount); first3.SendInDirection(a - first3.specRigidbody.UnitCenter, true, true); } first3.transform.rotation = Quaternion.Euler(0f, 0f, first3.specRigidbody.Velocity.ToAngle()); this.m_bulletPositions[num3].First = null; } else { Debug.LogError("WizardSpinShootBehaviour.ContinuousUpdate(): This shouldn't happen!"); } this.m_stateTimer += this.FireDelay; if (this.m_bulletPositions.All((Tuple <Projectile, float> t) => t.First == null)) { return(ContinuousBehaviorResult.Finished); } } } return(ContinuousBehaviorResult.Continue); }
public static void Build() { GameObject reaper = UnityEngine.Object.Instantiate(PrefabDatabase.Instance.SuperReaper); reaper.SetActive(false); FakePrefab.MarkAsFakePrefab(reaper); UnityEngine.Object.DontDestroyOnLoad(reaper); SuperReaperController controller = reaper.GetComponent <SuperReaperController>(); CustomSuperReaperController customController = reaper.AddComponent <CustomSuperReaperController>(); customController.PreventShooting = false; customController.BulletScript = controller.BulletScript; customController.ShootPoint = controller.ShootPoint; customController.ShootTimer = controller.ShootTimer; customController.MinSpeed = controller.MinSpeed; customController.MaxSpeed = controller.MaxSpeed; customController.MinSpeedDistance = controller.MinSpeedDistance; customController.MaxSpeedDistance = controller.MaxSpeedDistance; customController.knockbackComponent = controller.knockbackComponent; Destroy(controller); List <AIBulletBank.Entry> entries = new List <AIBulletBank.Entry>(); foreach (AIBulletBank.Entry bullet in customController.bulletBank.Bullets) { AIBulletBank.Entry entry = bullet.Clone(true, true, false, false); entries.Add(entry); } customController.bulletBank.Bullets.Clear(); foreach (AIBulletBank.Entry bullet in entries) { customController.bulletBank.Bullets.Add(bullet); } customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().BulletScriptSettings.preventPooling = true; customController.bulletBank.Bullets[0].ProjectileData.damage = 10f; customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().SetSprite(ETGMod.Databases.Items.ProjectileCollection, ETGMod.Databases.Items.ProjectileCollection.GetSpriteIdByName("10x10_player_projectile_dark_002")); ETGMod.Databases.Items.ProjectileCollection.spriteDefinitions[customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().spriteId] = PrefabDatabase.Instance.SuperReaper.GetComponent <SuperReaperController>().bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().GetCurrentSpriteDef().CopyDefinitionFrom(); Material material = Toolbox.GetGunById(38).DefaultModule.projectiles[0].GetAnySprite().GetCurrentSpriteDef().material; ETGMod.Databases.Items.ProjectileCollection.spriteDefinitions[customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().spriteId].material = material; ETGMod.Databases.Items.ProjectileCollection.spriteDefinitions[customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().spriteId].materialInst = material; ETGMod.Databases.Items.ProjectileCollection.spriteDefinitions[customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().spriteId].name = "10x10_player_projectile_dark_002"; tk2dBaseSprite sprite = PrefabDatabase.Instance.SuperReaper.GetComponent <SuperReaperController>().bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite(); PixelCollider pcollider = PrefabDatabase.Instance.SuperReaper.GetComponent <SuperReaperController>().bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().specRigidbody.PrimaryPixelCollider; tk2dSpriteDefinition tk2dSpriteDefinition; if (pcollider.BagleUseFirstFrameOnly && !string.IsNullOrEmpty(pcollider.SpecifyBagelFrame)) { tk2dSpriteDefinition = sprite.Collection.GetSpriteDefinition(pcollider.SpecifyBagelFrame); } else { tk2dSpriteDefinition = sprite.GetTrueCurrentSpriteDef(); } int num = (tk2dSpriteDefinition != null) ? sprite.GetSpriteIdByName(tk2dSpriteDefinition.name) : -1; BagelColliderData data = Toolbox.GetBagelColliders(num, sprite.Collection); ETGMod.Databases.Items.ProjectileCollection.SpriteIDsWithBagelColliders.Add(customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().GetAnySprite().spriteId); ETGMod.Databases.Items.ProjectileCollection.SpriteDefinedBagelColliders.Add(data); customController.bulletBank.Bullets[0].BulletObject.GetComponent <Projectile>().specRigidbody.PrimaryPixelCollider.SpecifyBagelFrame = ""; CustomSuperReaperController.friendlyReaperPrefab = reaper; }