Worked on map viewer
This commit is contained in:
@ -1,27 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Assets.Scripts.Model.Config;
|
||||
using TransportGame.Utils;
|
||||
|
||||
namespace TransportGame.Business
|
||||
{
|
||||
public static class ConfigurationManager
|
||||
{
|
||||
public static readonly string BiomeDirectory = "Assets\\Data\\Biomes";
|
||||
public static readonly string ConfigurationDirectory = "Assets\\Data\\Config";
|
||||
|
||||
public static readonly string TerrGenConfigFile = "tergen.xml";
|
||||
|
||||
public static TerrainGeneratorConfig TerrGenConfig { get; private set; }
|
||||
|
||||
public static void LoadConfiguration()
|
||||
{
|
||||
// Load terrgen config
|
||||
TerrGenConfig = XmlHelper.Deserialize<TerrainGeneratorConfig>(Path.Combine(ConfigurationDirectory, TerrGenConfigFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Assets.Scripts.Model.Config;
|
||||
using TransportGame.Utils;
|
||||
|
||||
namespace TransportGame.Business
|
||||
{
|
||||
public static class ConfigurationManager
|
||||
{
|
||||
public static readonly string BiomeDirectory = "Assets\\Data\\Biomes";
|
||||
public static readonly string ConfigurationDirectory = "Assets\\Data\\Config";
|
||||
|
||||
public static readonly string TerrGenConfigFile = "tergen.xml";
|
||||
|
||||
public static TerrainGeneratorConfig TerrGenConfig { get; private set; }
|
||||
|
||||
public static void LoadConfiguration()
|
||||
{
|
||||
// Load terrgen config
|
||||
TerrGenConfig = XmlHelper.Deserialize<TerrainGeneratorConfig>(Path.Combine(ConfigurationDirectory, TerrGenConfigFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,84 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TransportGame.Business;
|
||||
using TransportGame.Model;
|
||||
using TransportGame.Noise;
|
||||
using TransportGame.Utils;
|
||||
using TransportGame.Utils.Algorithms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TransportGame.Generator
|
||||
{
|
||||
public class TerrainGenerator
|
||||
{
|
||||
public NoiseGenerator Noise { get; set; }
|
||||
|
||||
private System.Random random = new System.Random();
|
||||
|
||||
public TerrainGenerator()
|
||||
{
|
||||
Noise = new PerlinNoiseGenerator();
|
||||
|
||||
if (ConfigurationManager.TerrGenConfig == null)
|
||||
throw new Exception("WTF?");
|
||||
|
||||
Noise.Octaves = ConfigurationManager.TerrGenConfig.NoiseOctaves;
|
||||
Noise.NonLinearPower = ConfigurationManager.TerrGenConfig.NoiseNonLinearPower;
|
||||
Noise.Scale = ConfigurationManager.TerrGenConfig.ElevationScale;
|
||||
}
|
||||
|
||||
public Map Generate(int width, int height)
|
||||
{
|
||||
// Create map
|
||||
Map map = new Map(width, height);
|
||||
|
||||
// Pick a random biome
|
||||
map.Biome = PickBiome();
|
||||
Logger.Info("Picked biome: {0}", map.Biome.Name);
|
||||
|
||||
// Generate elevation
|
||||
GenerateElevation(map);
|
||||
|
||||
// Generate water level
|
||||
float waterAmount = random.NextSingle(map.Biome.Moisture.Minimum, map.Biome.Moisture.Maximum);
|
||||
map.WaterLevel = Mathf.Pow(waterAmount, 3) * (map.Biome.HeightRange.Maximum - map.Biome.HeightRange.Minimum) + map.Biome.HeightRange.Minimum;
|
||||
|
||||
DumpData(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
private Biome PickBiome()
|
||||
{
|
||||
int biomeCount = BiomeManager.Biomes.Count();
|
||||
int biome = random.Next(biomeCount);
|
||||
|
||||
return BiomeManager.Biomes.ElementAt(biome);
|
||||
}
|
||||
|
||||
private void GenerateElevation(Map map)
|
||||
{
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
map[x, y] = Noise.Generate(x, y, map.Biome.HeightRange.Minimum, map.Biome.HeightRange.Maximum);
|
||||
}
|
||||
|
||||
private void DumpData(Map map)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
{
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
{
|
||||
builder.Append(map[x, y]);
|
||||
builder.Append(';');
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
Logger.Info("Generated map: \n{0}", builder.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using TransportGame.Business;
|
||||
using TransportGame.Model;
|
||||
using TransportGame.Noise;
|
||||
using TransportGame.Utils;
|
||||
using TransportGame.Utils.Algorithms;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TransportGame.Generator
|
||||
{
|
||||
public class TerrainGenerator
|
||||
{
|
||||
public NoiseGenerator Noise { get; set; }
|
||||
|
||||
private System.Random random = new System.Random();
|
||||
|
||||
public TerrainGenerator()
|
||||
{
|
||||
Noise = new PerlinNoiseGenerator();
|
||||
|
||||
if (ConfigurationManager.TerrGenConfig == null)
|
||||
throw new Exception("WTF?");
|
||||
|
||||
Noise.Octaves = ConfigurationManager.TerrGenConfig.NoiseOctaves;
|
||||
Noise.NonLinearPower = ConfigurationManager.TerrGenConfig.NoiseNonLinearPower;
|
||||
Noise.Scale = ConfigurationManager.TerrGenConfig.ElevationScale;
|
||||
}
|
||||
|
||||
public Map Generate(int width, int height)
|
||||
{
|
||||
// Create map
|
||||
Map map = new Map(width, height);
|
||||
|
||||
// Pick a random biome
|
||||
map.Biome = PickBiome();
|
||||
Logger.Info("Picked biome: {0}", map.Biome.Name);
|
||||
|
||||
// Generate elevation
|
||||
GenerateElevation(map);
|
||||
|
||||
// Generate water level
|
||||
float waterAmount = random.NextSingle(map.Biome.Moisture.Minimum, map.Biome.Moisture.Maximum);
|
||||
map.WaterLevel = Mathf.Pow(waterAmount, ConfigurationManager.TerrGenConfig.WaterNonLinearPower)
|
||||
* (map.Biome.HeightRange.Maximum - map.Biome.HeightRange.Minimum) + map.Biome.HeightRange.Minimum;
|
||||
|
||||
DumpData(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
private Biome PickBiome()
|
||||
{
|
||||
int biomeCount = BiomeManager.Biomes.Count();
|
||||
int biome = random.Next(biomeCount);
|
||||
|
||||
return BiomeManager.Biomes.ElementAt(biome);
|
||||
}
|
||||
|
||||
private void GenerateElevation(Map map)
|
||||
{
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
map[x, y] = Noise.Generate(x, y, map.Biome.HeightRange.Minimum, map.Biome.HeightRange.Maximum);
|
||||
}
|
||||
|
||||
private void DumpData(Map map)
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Map));
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(Path.Combine(Logger.LogsDirectory, "mapdump.map")))
|
||||
{
|
||||
serializer.Serialize(writer, map);
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Assets.Scripts.Model.Config
|
||||
{
|
||||
[XmlRoot("terrgenConfig")]
|
||||
public class TerrainGeneratorConfig
|
||||
{
|
||||
[XmlElement("noiseOctaves")]
|
||||
public int NoiseOctaves { get; set; }
|
||||
|
||||
[XmlElement("noiseNonLinearPower")]
|
||||
public float NoiseNonLinearPower { get; set; }
|
||||
|
||||
[XmlElement("elevationScale")]
|
||||
public float ElevationScale { get; set; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Assets.Scripts.Model.Config
|
||||
{
|
||||
[XmlRoot("terrgenConfig")]
|
||||
public class TerrainGeneratorConfig
|
||||
{
|
||||
[XmlElement("noiseOctaves")]
|
||||
public int NoiseOctaves { get; set; }
|
||||
|
||||
[XmlElement("noiseNonLinearPower")]
|
||||
public float NoiseNonLinearPower { get; set; }
|
||||
|
||||
[XmlElement("elevationScale")]
|
||||
public float ElevationScale { get; set; }
|
||||
|
||||
[XmlElement("waterNonLinearPower")]
|
||||
public float WaterNonLinearPower { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TransportGame.Model
|
||||
{
|
||||
public class Map
|
||||
{
|
||||
private float[,] grid;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the water level
|
||||
/// </summary>
|
||||
public float WaterLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the biome
|
||||
/// </summary>
|
||||
public Biome Biome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the heights array
|
||||
/// </summary>
|
||||
public float[,] Heights
|
||||
{
|
||||
get
|
||||
{
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the map
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public Map(int width, int height)
|
||||
{
|
||||
grid = new float[width, height];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cell at specified position
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
/// <returns>Cell</returns>
|
||||
public float this[int x, int y]
|
||||
{
|
||||
get
|
||||
{
|
||||
return grid[x, y];
|
||||
}
|
||||
set
|
||||
{
|
||||
grid[x, y] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets width of map
|
||||
/// </summary>
|
||||
public int Width { get { return grid.GetLength(0); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets height of map
|
||||
/// </summary>
|
||||
public int Height { get { return grid.GetLength(1); } }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if specified cell is a water cell
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
/// <returns></returns>
|
||||
public bool IsWater(int x, int y)
|
||||
{
|
||||
return grid[x, y] <= WaterLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace TransportGame.Model
|
||||
{
|
||||
[XmlRoot("map")]
|
||||
public class Map
|
||||
{
|
||||
private float[,] grid;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the water level
|
||||
/// </summary>
|
||||
[XmlElement("waterLevel")]
|
||||
public float WaterLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the biome
|
||||
/// </summary>
|
||||
[XmlElement("biome")]
|
||||
public Biome Biome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the heights array
|
||||
/// </summary>
|
||||
[XmlIgnore()]
|
||||
public float[,] Heights
|
||||
{
|
||||
get
|
||||
{
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the heights as raw bytes
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Bytes are stored as such:
|
||||
///
|
||||
/// Offset Size Content
|
||||
/// ------------------------
|
||||
/// 0 4 Width
|
||||
/// 4 8 Height
|
||||
/// 8 var 32bit floating point values
|
||||
///
|
||||
/// </remarks>
|
||||
[XmlElement("heights")]
|
||||
public byte[] HeightsRaw
|
||||
{
|
||||
get
|
||||
{
|
||||
List<byte> bytes = new List<byte>();
|
||||
|
||||
bytes.AddRange(BitConverter.GetBytes(Width));
|
||||
bytes.AddRange(BitConverter.GetBytes(Height));
|
||||
|
||||
for (int x = 0; x < Width; x++)
|
||||
for (int y = 0; y < Height; y++)
|
||||
bytes.AddRange(BitConverter.GetBytes(grid[x, y]));
|
||||
|
||||
return bytes.ToArray();
|
||||
}
|
||||
set
|
||||
{
|
||||
int pos = 0;
|
||||
int w = BitConverter.ToInt32(value, pos); pos += sizeof(int);
|
||||
int h = BitConverter.ToInt32(value, pos); pos += sizeof(int);
|
||||
|
||||
grid = new float[w, h];
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
for (int y = 0; y < h; y++)
|
||||
{
|
||||
grid[x, y] = BitConverter.ToSingle(value, pos);
|
||||
pos += sizeof(float);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the map
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Warning: heights array will be null.
|
||||
/// </remarks>
|
||||
public Map()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the map
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public Map(int width, int height)
|
||||
{
|
||||
grid = new float[width, height];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cell at specified position
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
/// <returns>Cell</returns>
|
||||
[XmlIgnore]
|
||||
public float this[int x, int y]
|
||||
{
|
||||
get
|
||||
{
|
||||
return grid[x, y];
|
||||
}
|
||||
set
|
||||
{
|
||||
grid[x, y] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets width of map
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int Width { get { return grid.GetLength(0); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets height of map
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public int Height { get { return grid.GetLength(1); } }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if specified cell is a water cell
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
/// <returns></returns>
|
||||
public bool IsWater(int x, int y)
|
||||
{
|
||||
return grid[x, y] <= WaterLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,85 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TransportGame.Utils
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
private static string logFile = null;
|
||||
|
||||
public enum Level
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Critical
|
||||
}
|
||||
|
||||
public static void Log(Level level, string format, params object[] args)
|
||||
{
|
||||
// Open log file if not opened
|
||||
if (logFile == null)
|
||||
{
|
||||
// Create logs folder
|
||||
if (!Directory.Exists("Logs"))
|
||||
Directory.CreateDirectory("Logs");
|
||||
|
||||
// Create log file
|
||||
logFile = String.Format("Logs\\{0}.log", DateTime.Now.Ticks);
|
||||
}
|
||||
|
||||
lock (logFile)
|
||||
{
|
||||
using (var writer = new StreamWriter(logFile, true))
|
||||
{
|
||||
// Log to file
|
||||
writer.Write("[{0}] ", Enum.GetName(typeof(Level), level));
|
||||
writer.Write(DateTime.Now.ToString("%HH:%mm:%ss.%FFF"));
|
||||
writer.WriteLine(": " + format, args);
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
// Log to unity
|
||||
switch (level)
|
||||
{
|
||||
case Level.Warning:
|
||||
UnityEngine.Debug.LogWarning(String.Format(format, args));
|
||||
break;
|
||||
|
||||
case Level.Error:
|
||||
UnityEngine.Debug.LogError(String.Format(format, args));
|
||||
break;
|
||||
|
||||
case Level.Critical:
|
||||
UnityEngine.Debug.LogError(String.Format(format, args));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Info(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Info, format, args);
|
||||
}
|
||||
|
||||
public static void Warning(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Warning, format, args);
|
||||
}
|
||||
public static void Error(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Error, format, args);
|
||||
}
|
||||
public static void Critical(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Critical, format, args);
|
||||
}
|
||||
public static void Exception(Exception ex)
|
||||
{
|
||||
Log(Level.Critical, "{0}: {1}\nStack trace:{2}", ex.GetType().ToString(), ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TransportGame.Business;
|
||||
|
||||
namespace TransportGame.Utils
|
||||
{
|
||||
public static class Logger
|
||||
{
|
||||
public static readonly string LogsDirectory = "Logs";
|
||||
|
||||
private static string logFile = null;
|
||||
|
||||
public enum Level
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Critical
|
||||
}
|
||||
|
||||
public static void Log(Level level, string format, params object[] args)
|
||||
{
|
||||
// Open log file if not opened
|
||||
if (logFile == null)
|
||||
{
|
||||
// Create logs folder
|
||||
if (!Directory.Exists(LogsDirectory))
|
||||
Directory.CreateDirectory(LogsDirectory);
|
||||
|
||||
// Create log file
|
||||
logFile = Path.Combine(LogsDirectory, String.Format("{0:s}.log", DateTime.Now).Replace(':', '_'));
|
||||
}
|
||||
|
||||
lock (logFile)
|
||||
{
|
||||
using (var writer = new StreamWriter(logFile, true))
|
||||
{
|
||||
// Log to file
|
||||
writer.Write("[{0}] ", Enum.GetName(typeof(Level), level));
|
||||
writer.Write(DateTime.Now.ToString("%HH:%mm:%ss.%FFF"));
|
||||
writer.WriteLine(": " + format, args);
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
// Log to unity
|
||||
switch (level)
|
||||
{
|
||||
case Level.Warning:
|
||||
UnityEngine.Debug.LogWarning(String.Format(format, args));
|
||||
break;
|
||||
|
||||
case Level.Error:
|
||||
UnityEngine.Debug.LogError(String.Format(format, args));
|
||||
break;
|
||||
|
||||
case Level.Critical:
|
||||
UnityEngine.Debug.LogError(String.Format(format, args));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Info(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Info, format, args);
|
||||
}
|
||||
|
||||
public static void Warning(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Warning, format, args);
|
||||
}
|
||||
public static void Error(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Error, format, args);
|
||||
}
|
||||
public static void Critical(string format, params object[] args)
|
||||
{
|
||||
Log(Level.Critical, format, args);
|
||||
}
|
||||
public static void Exception(Exception ex)
|
||||
{
|
||||
Log(Level.Critical, "{0}: {1}\nStack trace:{2}", ex.GetType().ToString(), ex.Message, ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace TransportGame.Utils
|
||||
{
|
||||
public class Range
|
||||
{
|
||||
[XmlAttribute("min")]
|
||||
public float Minimum { get; set; }
|
||||
|
||||
[XmlAttribute("max")]
|
||||
public float Maximum { get; set; }
|
||||
|
||||
public Range()
|
||||
{
|
||||
Minimum = 0;
|
||||
Maximum = 1;
|
||||
}
|
||||
|
||||
public Range(float min, float max)
|
||||
{
|
||||
Minimum = min;
|
||||
Maximum = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace TransportGame.Utils
|
||||
{
|
||||
public class Range
|
||||
{
|
||||
[XmlAttribute("min")]
|
||||
public float Minimum { get; set; }
|
||||
|
||||
[XmlAttribute("max")]
|
||||
public float Maximum { get; set; }
|
||||
|
||||
public Range()
|
||||
{
|
||||
Minimum = 0;
|
||||
Maximum = 1;
|
||||
}
|
||||
|
||||
public Range(float min, float max)
|
||||
{
|
||||
Minimum = min;
|
||||
Maximum = max;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("[{0}, {1}]", Minimum, Maximum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user