Ejemplo n.º 1
0
        private void DrawPlayer(Context context, Player player)
        {
            TextureImage image = TempFindPlayerImage(player);
            float        drawX = player.GetPx() - 0.5f * cellWidth;
            float        drawY = player.GetPy() - 0.5f * cellHeight;

            if (CVars.g_drawPlayerCell.boolValue)
            {
                context.DrawRect(player.GetCx() * cellWidth, player.GetCy() * cellHeight, cellWidth, cellHeight, Color.White);
            }

            if (CVars.g_drawPlayerMovable.boolValue)
            {
                context.DrawRect(drawX, drawY, cellWidth, cellHeight, Color.Yellow);
            }

            if (player.IsInfected())
            {
                if (blink)
                {
                    AnimationInstance anim = player.currentAnimation;
                    anim.Draw(context, drawX + 0.5f * cellWidth, drawY + cellHeight);
                }
            }
            else
            {
                AnimationInstance anim = player.currentAnimation;
                anim.Draw(context, drawX + 0.5f * cellWidth, drawY + cellHeight);
            }

            if (CVars.g_drawPlayerStepRect.boolValue)
            {
                int stepX = Math.Sign(player.px - player.CellCenterPx());
                int stepY = Math.Sign(player.py - player.CellCenterPy());

                bool hasStepX = stepX != 0;
                bool hasStepY = stepY != 0;

                int cx = player.GetCx();
                int cy = player.GetCy();

                if (hasStepX && hasStepY)
                {
                    DrawCellRect(context, cx + stepX, cy, Color.Yellow);
                    DrawCellRect(context, cx, cy + stepY, Color.Yellow);
                    DrawCellRect(context, cx + stepX, cy + stepY, Color.Yellow);
                }
                else if (hasStepX)
                {
                    DrawCellRect(context, cx + stepX, cy, Color.Yellow);
                }
                else if (hasStepY)
                {
                    DrawCellRect(context, cx, cy + stepY, Color.Yellow);
                }
            }
        }
Ejemplo n.º 2
0
        private void DrawBomb(Context context, Bomb bomb)
        {
            float drawX = bomb.GetPx();
            float drawY = bomb.GetPy();

            AnimationInstance anim = bomb.currentAnimation;

            anim.Draw(context, drawX, drawY + 0.5f * cellHeight, bomb.IsBlocked ? Color.Red : Color.White);

            if (CVars.g_drawBombDir.boolValue)
            {
                TextureImage dirImage = dirLookup[bomb.direction];
                context.DrawImage(dirImage, drawX - 0.5f * dirImage.GetWidth(), drawY - 0.5f * dirImage.GetHeight());
            }

            context.DrawRect(bomb.cx * cellWidth, bomb.cy * cellHeight, cellWidth, cellHeight, Color.White);
            context.DrawRect(bomb.px - 0.5f * cellWidth, bomb.py - 0.5f * cellHeight, cellWidth, cellHeight, Color.Red);
        }