Exemple #1
0
    public void saveAllPointsToJSON(jsonDataHandler handler)
    {
        string pointName = "";
        float  x = 0, y = 0;

        Transform[] children;
        for (int k = 1; k < points.Length + 1; k++)
        {
            pointName = matrix[0, k].getName();
            children  = matrix[0, k].getPoint().GetComponentsInChildren <Transform>(true);
            x         = matrix[0, k].getPoint().GetComponent <RectTransform>().position.x;
            y         = matrix[0, k].getPoint().GetComponent <RectTransform>().position.y;
            bool host = false, mainHost = false, spawnPoint = false, upper = false, lower = false, left = false, right = false, isSwitch = false;

            if (matrix[0, k].isHost())
            {
                host = true;
            }
            if (matrix[0, k].isMainHost())
            {
                mainHost = true;
            }
            if (matrix[0, k].spawnable())
            {
                spawnPoint = true;
            }
            if (children[1].gameObject.activeInHierarchy)
            {
                upper = true;
            }
            if (children[8].gameObject.activeInHierarchy)
            {
                lower = true;
            }
            if (children[15].gameObject.activeInHierarchy)
            {
                right = true;
            }
            if (children[22].gameObject.activeInHierarchy)
            {
                left = true;
            }
            if (children[29].gameObject.activeInHierarchy)
            {
                children[29].gameObject.SetActive(false);
                isSwitch = true;
            }

            handler.addNewPoint(pointName, host, mainHost, spawnPoint, isSwitch, upper, lower, left, right, x, y);
        }
    }
Exemple #2
0
    public void saveAllEdgesToJSON(jsonDataHandler handler)
    {
        int    i, k;
        string vertex1 = "", vertex2 = "";

        for (i = 1; i < points.Length + 1; i++)
        {
            for (k = 1; k < points.Length + 1; k++)
            {
                if (matrix[i, k].isConnected())
                {
                    vertex1 = matrix[i, 0].getName();
                    vertex2 = matrix[i, k].getName();
                    handler.addNewEdge(vertex1, vertex2);
                }
            }
        }
    }
Exemple #3
0
    private void Start()
    {
        handler        = GameObject.Find("userData").GetComponent <jsonDataHandler>();
        gameMap        = gameObject.GetComponent <Graph>();
        gameCTRL       = gameObject.GetComponent <waveHandler>();
        gameData       = gameObject.GetComponent <sendDataToForm>();
        gameComponents = gameObject.GetComponent <GameObjectHolder>();
        money          = gameComponents.HealthAndCurrency.GetComponent <currencyCounter>();
        fillMapWithPoints();
        initializeMapSettings();

        if (handler.currentMapIndex == handler.data.maps.Count - 1)
        {
            restartOrNewMap.text = "Restart";
        }
        else
        {
            restartOrNewMap.text = "Next Map";
        }
    }
    public void saveMapSettingsToJSON(jsonDataHandler handler)
    {
        string mapName = SceneManager.GetActiveScene().name;

        handler.addNewMap(mapName, -1, waves[0].count, waves.Count);
    }