Exemplo n.º 1
0
        public void DrawIf(SpriteBatch sb, HUDDrawData hudDrawData)
        {
            /*if( Main.InGameUI.CurrentState != null ) {
             *      return;
             * }*/
            if (Main.LocalPlayer.mouseInterface)                //not HUDLibraries.IsMouseInterfacingWithUI; inventory always == true
            {
                return;
            }
            if (HUDElementsLibAPI.GetDraggingElement() != null)
            {
                return;
            }

            if (hudDrawData.IsPreAimMode)
            {
                this.DrawPreAimCursor(sb, hudDrawData.AimPercent);
            }
            else if (hudDrawData.IsAimMode)
            {
                this.DrawAimCursor(sb);
            }
            else if (hudDrawData.HasGun)
            {
                this.DrawUnaimCursor(sb);
            }
        }
Exemplo n.º 2
0
        ////////////////

        public HUDDrawData(HUDDrawData prevHudData)
        {
            var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>();

            this.HasGun       = !myplayer.GunHandling.IsAnimating && PlayerLogic.IsHoldingGun(Main.LocalPlayer);
            this.IsReloading  = myplayer.GunHandling.IsReloading;
            this.AimPercent   = myplayer.AimMode.AimPercent;
            this.IsAimMode    = myplayer.AimMode.IsModeActive;
            this.IsPreAimMode = !myplayer.AimMode.IsModeActive && myplayer.AimMode.IsModeActivating;
        }
Exemplo n.º 3
0
        ////////////////

        public bool ConsumesCursor(HUDDrawData hudDrawData)
        {
            /*if( Main.InGameUI.CurrentState != null ) {
             *      return false;
             * }*/
            if (HUDLibraries.IsMouseInterfacingWithUI)                //Main.LocalPlayer.mouseInterface
            {
                return(false);
            }

            return(hudDrawData.IsAimMode ||
                   (hudDrawData.IsPreAimMode && hudDrawData.AimPercent > 0.25f));
        }
Exemplo n.º 4
0
        ////////////////

        private void UpdatePreAimCursorAnimation(HUDDrawData hudDrawData)
        {
            var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>();

            if (!myplayer.AimMode.IsModeActivating || myplayer.AimMode.IsModeActive)
            {
                return;
            }

            this.PreAimZoomAnimationPercent += 1f / 20f;
            if (this.PreAimZoomAnimationPercent > 1f)
            {
                this.PreAimZoomAnimationPercent = 0f;
            }
        }
Exemplo n.º 5
0
        private void UpdateAimCursorAnimation(HUDDrawData hudDrawData)
        {
            var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>();

            if (!myplayer.AimMode.IsModeActive)
            {
                // Fade out and zoom out slowly, invisibly
                if (this.AimZoomAnimationPercent >= 0f)
                {
                    this.AimZoomAnimationPercent -= 1f / CrosshairHUD.CrosshairDurationTicksMax;
                }
                else
                {
                    this.AimZoomAnimationPercent = -1f;
                }
            }
            else
            {
                // Begin fade in and zoom in
                if (this.AimZoomAnimationPercent == -1f)
                {
                    if (myplayer.AimMode.IsQuickDrawActive)
                    {
                        this.AimZoomAnimationPercent = 1f;
                    }
                    else
                    {
                        this.AimZoomAnimationPercent = 0f;
                    }
                }
                else if (this.AimZoomAnimationPercent <= 1f)
                {
                    this.AimZoomAnimationPercent += 1f / CrosshairHUD.CrosshairDurationTicksMax;                      // Actual fading in
                }

                if (this.AimZoomAnimationPercent > 1f)
                {
                    this.AimZoomAnimationPercent = 1f;
                }
            }
        }
Exemplo n.º 6
0
 public void Update(HUDDrawData hudDrawData)
 {
     this.UpdatePreAimCursorAnimation(hudDrawData);
     this.UpdateAimCursorAnimation(hudDrawData);
 }