예제 #1
0
        public static void Render(SceneGame gs, Graphics g)
        {
            //타워가 선택되었을 때 감지 범위 그리기
            if (gs.isDebugMode && selectedTower >= 0 && gs.currentStage.towerContainer[selectedTower] != null)
            {
                gs.currentStage.towerContainer[selectedTower].RenderRange(g);
            }
            if (selectedTower >= 0 && gs.currentStage.towerContainer[selectedTower] != null)
            {
                BaseTower tower = gs.currentStage.towerContainer[selectedTower];
                g.DrawEllipse(new Pen(Color.AliceBlue), tower.posX - tower.Width / 2 - 5, tower.posY - tower.Height / 2 - 5, tower.Width + 10, tower.Height + 10);
            }
            //오버레이
            if (currentMode == 1)
            {
                //방향에 맞게 그리기
                for (int i = 0; i < buildableColour.Length; i++)
                {
                    if (mousePositionColour == buildableColour[i])
                    {
                        int radius    = selectedTowerClass.getRadius();
                        int towerPosX = (int)(MouseClass.mouseX);
                        int towerPosY = (int)(MouseClass.mouseY);

                        int towerW = selectedTowerClass.Width;
                        int towerH = selectedTowerClass.Height;

                        selectedTowerClass.Spawn((int)(MouseClass.mouseX), (int)(MouseClass.mouseY), i);

                        if (MouseClass.mouseX < 480 && MouseClass.mouseY < 480)
                        {
                            selectedTowerClass.Render(gs, g, 1);

                            //g.FillEllipse(new SolidBrush(Color.FromArgb(31, 240, 240, 255)), towerPosX - radius, towerPosY - radius, radius * 2, radius * 2);
                            //g.DrawEllipse(new Pen(Color.FromArgb(63, 138, 130, 255), 2), towerPosX - radius, towerPosY - radius, radius * 2, radius * 2);
                            selectedTowerClass.RenderRange(g);
                        }

                        break;
                    }
                }

                //현재 존재하는 타워의 감지범위 그리기

                /*for (int i = 0; i < gs.currentStage.towersNo; i++)
                 * {
                 *  if (gs.isDebugMode)
                 *  {
                 *      gs.currentStage.towerContainer[i].RenderRange(g);
                 *  }
                 * }*/
            }
            //디버그
            if (gs.isDebugMode)
            {
                g.DrawString("Selected tower: " + selectedTower, gs.font, new SolidBrush(Color.White), 10, 70);
                //g.FillRectangle(new SolidBrush(mousePositionColour), 10, 85, 15, 15);
                g.DrawString("Score: " + Player.getScore(), gs.font, new SolidBrush(Color.White), 10, 85);
                g.DrawString("Playing time: " + gs.currentStage.elapsedTime, gs.font, new SolidBrush(Color.White), 10, 100);
                g.DrawString("Mob spawn interval: " + gs.currentStage.mobSpawnInterval, gs.font, new SolidBrush(Color.White), 10, 115);
            }
        }