|
|
|
|
|
|
/// </summary>
|
|
|
|
void InitializeEnvironment() |
|
|
|
{ |
|
|
|
// Initialize communicator (if possible)
|
|
|
|
// Retrieve Brain and initialize Academy
|
|
|
|
List<Brain> brains = GetBrains(gameObject); |
|
|
|
InitializeAcademy(); |
|
|
|
|
|
|
|
// Check for existence of communicator
|
|
|
|
if (communicator.CommunicatorHandShake()) |
|
|
|
{ |
|
|
|
isCommunicatorOn = true; |
|
|
|
communicator.InitializeCommunicator(); |
|
|
|
communicator.UpdateCommand(); |
|
|
|
} |
|
|
|
else |
|
|
|
if (!communicator.CommunicatorHandShake()) |
|
|
|
// Initialize Academy and Brains.
|
|
|
|
InitializeAcademy(); |
|
|
|
List<Brain> brains = GetBrains(gameObject); |
|
|
|
// Initialize Brains and communicator (if present)
|
|
|
|
} |
|
|
|
if (communicator != null) |
|
|
|
{ |
|
|
|
isCommunicatorOn = true; |
|
|
|
communicator.InitializeCommunicator(); |
|
|
|
communicator.UpdateCommand(); |
|
|
|
} |
|
|
|
|
|
|
|
// If a communicator is enabled/provided, then we assume we are in
|
|
|
|
|
|
|
if (communicator.GetCommand() == ExternalCommand.QUIT) |
|
|
|
{ |
|
|
|
Application.Quit(); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (!firstAcademyReset) |
|
|
|