Fixed content generation, cleaned up project, v1.2.0
This commit is contained in:
@@ -11,19 +11,22 @@ public class Tile : MonoBehaviour
|
||||
float borderSouth;
|
||||
float borderWest;
|
||||
System.Random rand = new System.Random();
|
||||
string tilename;
|
||||
string tiletype;
|
||||
GameObject contentGenerator;
|
||||
|
||||
List<GameObject> aliveEnemies = new List<GameObject>();
|
||||
List<GameObject> deadEnemies = new List<GameObject>();
|
||||
|
||||
public void generateTile(Vector3 pos, string name)
|
||||
public void generateTile(Vector3 pos, string type)
|
||||
{
|
||||
tilename = name;
|
||||
if (tiletype == null)
|
||||
{
|
||||
tiletype = type;
|
||||
}
|
||||
contentGenerator = GameObject.Find("ContentGenerator");
|
||||
setPosition(pos);
|
||||
setBorders();
|
||||
generateContent();
|
||||
generateContent();
|
||||
}
|
||||
|
||||
public void setBorders()
|
||||
@@ -36,7 +39,7 @@ public class Tile : MonoBehaviour
|
||||
|
||||
public void generateContent()
|
||||
{
|
||||
if (!tilename.ToLower().Equals("City"))
|
||||
if (!tiletype.ToLower().Equals("City"))
|
||||
{
|
||||
foreach (Vector3 position in getSpawnLocations())
|
||||
{
|
||||
@@ -67,7 +70,7 @@ public class Tile : MonoBehaviour
|
||||
int chance = rand.Next(1, 101);
|
||||
if (chance >= 50)
|
||||
{
|
||||
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tilename);
|
||||
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tiletype);
|
||||
if (content != null)
|
||||
{
|
||||
GameObject obj = Instantiate(content, position, Quaternion.identity);
|
||||
@@ -90,6 +93,11 @@ public class Tile : MonoBehaviour
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setType(string tiletype)
|
||||
{
|
||||
this.tiletype = tiletype;
|
||||
}
|
||||
|
||||
public bool leftTile(float playerX, float playerZ)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
Reference in New Issue
Block a user