Ejemplo n.º 1
0
    public override SimpleJSON.JSONClass GetProperties()
    {
        // return the properties
        SimpleJSON.JSONClass N = base.GetProperties();        // new SimpleJSON.JSONClass();
//		Debug.Log("Matrix floor Get prop:"+N.ToString());
//		SimpleJSON.JSONClass N = new SimpleJSON.JSONClass();
        N[JsonUtil.dimensionsKey][JsonUtil.sizeXkey].AsInt = sizeX;
        N[JsonUtil.dimensionsKey][JsonUtil.sizeZkey].AsInt = sizeZ;
        N[plantedArrayKey] = new SimpleJSON.JSONArray();
        for (int i = 0; i < sizeX; i++)
        {
            for (int j = 0; j < sizeZ; j++)
            {
                if (squares[i, j].planted)
                {
                    SimpleJSON.JSONClass planted = new SimpleJSON.JSONClass();
                    planted[posX].AsInt           = i;
                    planted[posZ].AsInt           = j;
                    planted[color]                = JsonUtil.ConvertColorToJson(squares[i, j].targetColor);
                    planted[plantPrefabKey].AsInt = squares[i, j].flowerIndex;
                    N[plantedArrayKey].Add(planted);
                }
            }
        }
        return(N);
    }