示例#1
0
    private void Update()
    {
        lastGungeonActionsUpdate += Time.deltaTime;
        if ((gungeonActions == null || lastGungeonActionsUpdate > 2f) &&
            GameManager.Instance != null && GameManager.Instance.PrimaryPlayer != null)
        {
            // TODO even more expensive here, every couple seconds we check if there is new input
            var braveInput = BraveInput.PrimaryPlayerInstance;
            gungeonActions           = braveInput.ActiveActions;
            reloadSpriteTag          = gungeonActions.ReloadAction.getUISpriteString(braveInput.IsKeyboardAndMouse());
            lastGungeonActionsUpdate = 0;
        }
        if (gungeonActions?.ReloadAction.WasPressed ?? false)
        {
            nextPage = (currentPage + 1) % PAGE_LENGTH;
        }

        if (GameUIRoot.Instance == null)
        {
            return;
        }

        bool updateLabels = nextPage != currentPage;

        if (updateLabels)
        {
            currentPage = nextPage;
        }
        var labels   = GameUIRoot.Instance.extantBasicLabels;
        var hashCode = labels.deepHashCode();

        if (hashCode == lastHashcode && !updateLabels)
        {
            return;
        }
        lastHashcode = hashCode;
        foreach (var label in labels)
        {
            if (lastLabels.Contains(label))
            {
                if (updateLabels)
                {
                    withItem(label, onUpdateLabel);
                }
            }
            else
            {
                withItem(label, onNewLabel);
            }
        }

        // TODO expensive, could do with a little dynamic programming here...
        lastLabels = new List <DefaultLabelController>(labels);
    }
        // Token: 0x0600001B RID: 27 RVA: 0x00003110 File Offset: 0x00001310
        private void UpdateAimTargetPosition()
        {
            PlayerController playerController  = this.owner;
            BraveInput       instanceForPlayer = BraveInput.GetInstanceForPlayer(playerController.PlayerIDX);
            GungeonActions   activeActions     = instanceForPlayer.ActiveActions;
            Vector3          position          = this.m_aiActor.CenterPosition + BraveMathCollege.DegreesToVector(this.owner.FacingDirection, 1f) * 5f;
            bool             flag = instanceForPlayer.IsKeyboardAndMouse(false);

            if (flag)
            {
                this.m_fakeTargetRigidbody.transform.position = position;
            }
            else
            {
                this.m_fakeTargetRigidbody.transform.position = position;
            }
            this.m_fakeTargetRigidbody.Reinitialize();
        }
示例#3
0
        public static Vector2 GetCursorPosition(this PlayerController user, float noCursorControllerRange)
        {
            Vector2 m_cachedBlinkPosition = Vector2.zero;

            GungeonActions m_activeActions = OMITBReflectionHelpers.ReflectGetField <GungeonActions>(typeof(PlayerController), "m_activeActions", user);

            bool IsKeyboardAndMouse = BraveInput.GetInstanceForPlayer(user.PlayerIDX).IsKeyboardAndMouse(false);

            if (IsKeyboardAndMouse)
            {
                m_cachedBlinkPosition = user.unadjustedAimPoint.XY() - (user.CenterPosition - user.specRigidbody.UnitCenter);
            }
            else
            {
                m_cachedBlinkPosition = user.PositionInDistanceFromAimDir(5);
                //if (m_activeActions != null) { m_cachedBlinkPosition += m_activeActions.Aim.Vector.normalized * BraveTime.DeltaTime * 15f; }
            }

            m_cachedBlinkPosition = BraveMathCollege.ClampToBounds(m_cachedBlinkPosition, GameManager.Instance.MainCameraController.MinVisiblePoint, GameManager.Instance.MainCameraController.MaxVisiblePoint);
            return(m_cachedBlinkPosition);
        }
示例#4
0
 private void Update()
 {
     if (this.user != null && Time.frameCount % 10 == 0 && this.proj)
     {
         GungeonActions m_activeActions    = Stuff.ReflectGetField <GungeonActions>(typeof(PlayerController), "m_activeActions", this.user);
         bool           IsKeyboardAndMouse = BraveInput.GetInstanceForPlayer(this.user.PlayerIDX).IsKeyboardAndMouse(false);
         if (IsKeyboardAndMouse)
         {
             this.spawnpos = this.user.unadjustedAimPoint.XY() - (this.user.CenterPosition - this.user.specRigidbody.UnitCenter);
         }
         else
         {
             if (m_activeActions != null)
             {
                 spawnpos = m_activeActions.Aim.Vector;
             }
         }
         this.proj.SendInDirection(spawnpos - this.proj.specRigidbody.UnitCenter, true);
         this.proj.shouldRotate = false;
     }
 }
        // 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);
                    }
                }
            }
        }
        public void HandleBlink(PlayerController Owner)
        {
            if (GameManager.Instance.Dungeon && GameManager.Instance.Dungeon.IsEndTimes)
            {
                ClearBlinkShadow();
                return;
            }
            if (Owner.WasPausedThisFrame)
            {
                ClearBlinkShadow();
                return;
            }

            // if (!CheckDodgeRollDepth(Owner)) { return; }

            /*PlayerController.DodgeRollState? m_dodgeRollState = ReflectionHelpers.ReflectGetField<PlayerController.DodgeRollState>(typeof(PlayerController), "m_dodgeRollState", Owner);
             * if (m_dodgeRollState.HasValue) {
             *  if (m_dodgeRollState == PlayerController.DodgeRollState.AdditionalDelay) { return; }
             * }*/
            // if (Owner.IsFlying && !CanDodgeRollWhileFlying(Owner)) { return; }

            BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(Owner.PlayerIDX);

            GungeonActions m_activeActions  = ReflectionHelpers.ReflectGetField <GungeonActions>(typeof(PlayerController), "m_activeActions", Owner);
            Vector2        currentDirection = AdjustInputVector(m_activeActions.Move.Vector, BraveInput.MagnetAngles.movementCardinal, BraveInput.MagnetAngles.movementOrdinal);

            bool WillBlink = false;
            bool flag2     = false;

            if (instanceForPlayer.GetButtonDown(GungeonActions.GungeonActionType.DodgeRoll))
            {
                flag2 = true;
            }
            if (instanceForPlayer.ActiveActions.DodgeRollAction.IsPressed)
            {
                m_timeHeldBlinkButton += BraveTime.DeltaTime;
                if (m_timeHeldBlinkButton < 0.3f)
                {
                    m_cachedBlinkPosition = Owner.specRigidbody.UnitCenter;
                }
                else
                {
                    Vector2 cachedBlinkPosition = m_cachedBlinkPosition;
                    bool    IsKeyboardAndMouse  = BraveInput.GetInstanceForPlayer(Owner.PlayerIDX).IsKeyboardAndMouse(false);
                    if (IsKeyboardAndMouse)
                    {
                        m_cachedBlinkPosition = Owner.unadjustedAimPoint.XY() - (Owner.CenterPosition - Owner.specRigidbody.UnitCenter);
                    }
                    else
                    {
                        if (m_activeActions != null)
                        {
                            m_cachedBlinkPosition += m_activeActions.Aim.Vector.normalized * BraveTime.DeltaTime * 15f;
                        }
                    }
                    m_cachedBlinkPosition = BraveMathCollege.ClampToBounds(m_cachedBlinkPosition, GameManager.Instance.MainCameraController.MinVisiblePoint, GameManager.Instance.MainCameraController.MaxVisiblePoint);

                    UpdateBlinkShadow(Owner, m_cachedBlinkPosition - cachedBlinkPosition, CanBlinkToPoint(Owner, m_cachedBlinkPosition, Owner.transform.position.XY() - Owner.specRigidbody.UnitCenter));
                }
            }
            else if (instanceForPlayer.ActiveActions.DodgeRollAction.WasReleased || flag2)
            {
                if (m_timeHeldBlinkButton >= 0.3f)
                {
                    WillBlink = true;
                }
            }
            else
            {
                m_timeHeldBlinkButton = 0f;
            }
            if (WillBlink)
            {
                /*if (m_timeHeldBlinkButton < 0.3f) {
                 *  m_cachedBlinkPosition = Owner.specRigidbody.UnitCenter + currentDirection.normalized * Owner.rollStats.GetModifiedDistance(Owner);
                 * }*/
                Owner.healthHaver.TriggerInvulnerabilityPeriod(0.001f);
                // Owner.rollStats.blinkDistanceMultiplier = 1f;
                Owner.DidUnstealthyAction();
                BlinkToPoint(Owner, m_cachedBlinkPosition);
                m_timeHeldBlinkButton = 0;
                WillBlink             = false;
            }
        }
示例#7
0
        public override void Update()
        {
            base.Update();
            if (base.LastOwner != null)
            {
                GungeonActions m_activeActions    = WowTasticPaintbrush.ReflectGetField <GungeonActions>(typeof(PlayerController), "m_activeActions", base.LastOwner);
                bool           IsKeyboardAndMouse = BraveInput.GetInstanceForPlayer(base.LastOwner.PlayerIDX).IsKeyboardAndMouse(false);
                if (IsKeyboardAndMouse)
                {
                    this.spawnpos = base.LastOwner.unadjustedAimPoint.XY() - (base.LastOwner.CenterPosition - base.LastOwner.specRigidbody.UnitCenter);
                }
                else
                {
                    if (m_activeActions != null)
                    {
                        spawnpos += m_activeActions.Aim.Vector.normalized * BraveTime.DeltaTime * 10f;
                    }
                }
                BraveInput input = BraveInput.GetInstanceForPlayer(base.LastOwner.PlayerIDX);
                if (this.IsCurrentlyActive && input.ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Shoot).IsPressed&& !input.ActiveActions.GetActionFromType(GungeonActions.GungeonActionType.Shoot).WasPressed&& Time.frameCount % 5 == 0)
                {
                    if (this.numberOfUses == 3)
                    {
                        DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(WowTasticPaintbrush.goopDefs[0]).AddGoopCircle(this.spawnpos, 0.9f);
                    }
                    else if (this.numberOfUses == 2)
                    {
                        DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(WowTasticPaintbrush.goopDefs[1]).AddGoopCircle(this.spawnpos, 0.9f);
                    }
                    else if (this.numberOfUses == 1)
                    {
                        DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(WowTasticPaintbrush.goopDefs[2]).AddGoopCircle(this.spawnpos, 0.9f);
                        for (int i = 0; i < StaticReferenceManager.AllGoops.Count; i++)
                        {
                            StaticReferenceManager.AllGoops[i].ElectrifyGoopCircle(base.LastOwner.specRigidbody.UnitBottomCenter, 50f);
                        }
                    }
                }

                /*if(Time.frameCount % 10 == 0 && this.instanceHat)
                 * {
                 *  if (this.instanceHatSprite)
                 *  {
                 *      this.disengageEffect(base.LastOwner);
                 *      this.engageEffect(base.LastOwner);
                 *      if (base.LastOwner.IsFalling)
                 *      {
                 *          this.instanceHatSprite.renderer.enabled = false;
                 *      }
                 *      else
                 *      {
                 *          this.instanceHatSprite.renderer.enabled = true;
                 *      }
                 *      if (base.LastOwner.IsBackfacing() && !this.instanceHatSprite.IsPlaying("back"))
                 *      {
                 *          this.instanceHatSprite.Play("back");
                 *      }
                 *      else if (!base.LastOwner.IsBackfacing() && !this.instanceHatSprite.IsPlaying("front"))
                 *      {
                 *          this.instanceHatSprite.Play("front");
                 *      }
                 *      if (this.instanceHatSprite.sprite.FlipX != base.LastOwner.sprite.FlipX)
                 *      {
                 *          this.instanceHatSprite.transform.localPosition.Set(this.instanceHatSprite.transform.localPosition.x * -1, this.instanceHatSprite.transform.localPosition.y, this.instanceHatSprite.transform.localPosition.z);
                 *      }
                 *      if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.END_TIMES)
                 *      {
                 *          this.disengageEffect(base.LastOwner);
                 *      }
                 *  }
                 *  else if(GameManager.Instance.CurrentLevelOverrideState != GameManager.LevelOverrideState.END_TIMES)
                 *  {
                 *      this.engageEffect(base.LastOwner);
                 *  }
                 * }*/
            }
        }