Example #1
0
        public AStar(VG.Map.Tissue t)
        {
            this.map = t;
            nodeGrid = new AStarNode[200][];
            openSet  = new bool[200][];
            closedSet= new bool[200][];
            cacheable = new bool[200][];
            for (int i = 0; i < 200; i++)
            {
                nodeGrid[i] = new AStarNode[200];
                openSet[i] = new bool[200];
                closedSet[i] = new bool[200];
                cacheable[i] = new bool[200];
            }

            // prepare cacheable set
            EntityCollection aznCol = map.get_EntitiesByType(EntityEnum.AZN);
            for (int i = 0; i < aznCol.Count; i++)
                cacheable[aznCol[i].X][aznCol[i].Y] = true;

            EntityCollection hpCol = map.get_EntitiesByType(EntityEnum.HoshimiPoint);
            for (int i = 0; i < hpCol.Count; i++)
                cacheable[hpCol[i].X][hpCol[i].Y] = true;

            //cache PierreIP
            cacheable[Global.MYAI.PierreTeamInjectionPoint.X][Global.MYAI.PierreTeamInjectionPoint.Y] = true;

            cache = new System.Collections.Hashtable( (hpCol.Count * hpCol.Count) + (aznCol.Count * aznCol.Count) );

            aznCol = null;	// garbage-collected
            hpCol  = null;
        }
Example #2
0
        public AStar(VG.Map.Tissue t)
        {
            this.map  = t;
            nodeGrid  = new AStarNode[200][];
            openSet   = new bool[200][];
            closedSet = new bool[200][];
            cacheable = new bool[200][];
            for (int i = 0; i < 200; i++)
            {
                nodeGrid[i]  = new AStarNode[200];
                openSet[i]   = new bool[200];
                closedSet[i] = new bool[200];
                cacheable[i] = new bool[200];
            }

            // prepare cacheable set
            EntityCollection aznCol = map.get_EntitiesByType(EntityEnum.AZN);

            for (int i = 0; i < aznCol.Count; i++)
            {
                cacheable[aznCol[i].X][aznCol[i].Y] = true;
            }

            EntityCollection hpCol = map.get_EntitiesByType(EntityEnum.HoshimiPoint);

            for (int i = 0; i < hpCol.Count; i++)
            {
                cacheable[hpCol[i].X][hpCol[i].Y] = true;
            }

            //cache PierreIP
            cacheable[Global.MYAI.PierreTeamInjectionPoint.X][Global.MYAI.PierreTeamInjectionPoint.Y] = true;

            cache = new System.Collections.Hashtable((hpCol.Count * hpCol.Count) + (aznCol.Count * aznCol.Count));

            aznCol = null;              // garbage-collected
            hpCol  = null;
        }