コード例 #1
0
 private void drawLevel(GameTime gameTime, SpriteBatch spriteBatch)
 {
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera.Instance.ViewMatrix);
     level.Draw(gameTime, spriteBatch);
     spriteBatch.End();
     spriteBatch.Begin();
     hud.Draw(gameTime, spriteBatch);
 }
コード例 #2
0
    public override void Draw()
    {
        if (!IsAlive)
        {
            return;
        }

        if (WallTouch != 0 && !IsOnGround)
        {
            playerTileset.X = 4;
        }
        else if (IsOnGround)
        {
            if (Math.Abs(velocity.X) > 1f)
            {
                playerTileset.X = 1;
            }
            else
            {
                playerTileset.X = 0;
            }
        }
        else
        {
            if (velocity.Y > 0)
            {
                playerTileset.X = 2;
            }
            else
            {
                playerTileset.X = 3;
            }
        }

        occlusionTileset.Position = playerTileset.Position;

        playerMesh.FillColor = false;

        playerMesh.Reset();

        playerMesh.Translate(position);
        playerMesh.Scale(size);

        if (dashTarget != null)
        {
            playerMesh.RotateZ(dashTarget.angle);
            playerMesh.Scale(1 + dashTarget.lastStep * 2.4f, 1 - dashTarget.lastStep * 0.5f);
            playerMesh.RotateZ(-dashTarget.angle);
        }

        if (dodgeTarget != null)
        {
            playerMesh.RotateZ(dodgeTarget.stepAngle);
            playerMesh.Scale(1 + dodgeTarget.stepLength * 1.5f, 1 - dodgeTarget.stepLength * 0.7f);
            playerMesh.RotateZ(-dodgeTarget.stepAngle);
        }

        playerMesh.Scale(new Vector2(dir, 1));

        playerMesh.Color = Color.Black;

        playerMesh.Tileset = occlusionTileset;
        playerMesh.Draw();

        playerMesh.Color = Color.White;

        playerMesh.Tileset = playerTileset;
        playerMesh.Draw();

        float glow = Math.Max(1 - dodgeCooldown.PercentageDone, 1 - dashCooldown.PercentageDone);

        if (glow > 0)
        {
            playerMesh.FillColor = true;
            playerMesh.Color     = new Color(1, 1, 1, glow);

            playerMesh.Draw();
        }

        if (receivedServerPosition)
        {
            playerMesh.Color     = new Color(0, 1, 0, 0.5f);
            playerMesh.FillColor = true;

            playerMesh.Reset();

            playerMesh.Translate(serverPosition);
            playerMesh.Scale(size);
            playerMesh.Scale(new Vector2(-dir, 1));

            playerMesh.Draw();
        }

        //if (shadow != null && IsLocalPlayer && (dashCooldown.IsDone || IsDashing) && !Disabled) shadow.Draw();
        if (IsLocalPlayer && (CanDash || IsDashing))
        {
            shadow.Draw();
        }

        hud.Draw();
    }