Compare commits

...

1 Commits

1 changed files with 23 additions and 23 deletions
Split View
  1. +23
    -23
      Assets/Scripts/Map Generation/MapManager.cs

+ 23
- 23
Assets/Scripts/Map Generation/MapManager.cs View File

@ -54,11 +54,11 @@ public class MapManager : ScriptableObject
}
}
Debug.Log("sections.Count = " + sections.Count);
//Debug.Log("sections.Count = " + sections.Count);
foreach (MapSection section in sections)
{
Debug.Log("Possible section: " + section.name);
//Debug.Log("Possible section: " + section.name);
}
initialPlayerCount = clients.ConnectedClients.Count;
@ -181,14 +181,14 @@ public class MapManager : ScriptableObject
foreach (MapSection section in validSections)
{
Debug.Log("Valid section: " + section.name);
//Debug.Log("Valid section: " + section.name);
}/**/
Debug.Log("Choosing section");
//Debug.Log("Choosing section");
MapSection nextSection = validSections[(int)Random.Range(0.0f, (float)validSections.Count)];
Debug.Log("Chosen section: " + nextSection.name);
//Debug.Log("Chosen section: " + nextSection.name);
addSection(nextSection);
}
@ -220,29 +220,29 @@ public class MapManager : ScriptableObject
{
int connections = 0;
Debug.Log("Checking " + first.name + ", " + second.name);
//Debug.Log("Checking " + first.name + ", " + second.name);
//if (second.difficulty < diffMin || second.difficulty > diffMax)
if (second.difficultyMax < difficulty || second.difficultyMin > difficulty) //Check that we're in the right difficulty range for this section
{
Debug.Log("Difficulty = " + difficulty + ", max = " + second.difficultyMax + ", min = " + second.difficultyMin);
//Debug.Log("Difficulty = " + difficulty + ", max = " + second.difficultyMax + ", min = " + second.difficultyMin);
return false;
}
if (second.widthIn < widthMin || second.widthIn > widthMax) //And that it's in the right width range
{
Debug.Log("width = " + second.widthIn + ", max = " + widthMin + ", min = " + widthMax);
//Debug.Log("width = " + second.widthIn + ", max = " + widthMin + ", min = " + widthMax);
return false;
}
//Debug.Log("Checking sections: first = " + first.name + ", second = " + second.name);
////Debug.Log("Checking sections: first = " + first.name + ", second = " + second.name);
foreach (GameObject exit in first.exits)
{
foreach (GameObject entry in second.entrances)
{
Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);/**/
//Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
//+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);/**/
if (checkConnection(exit, entry))
{
connections++;
@ -250,15 +250,15 @@ public class MapManager : ScriptableObject
}
}
//Debug.Log("Connections = " + connections);
////Debug.Log("Connections = " + connections);
if (connections >= minConns)
{
//Debug.Log("Valid section!");
////Debug.Log("Valid section!");
}
else
{
//Debug.Log("Invalid section!");
////Debug.Log("Invalid section!");
}
return (connections >= minConns);
@ -266,12 +266,12 @@ public class MapManager : ScriptableObject
bool checkConnection(GameObject exit, GameObject entry)
{
/*Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
/*//Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);*/
//If the squares being checked don't line up, the connection is invalid
if (exit.transform.localPosition.z != entry.transform.localPosition.z)
{
//Debug.Log(exit.transform.localPosition.z + " != " + entry.transform.localPosition.z);
////Debug.Log(exit.transform.localPosition.z + " != " + entry.transform.localPosition.z);
return false;
}
@ -279,22 +279,22 @@ public class MapManager : ScriptableObject
//It's technically possible to cross two water blocks, but we don't count that
if (requiresJump(exit) && requiresJump(entry))
{
//Debug.Log("Invalid connection - both water");
////Debug.Log("Invalid connection - both water");
return false;
}
//Debug.Log("Exit.is_Walkable = " + exit.GetComponent<Block>().is_Walkable + ", Entry.is_Walkable = " + entry.GetComponent<Block>().is_Walkable);
////Debug.Log("Exit.is_Walkable = " + exit.GetComponent<Block>().is_Walkable + ", Entry.is_Walkable = " + entry.GetComponent<Block>().is_Walkable);
//Since we currently don't let people jump over walls, if either block is a wall, the connection is invalid
if (isWall(exit) || isWall(entry))
{
//Debug.Log("Invalid connection - not walkable");
////Debug.Log("Invalid connection - not walkable");
return false;
}
//Debug.Log("Exit.isWater = " + exit.GetComponent<Block>().isWater + ", Entry.isWater = " + entry.GetComponent<Block>().isWater);
////Debug.Log("Exit.isWater = " + exit.GetComponent<Block>().isWater + ", Entry.isWater = " + entry.GetComponent<Block>().isWater);
//Debug.Log("Valid connection!");
////Debug.Log("Valid connection!");
//If we've passed all these tests, the connection is valid!
return true;
@ -389,7 +389,7 @@ public class MapManager : ScriptableObject
{
if (clients.ConnectedClients.Count <= (float)(0.5f * initialPlayerCount))
{
Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count at half or below");
//Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count at half or below");
/*diffMin++;
diffMax++;*/
difficulty++;
@ -400,7 +400,7 @@ public class MapManager : ScriptableObject
if (clients.ConnectedClients.Count <= (float)(0.33f * initialPlayerCount))
{
Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count below 33%");
//Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count below 33%");
/*diffMin++;
diffMax += 2;*/
difficulty += 2;

Loading…
Cancel
Save