Esempio n. 1
0
    // ******************************************************************************************
    //              PUBLIC ACCESSORS and CONSTRUCTORS
    // ******************************************************************************************
    public CCDynamicGlobalFields()
    {
        _tiles = new Dictionary <Location, CC_Tile>();        // (new LocationComparator());
        _units = new List <CC_Unit> ();

        theMapData = new Map_Data_Package();
    }
Esempio n. 2
0
    public Map_Data_Package collectMapData()
    {
        float[,] h, g;
        Vector2[,] dh;

        h  = new float[xSteps, zSteps];
        g  = new float[xSteps, zSteps];
        dh = new Vector2[xSteps, zSteps];

        h  = generateHeightMap();
        dh = generateMatrixGradient(h);
        g  = generateDiscomfortMap(dh);

        Map_Data_Package mapData = new Map_Data_Package(h, g, dh);

        discomfortMap = TextureGenerator.TextureFromMap(g);

        return(mapData);
    }
Esempio n. 3
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");
    }
Esempio n. 4
0
 public void setMapData(Map_Data_Package data)
 {
     theMapData = data;
     _mapX      = data.getMapX();
     _mapY      = data.getMapY();
 }