Browse Source

Commented out Debugs from map Generator because it slowed the start by 20seconds

Josh_Dev_branch
Joshua Reason 5 years ago
parent
commit
a099ad2a84
1 changed files with 23 additions and 23 deletions
  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) foreach (MapSection section in sections)
{ {
Debug.Log("Possible section: " + section.name);
//Debug.Log("Possible section: " + section.name);
} }
initialPlayerCount = clients.ConnectedClients.Count; initialPlayerCount = clients.ConnectedClients.Count;
@ -181,14 +181,14 @@ public class MapManager : ScriptableObject
foreach (MapSection section in validSections) 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)]; 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); addSection(nextSection);
} }
@ -220,29 +220,29 @@ public class MapManager : ScriptableObject
{ {
int connections = 0; 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.difficulty < diffMin || second.difficulty > diffMax)
if (second.difficultyMax < difficulty || second.difficultyMin > difficulty) //Check that we're in the right difficulty range for this section 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; return false;
} }
if (second.widthIn < widthMin || second.widthIn > widthMax) //And that it's in the right width range 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; 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 exit in first.exits)
{ {
foreach (GameObject entry in second.entrances) 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)) if (checkConnection(exit, entry))
{ {
connections++; connections++;
@ -250,15 +250,15 @@ public class MapManager : ScriptableObject
} }
} }
//Debug.Log("Connections = " + connections);
////Debug.Log("Connections = " + connections);
if (connections >= minConns) if (connections >= minConns)
{ {
//Debug.Log("Valid section!");
////Debug.Log("Valid section!");
} }
else else
{ {
//Debug.Log("Invalid section!");
////Debug.Log("Invalid section!");
} }
return (connections >= minConns); return (connections >= minConns);
@ -266,12 +266,12 @@ public class MapManager : ScriptableObject
bool checkConnection(GameObject exit, GameObject entry) 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);*/ + ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);*/
//If the squares being checked don't line up, the connection is invalid //If the squares being checked don't line up, the connection is invalid
if (exit.transform.localPosition.z != entry.transform.localPosition.z) 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; 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 //It's technically possible to cross two water blocks, but we don't count that
if (requiresJump(exit) && requiresJump(entry)) if (requiresJump(exit) && requiresJump(entry))
{ {
//Debug.Log("Invalid connection - both water");
////Debug.Log("Invalid connection - both water");
return false; 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 //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)) if (isWall(exit) || isWall(entry))
{ {
//Debug.Log("Invalid connection - not walkable");
////Debug.Log("Invalid connection - not walkable");
return false; 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! //If we've passed all these tests, the connection is valid!
return true; return true;
@ -389,7 +389,7 @@ public class MapManager : ScriptableObject
{ {
if (clients.ConnectedClients.Count <= (float)(0.5f * initialPlayerCount)) 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++; /*diffMin++;
diffMax++;*/ diffMax++;*/
difficulty++; difficulty++;
@ -400,7 +400,7 @@ public class MapManager : ScriptableObject
if (clients.ConnectedClients.Count <= (float)(0.33f * initialPlayerCount)) 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++; /*diffMin++;
diffMax += 2;*/ diffMax += 2;*/
difficulty += 2; difficulty += 2;

Loading…
Cancel
Save