private void Update()
        {
            BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(player.PlayerIDX);

            if (instanceForPlayer.GetButtonDown(GungeonActions.GungeonActionType.DodgeRoll))
            {
                instanceForPlayer.ConsumeButtonDown(GungeonActions.GungeonActionType.DodgeRoll);
                Vector2 vector = Vector2.zero;
                if (player.CurrentInputState != PlayerInputState.NoMovement)
                {
                    vector = this.AdjustInputVector(instanceForPlayer.ActiveActions.Move.Vector, BraveInput.MagnetAngles.movementCardinal, BraveInput.MagnetAngles.movementOrdinal);
                }
                if (vector.magnitude > 1f)
                {
                    vector.Normalize();
                }
                if (!m_isJumping)
                {
                    player.StartCoroutine(this.Jump(vector));
                }
            }
            if (player.IsOnFire)
            {
                if (this.IsJumping)
                {
                    player.IncreaseFire(-(BraveTime.DeltaTime * 0.466666f));
                }
            }
        }
 protected override void Update()
 {
     if (gun.CurrentOwner)
     {
         if (!gun.PreventNormalFireAudio)
         {
             this.gun.PreventNormalFireAudio = true;
         }
         if (!gun.IsReloading && !HasReloaded)
         {
             this.HasReloaded = true;
         }
         PlayerController player            = (PlayerController)this.gun.CurrentOwner;
         BraveInput       instanceForPlayer = BraveInput.GetInstanceForPlayer(player.PlayerIDX);
         if (jammed && gun.ClipShotsRemaining == gun.ClipCapacity && instanceForPlayer.GetButtonDown(GungeonActions.GungeonActionType.Shoot))
         {
             this.gun.ClearCooldowns();
             this.gun.reloadTime = .7f;
             this.gun.DefaultModule.cooldownTime = .17f;
             jammed = false;
         }
     }
 }
Ejemplo n.º 3
0
        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;
            }
        }