コード例 #1
0
        private void DrawReturnGateInWorld(Camera camera, Player player)
        {
            Rectangle homeHitbox = Rectangle.Empty;

            if (!PotionOfReturnHelper.TryGetGateHitbox(player, out homeHitbox))
            {
                return;
            }
            int num = 0;

            if (player == Main.LocalPlayer)
            {
                _interactionChecker.AttemptInteraction(player, homeHitbox);
            }
            num = 0;
            if (!player.PotionOfReturnOriginalUsePosition.HasValue)
            {
                return;
            }
            SpriteBatch  spriteBatch = camera.SpriteBatch;
            SamplerState sampler     = camera.Sampler;

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, sampler, DepthStencilState.None, camera.Rasterizer, null, camera.GameViewMatrix.TransformationMatrix);
            float   opacity        = ((player.whoAmI == Main.myPlayer) ? 1f : 0.1f);
            Vector2 value          = player.PotionOfReturnOriginalUsePosition.Value;
            Vector2 value2         = new Vector2(0f, -player.height / 2);
            Vector2 worldPosition  = value + value2;
            Vector2 worldPosition2 = homeHitbox.Center.ToVector2();
            PotionOfReturnGateHelper potionOfReturnGateHelper  = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.ExitPoint, worldPosition, opacity);
            PotionOfReturnGateHelper potionOfReturnGateHelper2 = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.EntryPoint, worldPosition2, opacity);

            if (!Main.gamePaused)
            {
                potionOfReturnGateHelper.Update();
                potionOfReturnGateHelper2.Update();
            }
            _voidLensData.Clear();
            potionOfReturnGateHelper.DrawToDrawData(_voidLensData, 0);
            potionOfReturnGateHelper2.DrawToDrawData(_voidLensData, num);
            foreach (DrawData voidLensDatum in _voidLensData)
            {
                voidLensDatum.Draw(spriteBatch);
            }
            spriteBatch.End();
        }
コード例 #2
0
        private void DrawReturnGateInWorld(Camera camera, Player player)
        {
            Rectangle homeHitbox = Rectangle.Empty;

            if (!PotionOfReturnHelper.TryGetGateHitbox(player, out homeHitbox))
            {
                return;
            }
            if (player == Main.LocalPlayer)
            {
                int num = (int)this._interactionChecker.AttemptInteraction(player, homeHitbox);
            }
            int selectionMode = 0;

            if (!player.PotionOfReturnOriginalUsePosition.HasValue)
            {
                return;
            }
            SpriteBatch  spriteBatch = camera.SpriteBatch;
            SamplerState sampler     = camera.Sampler;

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, sampler, DepthStencilState.None, camera.Rasterizer, (Effect)null, camera.GameViewMatrix.TransformationMatrix);
            float   opacity       = player.whoAmI == Main.myPlayer ? 1f : 0.1f;
            Vector2 worldPosition = player.PotionOfReturnOriginalUsePosition.Value + new Vector2(0.0f, (float)(-player.height / 2));
            Vector2 vector2       = homeHitbox.Center.ToVector2();
            PotionOfReturnGateHelper returnGateHelper1 = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.ExitPoint, worldPosition, opacity);
            PotionOfReturnGateHelper returnGateHelper2 = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.EntryPoint, vector2, opacity);

            if (!Main.gamePaused)
            {
                returnGateHelper1.Update();
                returnGateHelper2.Update();
            }
            this._voidLensData.Clear();
            returnGateHelper1.DrawToDrawData(this._voidLensData, 0);
            returnGateHelper2.DrawToDrawData(this._voidLensData, selectionMode);
            foreach (DrawData drawData in this._voidLensData)
            {
                drawData.Draw(spriteBatch);
            }
            spriteBatch.End();
        }