Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public HQ(Vector3 pos, Color teamColor, Random r, Map m)
        {
            this.map = m;
            this.rand = r;
            this.pos = pos;
            this.teamColor = teamColor;
            bounds = new Circle(pos, hqRadius);
            newUnits = new Buffer<Unit>(5);

            v1 = new Vector3(0, hqRadius, 0);
            v2 = Vector3.Transform(v1, Matrix.CreateRotationZ(MathHelper.ToRadians(360f/3)));
            v3 = Vector3.Transform(v2, Matrix.CreateRotationZ(MathHelper.ToRadians(360f / 3)));
            v1 += pos;
            v2 += pos;
            v3 += pos;

            units = new List<Unit>();
        }