예제 #1
0
        // This prevents boss from getting stuck in door ways at the edge of the room.
        private IEnumerator PathBackToCenter(AIActor target, Vector2 returnPosition)
        {
            if (!target)
            {
                target.BehaviorVelocity          = Vector2.zero;
                target.BehaviorOverridesVelocity = true;
                m_IsPathfindingToCenter          = false;
                yield break;
            }
            float elapsed = 0f;

            target.BehaviorOverridesVelocity = false;
            target.ClearPath();
            target.PathfindToPosition(returnPosition, canPassOccupied: true);
            yield return(null);

            while (!target.PathComplete)
            {
                elapsed += BraveTime.DeltaTime;
                if (elapsed > 20)
                {
                    target.BehaviorOverridesVelocity = true;
                    target.ClearPath();
                    m_IsPathfindingToCenter = false;
                    yield break;
                }
                yield return(null);
            }
            target.BehaviorOverridesVelocity = true;
            m_IsPathfindingToCenter          = false;
            yield break;
        }
예제 #2
0
 private void StunEnemy(AIActor enemy)
 {
     if (!enemy.healthHaver.IsBoss && enemy && enemy.behaviorSpeculator)
     {
         enemy.ClearPath();
         enemy.behaviorSpeculator.Interrupt();
         enemy.behaviorSpeculator.Stun(3f, true);
     }
 }
예제 #3
0
 // Token: 0x06004CA9 RID: 19625 RVA: 0x00199234 File Offset: 0x00197434
 public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData)
 {
     if (actor.FreezeAmount > 0f)
     {
         actor.FreezeAmount = Mathf.Max(0f, actor.FreezeAmount - BraveTime.DeltaTime * actor.FreezeDispelFactor);
         if (!actor.IsFrozen)
         {
             if (actor.FreezeAmount > 100f && actor.healthHaver.IsAlive)
             {
                 actor.FreezeAmount = 100f;
                 if (this.FreezeCrystals.Count > 0)
                 {
                     if (effectData.vfxObjects == null)
                     {
                         effectData.vfxObjects = new List <global::Tuple <GameObject, float> >();
                     }
                     int num = this.crystalNum;
                     if (effectData.actor && effectData.actor.specRigidbody && effectData.actor.specRigidbody.HitboxPixelCollider != null)
                     {
                         float num2 = effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.x * effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.y;
                         num = Mathf.Max(this.crystalNum, (int)((float)this.crystalNum * (0.5f + num2 / 4f)));
                     }
                     for (int i = 0; i < num; i++)
                     {
                         GameObject prefab  = BraveUtility.RandomElement <GameObject>(this.FreezeCrystals);
                         Vector2    vector  = actor.specRigidbody.HitboxPixelCollider.UnitCenter;
                         Vector2    vector2 = BraveUtility.RandomVector2(-this.crystalVariation, this.crystalVariation);
                         vector += vector2;
                         float      num3       = BraveMathCollege.QuantizeFloat(vector2.ToAngle(), 360f / (float)this.crystalRot);
                         Quaternion rotation   = Quaternion.Euler(0f, 0f, num3);
                         GameObject gameObject = SpawnManager.SpawnVFX(prefab, vector, rotation, true);
                         gameObject.transform.parent = actor.transform;
                         tk2dSprite component = gameObject.GetComponent <tk2dSprite>();
                         if (component)
                         {
                             actor.sprite.AttachRenderer(component);
                             component.HeightOffGround = 0.1f;
                         }
                         if (effectData.actor && effectData.actor.specRigidbody && effectData.actor.specRigidbody.HitboxPixelCollider != null)
                         {
                             Vector2 unitCenter = effectData.actor.specRigidbody.HitboxPixelCollider.UnitCenter;
                             float   num4       = (float)i * (360f / (float)num);
                             Vector2 normalized = BraveMathCollege.DegreesToVector(num4, 1f).normalized;
                             normalized.x *= effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.x / 2f;
                             normalized.y *= effectData.actor.specRigidbody.HitboxPixelCollider.UnitDimensions.y / 2f;
                             float   magnitude = normalized.magnitude;
                             Vector2 vector3   = unitCenter + normalized;
                             vector3 += (unitCenter - vector3).normalized * (magnitude * UnityEngine.Random.Range(0.15f, 0.85f));
                             gameObject.transform.position = vector3.ToVector3ZUp(0f);
                             gameObject.transform.rotation = Quaternion.Euler(0f, 0f, num4);
                         }
                         effectData.vfxObjects.Add(global::Tuple.Create <GameObject, float>(gameObject, num3));
                     }
                 }
                 if (this.ShouldVanishOnDeath(actor))
                 {
                     actor.StealthDeath = true;
                 }
                 if (actor.behaviorSpeculator)
                 {
                     if (actor.behaviorSpeculator.IsInterruptable)
                     {
                         actor.behaviorSpeculator.InterruptAndDisable();
                     }
                     else
                     {
                         actor.behaviorSpeculator.enabled = false;
                     }
                 }
                 if (actor is AIActor)
                 {
                     AIActor aiactor = actor as AIActor;
                     aiactor.ClearPath();
                     aiactor.BehaviorOverridesVelocity = false;
                 }
                 actor.IsFrozen = true;
             }
         }
         else if (actor.IsFrozen)
         {
             if (actor.FreezeAmount <= 0f)
             {
                 return;
             }
             if (actor.IsFalling)
             {
                 if (effectData.vfxObjects != null && effectData.vfxObjects.Count > 0)
                 {
                     this.DestroyCrystals(effectData, false);
                 }
                 if (actor.aiAnimator)
                 {
                     actor.aiAnimator.FpsScale = 1f;
                 }
             }
         }
     }
     if (!actor.healthHaver.IsDead)
     {
         float num5 = (!actor.healthHaver.IsBoss) ? 100f : 75f;
         float num6 = (!actor.IsFrozen) ? Mathf.Clamp01((100f - actor.FreezeAmount) / 100f) : 0f;
         float num7 = (!actor.IsFrozen) ? Mathf.Clamp01(actor.FreezeAmount / num5) : 1f;
         if (actor.aiAnimator)
         {
             actor.aiAnimator.FpsScale = ((!actor.IsFalling) ? num6 : 1f);
         }
         if (actor.aiShooter)
         {
             actor.aiShooter.AimTimeScale = num6;
         }
         if (actor.behaviorSpeculator)
         {
             actor.behaviorSpeculator.CooldownScale = num6;
         }
         if (actor.bulletBank)
         {
             actor.bulletBank.TimeScale = num6;
         }
         if (this.AppliesTint)
         {
             float num8          = actor.FreezeAmount / actor.FreezeDispelFactor;
             Color overrideColor = this.TintColor;
             if (num8 < 0.1f)
             {
                 overrideColor = Color.black;
             }
             else if (num8 < 0.2f)
             {
                 overrideColor = Color.white;
             }
             overrideColor.a *= num7;
             actor.RegisterOverrideColor(overrideColor, this.effectIdentifier);
         }
     }
 }
예제 #4
0
        private IEnumerator HandleShrink(AIActor target)
        {
            AkSoundEngine.PostEvent("Play_OBJ_lightning_flash_01", base.gameObject);
            float elapsed = 0f;

            if (target == null)
            {
                affectedEnemies.Remove(target);
                yield break;
            }
            Vector2 startScale         = target.EnemyScale;
            int     cachedLayer        = target.gameObject.layer;
            int     cachedOutlineLayer = cachedLayer;

            if (this.DepixelatesTargets)
            {
                target.gameObject.layer = LayerMask.NameToLayer("Unpixelated");
                cachedOutlineLayer      = SpriteOutlineManager.ChangeOutlineLayer(target.sprite, LayerMask.NameToLayer("Unpixelated"));
            }
            target.ClearPath();
            DazedBehavior db = new DazedBehavior();

            db.PointReachedPauseTime = 0.5f;
            db.PathInterval          = 0.5f;
            if (target.knockbackDoer)
            {
                target.knockbackDoer.weight /= 3f;
            }
            if (target.healthHaver)
            {
                target.healthHaver.AllDamageMultiplier *= this.DamageMultiplier;
            }
            target.behaviorSpeculator.OverrideBehaviors.Insert(0, db);
            target.behaviorSpeculator.RefreshBehaviors();
            while (elapsed < this.ShrinkTime)
            {
                if (target == null)
                {
                    affectedEnemies.Remove(target);
                    yield break;
                }
                elapsed          += target.LocalDeltaTime;
                target.EnemyScale = Vector2.Lerp(startScale, this.TargetScale, elapsed / this.ShrinkTime);
                yield return(null);
            }
            elapsed = 0f;
            while (elapsed < this.HoldTime)
            {
                this.m_activeElapsed  = elapsed;
                this.m_activeDuration = this.HoldTime;
                if (target == null)
                {
                    affectedEnemies.Remove(target);
                    yield break;
                }
                elapsed += target.LocalDeltaTime;
                yield return(null);
            }
            elapsed = 0f;
            while (elapsed < this.RegrowTime)
            {
                if (target == null)
                {
                    affectedEnemies.Remove(target);
                    yield break;
                }
                elapsed          += target.LocalDeltaTime;
                target.EnemyScale = Vector2.Lerp(this.TargetScale, startScale, elapsed / this.RegrowTime);
                yield return(null);
            }
            if (target == null)
            {
                affectedEnemies.Remove(target);
                yield break;
            }
            if (target.knockbackDoer)
            {
                target.knockbackDoer.weight *= 3f;
            }
            if (target.healthHaver)
            {
                target.healthHaver.AllDamageMultiplier /= this.DamageMultiplier;
            }
            target.behaviorSpeculator.OverrideBehaviors.Remove(db);
            target.behaviorSpeculator.RefreshBehaviors();
            if (this.DepixelatesTargets)
            {
                target.gameObject.layer = cachedLayer;
                SpriteOutlineManager.ChangeOutlineLayer(target.sprite, cachedOutlineLayer);
            }
            affectedEnemies.Remove(target);
            yield break;
        }