This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
public class GameEvent | |
{ | |
} | |
public class Events | |
{ | |
static Events instanceInternal = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void BuildMap(int width, int height) | |
{ | |
for (int y = 0; y < height; ++y) | |
{ | |
for (int x = 0; x < width; ++x) | |
{ | |
// Get a noise value | |
float noiseX = (float)x / width * 6.0f; | |
float noiseY = (float)y / height * 6.0f; | |
float noise = Mathf.PerlinNoise(noiseX, noiseY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void PlaceTile(x, y, height) | |
{ | |
string path; | |
if (height == 0) | |
{ | |
path = "Tiles/WaterTile"; | |
} | |
else if (height == 1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void InitHeights() | |
{ | |
HeightField = new int[Width * Height]; | |
for (int y = 0; y < Height; ++y) | |
{ | |
for (int x = 0; x < Width; ++x) | |
{ | |
// Compute a position in noise space | |
float noiseX = (float)x / Width * NoiseFrequency; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class MapBuilder1 : MapBuilder | |
{ | |
public int FeatureChance = 30; | |
public string[] TileLoadStrings; | |
public string[] FeatureLoadStrings; | |
protected override void InitMapObjects() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Xml; | |
using System.Xml.Serialization; | |
[XmlRoot] | |
public sealed class TileInfo : DatabaseEntry | |
{ | |
[XmlElement] | |
public int Height { get; private set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Database> | |
<!-- Tile Infos --> | |
<TileInfo ID="TILE_WATER"> | |
<Height>0</Height> | |
<FeatureChance>0</FeatureChance> | |
<PrefabPath>Tiles/TileWater</PrefabPath> | |
</TileInfo> | |
<TileInfo ID="TILE_GRASS"> | |
<Height>1</Height> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class MapBuilder2 : MapBuilder | |
{ | |
protected override void InitMapObjects() | |
{ | |
for (int y = 0; y < Height; ++y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get all tiles in the database that match the height | |
TileInfo[] tileInfos = Database.Instance.GetEntries<TileInfo>().Where((info) => info.Height == height).ToArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
using System.Xml; | |
using System.Xml.Serialization; | |
using System.Runtime; | |
using System.Runtime.Serialization; | |
using System.Linq; |
OlderNewer