Initial commit

This commit is contained in:
2015-03-03 18:47:18 +02:00
commit c51c5abbb1
486 changed files with 45970 additions and 0 deletions

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using TransportGame.Utils;
namespace TransportGame.Model
{
[XmlRoot("biome")]
public class Biome
{
/// <summary>
/// Gets or sets the name of the biome
/// </summary>
[XmlElement("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the height range of the biome.
/// </summary>
/// <remarks>
/// 1 unit = 100 meters.
/// </remarks>
[XmlElement("heightRange")]
public Range HeightRange { get; set; }
/// <summary>
/// Gets or sets the moisture range.
/// </summary>
/// <remarks>
/// Moisture is the amount of water on a map.
/// Value is a probability, should be between 0 and 1.
/// </remarks>
[XmlElement("moisture")]
public Range Moisture { get; set; }
/// <summary>
/// Gets or sets the vegetation density of the biome
/// </summary>
[XmlElement("vegetationDensity")]
public Range VegetationDensity { get; set; }
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 15c4c7a1393cf2b4e9520d38705830a3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 976fce089fd84a043888fb58c4c5580a
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,19 @@
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
{
public int NoiseOctaves { get; set; }
public float NoiseNonLinearPower { get; set; }
public float ElevationScale { get; set; }
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8a3817f3a7058cc41b46eb849acf069b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,72 @@
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>
/// 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;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fc6d250254fab4447aa1b764a56d3373
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: