Exemplo n.º 1
0
    public NavSystem(List <MapTile> tiles)
    {
        mapTiles = new List <MapTile>();
        mapTiles.AddRange(tiles);
        if (mapTiles.Count == 0)
        {
            throw new NavSystemException("NavSystem initiated with no tiles");
        }

        mesh = new TileMesh(tiles);

        ccFields    = new CCDynamicGlobalFields(tiles);
        ccSolutions = new List <CCEikonalSolver>();

        TileSize = tiles[0].TileSize;
    }
Exemplo n.º 2
0
    public void Initialize_NavSystem()
    {
        // 0000000000000000000000000000000000000000000000000000000000
        // 0000000000000000000000000000000000000000000000000000000000
        // bullshit -- remove this later
        newTileMap = Instantiate(TILEMAP_STAPLE) as GameObject;
        tm         = newTileMap.GetComponent <TileMap> ();
        // 0000000000000000000000000000000000000000000000000000000000

        // first thing is to initiate the mapAnalyzer and retrieve our map data
        // The BIG gap being left here is - LOADING MAPS AND MAP DATA
        // calling MapAnalyzer is a temp fix
        theMapAnalyzer = GetComponentInChildren <mapAnalyzer> ();
        theMapAnalyzer.setMapParameters(
            mapWidthX,
            mapLengthZ,
            terrainMaxWorldHeight,
            terrainMaxHeightDifferential
            );
        Map_Data_Package theMapData = theMapAnalyzer.collectMapData();

        // next step is to send the Map Data to the A* "grid-ifier"
        //      (1) scan the discomfort (g) map and build connecting series of boxes around it
        //		(2) check all boxes for neighboring boxes and create a list of node-neighbor-costs
        theAStarGrid = new AStarGrid(theMapData.getCompleteHeightMap(), theMapData.getCompleteDiscomfortMap(), nodeDimensions);

        // next, we need to initiate the Continuum Crowds Dynamic Global Tile manager to
        // instantiate all its tiles, and fill them with their core data
        theCCDynamicFieldManager = new CCDynamicGlobalFields();
        theCCDynamicFieldManager.setMapData(theMapData);
        theCCDynamicFieldManager.setTileSize(tileSize);
        theCCDynamicFieldManager.initiateTiles();

        // next, we start the CC Dynamic Global Fields Tile manager
        // to begin updating its fields
        CCTiles_UpdateTime = 1f / CCTiles_UpdateFPS;
        theCCDynamicFieldManager.updateTiles();
        StartCoroutine("updateCCTiles");
    }