Пример #1
0
    // this is make the game actually start at startup and not wait loading
    private IEnumerator BuildGridEnumerator()
    {
        float buildTime = 0.1f;

        // Get the World Nodes
        _worldBuilder.BuildWorldNodes(buildTime);

        // Get the Map Nodes around the World Nodes
        Dictionary <WorldNode, List <MapNode> > worldAndMapNodes = _worldBuilder.GetWorldAndWrapperNodes();


        // World Nodes and Maps
        foreach (WorldNode worldNode in worldAndMapNodes.Keys)
        {
            List <MapNode> wrapperNodes = worldAndMapNodes[worldNode];

            int mapSize = worldNode.nodeSize;

            foreach (MapNode mapNode in wrapperNodes)
            {
                Vector3 nodeVect = mapNode.nodeLocation;

                int layerCount = mapNode.nodeLayerCount;

                /*
                 * _gridBuilder.BuildLocationGrid(nodeVect, mapSize);
                 *
                 * List<Vector3Int> mapPieceNodes = _gridBuilder.GetGridNodePositions();
                 *
                 * _mapPieceBuilder.AttachMapPieceToMapNode(mapPieceNodes, layerCount, mapSize, 0); // 0 = mapPieces 1 = Roofs
                 */
                // yield return new WaitForSeconds(buildTime);
            }
        }

        // Connectors
        List <MapNode> connectorNodes = _worldBuilder.GetConnectorNodesAndRotations();

        foreach (MapNode connectorNode in connectorNodes)
        {
            Vector3 nodeVect = connectorNode.nodeLocation;

            int layerCount = connectorNode.nodeLayerCount;

            int mapSize = 1; // this is for Each connector

            int rotation = connectorNode.nodeRotation;

            if (rotation == 4) // for the connectors going up
            {
                connectorNode.gameObject.transform.Find("ConnectorNodeCover").transform.localScale = new Vector3Int(8, 8, 8);
            }

            connectorNode.gameObject.transform.localEulerAngles = new Vector3Int(0, rotation * 90, 0);

            /*
             * _gridBuilder.BuildLocationGrid(nodeVect, mapSize);
             *
             * List<Vector3Int> mapPieceNodes = _gridBuilder.GetGridNodePositions();
             *
             * _mapPieceBuilder.AttachMapPieceToMapNode(mapPieceNodes, layerCount, mapSize, 2, rotation); // 2= connectors, 3 = roofs
             */
            // yield return new WaitForSeconds(buildTime);
        }



        /*
         * // Outer Zones
         * List<WorldNode> outerNodes = _worldBuilder.GetOuterNodes();
         * foreach (WorldNode outerNode in outerNodes)
         * {
         *  Vector3 nodeVect = outerNode.nodeLocation;
         *  _outerZoneBuilder.CreateOuterZoneForNode(outerNode);
         *  //yield return new WaitForSeconds(buildTime);
         * }
         *
         * // Docking Zones
         * List<MapNode> dockingNodes = _worldBuilder.GetDockingNodes();
         *
         * foreach (MapNode dockingNode in dockingNodes)
         * {
         *  Vector3 nodeVect = dockingNode.nodeLocation;
         *  int layerCount = dockingNode.nodeLayerCount;
         *  int mapSize = 1; // this is for Each docking tile
         *  _gridBuilder.BuildLocationGrid(nodeVect, mapSize);
         *  List<Vector3Int> mapPieceNodes = _gridBuilder.GetGridNodePositions();
         *  _mapPieceBuilder.AttachMapPieceToMapNode(mapPieceNodes, layerCount, mapSize, 2); // 2= connectors, 3 = roofs
         *  yield return new WaitForSeconds(buildTime);
         * }
         */

        yield return(new WaitForSeconds(buildTime));

        Debug.Log("FINSIHED LOADING!!!!!!!!");
    }