Exemple #1
0
        public AIMainGame(int teamCount, GraphicsDevice gd)
        {
            rand = new Random();

            pd = new PrimitiveDrawer(gd);
            Matrix proj = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), (float)gd.Viewport.Width / gd.Viewport.Height, 0.1f, 1000f);

            cam = new Camera(new Vector3(gridLength/2, gridLength/2, 30), proj);
            map = new Map(gd, gridLength, gridLength);

            if (teamCount > teamColors.Length)
            {
                teamCount = teamColors.Length;
            }

            //Initialize all the game objects
            units = new List<Unit>();
            resources = new List<ResourceChunk>();
            towers = new List<RadioTower>();
            removeChunks = new List<ResourceChunk>();
            hqs = new List<HQ>();
            bullets = new List<Bullet>(200);

            initializeTeams(teamCount);
            initializeResources();
            initializeTowers();
        }
Exemple #2
0
 public void Draw(PrimitiveDrawer pd)
 {
     if (!isActive)
     {
         return;
     }
     pd.DrawCircle(bounds, Color.DarkGoldenrod);
 }
Exemple #3
0
        public void Draw(PrimitiveDrawer pd)
        {
            Vector3 v1 = new Vector3(0, 2f, 0);
            Vector3 v2 = new Vector3(0.5f, -0.25f, 0);
            Vector3 v3 = new Vector3(-0.5f, -0.25f, 0);
            Vector3 pos = bounds.Center;

            Color c = isActive ? teamColor : Color.Gray;

            pd.DrawTriangle(pos + v1, pos + v2, pos + v3, c);
            pd.DrawCircle(new Circle(pos + v1, 0.5f), c);
            pd.DrawCircle(commCircle, c);
        }
Exemple #4
0
        public void Draw(PrimitiveDrawer pd, GameTime g, Camera cam)
        {
            Color color = Color.FromNonPremultiplied(0, 120, 200, 45);

            //Draw the grid
            pd.Begin(PrimitiveType.LineList, cam);
            for (int i = 0; i <= width; i++)
            {
                pd.DrawLine(new Vector3(i, 0, depth), new Vector3(i, height, depth), color);
            }

            for (int i = 0; i <= height; i++)
            {
                pd.DrawLine(new Vector3(0, i, depth), new Vector3(width, i, depth), color);
            }
            pd.End();
        }
Exemple #5
0
        //Draw a rotated triangle for our unit
        public void Draw(PrimitiveDrawer pd, GameTime g, Camera cam)
        {
            Vector3 v1 = new Vector3(0.5f, 0, 0);
            Vector3 v2 = new Vector3(-0.5f, -0.25f, 0);
            Vector3 v3 = new Vector3(-0.5f, 0.25f, 0);

            Matrix rotMatrix = Matrix.CreateRotationZ(Rotation);
            v1 = Vector3.Transform(v1, rotMatrix);
            v2 = Vector3.Transform(v2, rotMatrix);
            v3 = Vector3.Transform(v3, rotMatrix);

            pd.FillTriangle(Pos + v1, Pos + v2, Pos + v3, TeamColor);
        }
Exemple #6
0
 public void Draw(PrimitiveDrawer pd)
 {
     pd.DrawCircle(GetBounds(), Color.Tan);
 }
Exemple #7
0
 public void Draw(PrimitiveDrawer pd)
 {
     pd.DrawCircle(bounds, teamColor);
     pd.DrawTriangle(v1, v2, v3, teamColor);
 }