public static bool IsAttackBehaviorGroup(this AttackBehaviorBase self, out List <AttackBehaviorBase> groupItems)
 {
     groupItems = new List <AttackBehaviorBase>();
     if (self is AttackBehaviorGroup)
     {
         foreach (AttackBehaviorBase behav2 in (self as AttackBehaviorGroup).FindAttackBehaviorsInGroup <AttackBehaviorBase>())
         {
             groupItems.Add(behav2);
         }
         return(true);
     }
     else if (self is SequentialAttackBehaviorGroup)
     {
         foreach (AttackBehaviorBase behav2 in (self as SequentialAttackBehaviorGroup).FindAttackBehaviorsInSequentialGroup <AttackBehaviorBase>())
         {
             groupItems.Add(behav2);
         }
         return(true);
     }
     else if (self is SimultaneousAttackBehaviorGroup)
     {
         foreach (AttackBehaviorBase behav2 in (self as SimultaneousAttackBehaviorGroup).FindAttackBehaviorsInSimultaneousGroup <AttackBehaviorBase>())
         {
             groupItems.Add(behav2);
         }
         return(true);
     }
     return(false);
 }
Пример #2
0
        // Token: 0x0600001F RID: 31 RVA: 0x000035A0 File Offset: 0x000017A0
        private void ProcessAttack(AttackBehaviorBase attack)
        {
            bool flag = attack == null;

            if (!flag)
            {
                bool flag2 = attack is BasicAttackBehavior;
                if (flag2)
                {
                    BasicAttackBehavior basicAttackBehavior = attack as BasicAttackBehavior;
                    basicAttackBehavior.Cooldown            = 0f;
                    basicAttackBehavior.RequiresLineOfSight = false;
                    basicAttackBehavior.MinRange            = -1f;
                    basicAttackBehavior.Range = -1f;
                    bool flag3 = attack is TeleportBehavior;
                    if (flag3)
                    {
                        this.TeleBehav = (basicAttackBehavior as TeleportBehavior);
                        basicAttackBehavior.RequiresLineOfSight = true;
                        basicAttackBehavior.MinRange            = 1000f;
                        basicAttackBehavior.Range = 0.1f;
                        this.DoTeleport           = typeof(TeleportBehavior).GetMethod("DoTeleport", BindingFlags.Instance | BindingFlags.NonPublic);
                    }
                    bool flag4 = attack is DashBehavior;
                    if (flag4)
                    {
                        this.dashBehav = (basicAttackBehavior as DashBehavior);
                        basicAttackBehavior.RequiresLineOfSight = true;
                        basicAttackBehavior.MinRange            = 1000f;
                        basicAttackBehavior.Range = 0.1f;
                        this.BeginState           = typeof(DashBehavior).GetMethod("BeginState", BindingFlags.Instance | BindingFlags.NonPublic);
                        this.State[0]             = typeof(DashBehavior).GetNestedType("DashState", BindingFlags.NonPublic).GetField("Charge").GetValue(this.dashBehav);
                        this.EndState             = typeof(DashBehavior).GetMethod("EndState", BindingFlags.Instance | BindingFlags.NonPublic);
                    }
                    bool flag5 = basicAttackBehavior is ShootGunBehavior;
                    if (flag5)
                    {
                        ShootGunBehavior shootGunBehavior = basicAttackBehavior as ShootGunBehavior;
                        shootGunBehavior.LineOfSight   = false;
                        shootGunBehavior.EmptiesClip   = false;
                        shootGunBehavior.Cooldown      = 0.3f;
                        shootGunBehavior.RespectReload = true;
                    }
                }
                else
                {
                    bool flag6 = attack is AttackBehaviorGroup;
                    if (flag6)
                    {
                        AttackBehaviorGroup attackBehaviorGroup = attack as AttackBehaviorGroup;
                        for (int i = 0; i < attackBehaviorGroup.AttackBehaviors.Count; i++)
                        {
                            this.ProcessAttack(attackBehaviorGroup.AttackBehaviors[i].Behavior);
                        }
                    }
                }
            }
        }
Пример #3
0
 protected void SetupBehaviorABG(AttackBehaviorBase behavior, string name = "N/A", int probability = 1)
 {
     behavior.Init(behaviorSpec.gameObject, actor, behaviorSpec.aiShooter);
     behaviorSpec.AttackBehaviorGroup.AttackBehaviors.Add(new AttackBehaviorGroup.AttackGroupItem
     {
         Behavior    = behavior,
         NickName    = name,
         Probability = probability
     });
     behavior.Start();
 }
Пример #4
0
        // Token: 0x0600001C RID: 28 RVA: 0x000031B0 File Offset: 0x000013B0
        private void Update()
        {
            this.m_fakeActor.specRigidbody = this.m_fakeTargetRigidbody;
            bool flag = this.m_aiActor;

            if (flag)
            {
                this.m_aiActor.CanTargetEnemies = false;
                this.m_aiActor.CanTargetPlayers = true;
                this.m_aiActor.PlayerTarget     = this.m_fakeActor;
                this.m_aiActor.OverrideTarget   = null;
                this.UpdateAimTargetPosition();
                bool flag2 = this.m_aiActor.aiShooter;
                if (flag2)
                {
                    this.m_aiActor.aiShooter.AimAtPoint(this.m_behaviorSpeculator.PlayerTarget.CenterPosition);
                }
            }
            bool flag3 = this.m_behaviorSpeculator;

            if (flag3)
            {
                PlayerController playerController  = this.owner;
                BraveInput       instanceForPlayer = BraveInput.GetInstanceForPlayer(playerController.PlayerIDX);
                GungeonActions   activeActions     = instanceForPlayer.ActiveActions;
                bool             flag4             = this.m_behaviorSpeculator.AttackCooldown <= 0f;
                if (flag4)
                {
                    bool flag5 = !this.m_attackedThisCycle && this.m_behaviorSpeculator.ActiveContinuousAttackBehavior != null;
                    if (flag5)
                    {
                        this.m_attackedThisCycle = true;
                    }
                    bool flag6 = this.m_attackedThisCycle && this.m_behaviorSpeculator.ActiveContinuousAttackBehavior == null;
                    if (flag6)
                    {
                        this.m_behaviorSpeculator.AttackCooldown = float.MaxValue;
                        bool flag7 = this.dashBehav != null;
                        if (flag7)
                        {
                        }
                        bool flag8 = this.TeleBehav != null;
                        if (flag8)
                        {
                            this.TeleBehav.RequiresLineOfSight = true;
                            this.TeleBehav.MinRange            = 1000f;
                            this.TeleBehav.Range = 0.1f;
                        }
                    }
                }
                else
                {
                    bool wasPressed = activeActions.ShootAction.WasPressed;
                    if (wasPressed)
                    {
                        this.m_attackedThisCycle = false;
                        this.m_behaviorSpeculator.AttackCooldown = 0f;
                    }
                    else
                    {
                        bool wasPressed2 = activeActions.DodgeRollAction.WasPressed;
                        if (wasPressed2)
                        {
                            this.m_attackedThisCycle = false;
                            bool flag9 = this.dashBehav != null;
                            if (flag9)
                            {
                                bool flag10 = !this.isDashingOrTPing;
                                if (flag10)
                                {
                                    this.dashBehav.RequiresLineOfSight = false;
                                    this.dashBehav.MinRange            = 3f;
                                    this.dashBehav.Range = 8f;
                                    base.StartCoroutine(this.DoDash(this.dashBehav.dashTime));
                                }
                            }
                            bool flag11 = this.TeleBehav != null;
                            if (flag11)
                            {
                                bool flag12 = !this.isDashingOrTPing;
                                if (flag12)
                                {
                                    this.TeleBehav.RequiresLineOfSight = false;
                                    this.TeleBehav.MinRange            = 3f;
                                    this.TeleBehav.Range = 17f;
                                    base.StartCoroutine(this.DoTP());
                                }
                            }
                        }
                    }
                }
                bool flag13 = this.m_behaviorSpeculator.TargetBehaviors != null && this.m_behaviorSpeculator.TargetBehaviors.Count > 0;
                if (flag13)
                {
                    this.m_behaviorSpeculator.TargetBehaviors.Clear();
                }
                bool flag14 = this.m_behaviorSpeculator.MovementBehaviors != null && this.m_behaviorSpeculator.MovementBehaviors.Count > 0;
                if (flag14)
                {
                    this.m_behaviorSpeculator.MovementBehaviors.Clear();
                }
                this.m_aiActor.ImpartedVelocity += activeActions.Move.Value * this.m_aiActor.MovementSpeed * this.m_aiActor.LocalTimeScale;
                bool flag15 = this.m_behaviorSpeculator.AttackBehaviors != null;
                if (flag15)
                {
                    for (int i = 0; i < this.m_behaviorSpeculator.AttackBehaviors.Count; i++)
                    {
                        AttackBehaviorBase attack = this.m_behaviorSpeculator.AttackBehaviors[i];
                        this.ProcessAttack(attack);
                    }
                }
            }
        }
Пример #5
0
 protected void SetupBehavior(AttackBehaviorBase behavior)
 {
     behavior.Init(behaviorSpec.gameObject, actor, behaviorSpec.aiShooter);
     behaviorSpec.AttackBehaviors.Add(behavior);
     behavior.Start();
 }