Пример #1
0
    ////////////////////////////////////////////////
    ////////////////////////////////////////////////

    public static void BuildWorldForClient()
    {
        SyncedVars _syncedVars = GameObject.Find("SyncedVars").GetComponent <SyncedVars>(); // needs to be here, function runs before awake

        if (_syncedVars == null)
        {
            Debug.LogError("We got a problem here");
        }

        int GlobalSeed = _syncedVars.GlobalSeed;

        Random.InitState(GlobalSeed);

        // Get the World Nodes
        WorldBuilder.BuildWorldNodes();

        LayerManager.MakeAllNodeLayersVisible();

        Debug.Log("FINSIHED Building World!!!!!!!!");
    }
Пример #2
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!!!!!!!!");
    }
Пример #3
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);
        _worldNodes = _worldBuilder.GetWorldNodes();

        // 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)
        {
            worldNode._worldManager = this;
            List <MapNode> wrapperNodes = worldAndMapNodes[worldNode];
            foreach (MapNode mapNode in wrapperNodes)
            {
                mapNode._worldManager = this;
            }
        }


        // Connectors
        Dictionary <WorldNode, List <ConnectorNode> > worldAndConnectorNodes = _worldBuilder.GetWorldAndConnectorNodes();

        //Debug.Log("worldAndConnectorNodes.Count: " + worldAndConnectorNodes.Count);

        foreach (WorldNode worldNode in worldAndConnectorNodes.Keys)
        {
            List <ConnectorNode> connectorNodes = worldAndConnectorNodes[worldNode];

            foreach (ConnectorNode connectorNode in connectorNodes)
            {
                connectorNode._worldManager = this;

                Vector3 nodeVect = connectorNode.nodeLocation;

                int layerCount = connectorNode.nodeLayerCount;

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

                int rotation = connectorNode.nodeRotation;

                if (connectorNode.connectorUp)                                                                                                       // for the connectors going up ... FCKING ANNOYING THAT ITS USING A ROTATION AND NOT A TAG
                {
                    connectorNode.gameObject.transform.Find("ConnectorNodeCover(Clone)").transform.localPosition             = new Vector3(0, 0, 0); // to fix annoying vertical connector
                    connectorNode.gameObject.transform.Find("ConnectorNodeCover(Clone)").transform.localScale                = new Vector3(8, 8, 8);
                    connectorNode.gameObject.transform.Find("ConnectorNodeCover(Clone)").Find("Select").transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                }

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



        // Outer Zones

        /*  List<MapNode> outerNodes = _worldBuilder.GetOuterNodes();
         * foreach (MapNode outerNode in outerNodes)
         * {
         *    Vector3 nodeVect = outerNode.nodeLocation;
         *    _outerZoneBuilder.CreateOuterZoneForNode(outerNode);
         * }
         *
         *
         * // 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<Vector3> mapPieceNodes = _gridBuilder.GetGridNodePositions();
         *    _mapPieceBuilder.AttachMapPieceToMapNode(dockingNode, mapPieceNodes, layerCount, mapSize, 2); // 2= connectors, 3 = roofs
         *    yield return new WaitForSeconds(buildTime);
         * }
         */

        yield return(new WaitForSeconds(buildTime));

        Debug.Log("FINSIHED Building World!!!!!!!!");
    }