public override void EndContinuousUpdate() { base.EndContinuousUpdate(); if (this.AnimRequiresTransparency && this.m_cachedShader) { for (int i = 0; i < this.m_actorsToSplit.Count; i++) { AIActor aiactor = this.m_actorsToSplit[i]; if (aiactor) { aiactor.sprite.usesOverrideMaterial = false; aiactor.procedurallyOutlined = true; aiactor.SetOutlines(true); aiactor.renderer.material.shader = this.m_cachedShader; } } this.m_cachedShader = null; } if (!string.IsNullOrEmpty(this.Anim)) { this.m_aiAnimator.EndAnimationIf(this.Anim); } if (this.m_aiActor && this.m_aiActor.knockbackDoer) { this.m_aiActor.knockbackDoer.SetImmobile(false, "MirrorImageBehavior"); } for (int j = 0; j < this.m_actorsToSplit.Count; j++) { AIActor aiactor2 = this.m_actorsToSplit[j]; if (aiactor2) { aiactor2.BehaviorOverridesVelocity = false; aiactor2.IsGone = false; aiactor2.specRigidbody.CollideWithOthers = true; if (aiactor2 != this.m_aiActor) { aiactor2.PreventBlackPhantom = false; if (this.m_aiActor.IsBlackPhantom) { aiactor2.BecomeBlackPhantom(); } } } } this.m_actorsToSplit.Clear(); this.m_state = FriendlyMirrorImageBehavior.State.Idle; this.m_updateEveryFrame = false; this.UpdateCooldowns(); }
public override ContinuousBehaviorResult ContinuousUpdate() { if (this.m_state == FriendlyMirrorImageBehavior.State.Summoning) { if (this.m_timer <= 0f) { int num = Mathf.Min(this.NumImages, this.MaxImages - this.m_allImages.Count); for (int i = 0; i < num; i++) { AIActor aiactor = UnityEngine.Object.Instantiate(this.m_enemyPrefab.gameObject, this.m_aiActor.transform.position, Quaternion.identity).GetComponent <AIActor>(); CompanionController orAddComponent = aiactor.gameObject.GetOrAddComponent <CompanionController>(); if (IsBlackPhantom) { aiactor.gameObject.GetComponent <AIActor>().BecomeBlackPhantom(); } orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE; orAddComponent.Initialize(base.m_aiActor.CompanionOwner); orAddComponent.behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()); if (orAddComponent.healthHaver != null) { orAddComponent.healthHaver.PreventAllDamage = true; } if (orAddComponent.bulletBank != null) { orAddComponent.bulletBank.OnProjectileCreated += PokeballItem.CatchProjectileBehaviour.OnPostProcessProjectile; } if (orAddComponent.aiShooter != null) { orAddComponent.aiShooter.PostProcessProjectile += PokeballItem.CatchProjectileBehaviour.OnPostProcessProjectile; } aiactor.HitByEnemyBullets = true; aiactor.transform.position = this.m_aiActor.transform.position; aiactor.specRigidbody.Reinitialize(); aiactor.IsGone = true; aiactor.specRigidbody.CollideWithOthers = false; if (!string.IsNullOrEmpty(this.MirrorDeathAnim)) { aiactor.aiAnimator.OtherAnimations.Find((AIAnimator.NamedDirectionalAnimation a) => a.name == "death").anim.Prefix = this.MirrorDeathAnim; } aiactor.PreventBlackPhantom = true; if (aiactor.IsBlackPhantom) { aiactor.UnbecomeBlackPhantom(); } this.m_actorsToSplit.Add(aiactor); this.m_allImages.Add(aiactor); aiactor.aiAnimator.healthHaver.SetHealthMaximum(this.MirrorHealth * AIActor.BaseLevelHealthModifier, null, false); MirrorImageController mirrorImageController = aiactor.gameObject.AddComponent <MirrorImageController>(); mirrorImageController.SetHost(this.m_aiActor); for (int j = 0; j < this.MirroredAnims.Length; j++) { mirrorImageController.MirrorAnimations.Add(this.MirroredAnims[j]); } if (this.AnimRequiresTransparency) { aiactor.sprite.usesOverrideMaterial = true; aiactor.procedurallyOutlined = false; aiactor.SetOutlines(false); aiactor.renderer.material.shader = ShaderCache.Acquire("Brave/LitBlendUber"); } } this.m_startAngle = UnityEngine.Random.Range(0f, 360f); this.m_state = FriendlyMirrorImageBehavior.State.Splitting; this.m_timer = this.SplitDelay; return(ContinuousBehaviorResult.Continue); } } else if (this.m_state == FriendlyMirrorImageBehavior.State.Splitting) { float num2 = 360f / (float)this.m_actorsToSplit.Count; for (int k = 0; k < this.m_actorsToSplit.Count; k++) { this.m_actorsToSplit[k].BehaviorOverridesVelocity = true; this.m_actorsToSplit[k].BehaviorVelocity = BraveMathCollege.DegreesToVector(this.m_startAngle + num2 * (float)k, this.SplitDistance / this.SplitDelay); } if (this.m_timer <= 0f) { return(ContinuousBehaviorResult.Finished); } } return(ContinuousBehaviorResult.Continue); }