Exemplo n.º 1
0
    public void updateTiles(DiffuseAble heightLst, DiffuseAble valLst, Color clrPos, Color clrNeg, int clrMergeOption, bool setHeight)
    {
        //float heightMult = (lst.Count + lst[0].L.Count) / 2 * heightScale;

        for (int x = 0; x < GridManager.Singleton.Width; x++)
        {
            for (int y = 0; y < GridManager.Singleton.Height; y++)
            {
                Tile currTile = tileList[x][y];

                currTile.posClr = clrPos;
                currTile.negClr = clrNeg;

                currTile.clrMergeOption = clrMergeOption;

                //Tile tileHandler = currTile.GetComponent<Tile>();

                float currHeight    = heightLst.GetValueWithOutEffects(x, y);
                float currHeightVal = heightLst.GetValueWithEffects(x, y); // for color
                float currVal       = valLst.GetValueWithEffects(x, y);

                float currCityVal = treeCityMap.GetValueWithEffects(x, y);
                if (currCityVal < 0)
                {
                    currCityVal *= -1;
                    currCityVal  = currCityVal * Time.deltaTime / 200;
                    if (Random.Range(0f, 1f) < currCityVal)
                    {
                        //Debug.Log("POINT POP AT: " + x + "," + y);
                        GameObject carbonPointObj = Instantiate(carbonPoint);
                        carbonPointObj.transform.position = new Vector3(currTile.transform.position.x, currTile.transform.lossyScale.y, currTile.transform.position.z);
                    }
                }

                //float currHeight = mapHeight(currVal);
                //Debug.Log("2gen tile " + x + "," + y + " val: " + currVal);

                if (setHeight)
                {
                    currTile.setHeight(currHeight);
                }
                currTile.setHeightVal(currHeightVal);
                currTile.setVal(currVal);
                //currTile.setColor(currClr);
            }
        }
    }