static public Color getColor(RlColor rlColor) { float myRand = rnd.Next(0, (int)(rlColor.rand * 100f)) / 100f; //Debug.Log(rlColor.red + rnd.Next(0, (int)(rlColor.redRand * 100)) / 100 + rlColor.rand); //Debug.Log(rlColor.redRand*100f);// + rlColor.rand); //Debug.Log(rnd.Next(0, 10)); //Debug.Log(rnd.Next(0, (int)(rlColor.redRand * 100f)) / 100f);// + rlColor.rand); return(new Color( rlColor.red + rnd.Next(0, (int)(rlColor.redRand * 100f)) / 100f + myRand, rlColor.green + rnd.Next(0, (int)(rlColor.greenRand * 100f)) / 100f + myRand, rlColor.blue + rnd.Next(0, (int)(rlColor.blueRand * 100f)) / 100f + myRand )); }
public void loadMap() { string filePath = Application.dataPath + mapData; someStrings myStrings; if (File.Exists(filePath)) { string dataAsJson = File.ReadAllText(filePath); myStrings = JsonUtility.FromJson <someStrings>(dataAsJson); } else { myStrings = new someStrings(); //gameData = new GameData(); } tiles = new Tile[myStrings.strings[0].Length, myStrings.strings.Length]; Debug.Log(myStrings.strings[0].Length); Debug.Log(myStrings.strings.Length); for (int i = 0; i < myStrings.strings[0].Length; i++) { for (int j = 0; j < myStrings.strings.Length; j++) { if (myStrings.strings[j].Substring(i, 1) == "#") { tiles[i, j] = new Tile( ch: "#", x: i, y: j, obstructsEverything: true, fgColor: RlColor.getColor(RlColor.WallfgColor), bgColor: RlColor.getColor(RlColor.WallbgColor) ); } else { tiles[i, j] = new Tile( ch: ".", x: i, y: j, fgColor: RlColor.getColor(RlColor.FloorfgColor), bgColor: RlColor.getColor(RlColor.FloorbgColor) ); } } } }