InitializeAcademy() { base.InitializeAcademy(); tag = "GlobalManager"; // Debug.Log(GetLogTag() + " Initialize"); InitGameObjectToBeRespawned(); InitLightReinitializors(); foreach (TagPair TagPair_ in IgnoreCollisionTagPairs) { Utils.IgnoreCollision(TagPair_.TagA, TagPair_.TagB); } // InitRamObservation(); // if (isTurnBasedGame()) { // InitTurnBasedGame(); // } // initialize reference to UIPercentageBars foreach (UIPercentageBar UIPercentageBar_ in GameObject.FindGameObjectWithTag("TopDownCamera"). GetComponentsInChildren <UIPercentageBar>()) { UIPercentageBars.Add(UIPercentageBar_.ID, UIPercentageBar_); } UIPercentageBars["EL"].Enable(); // initialize reference to UIText foreach (UIText UIText_ in GameObject.FindGameObjectWithTag("TopDownCamera"). GetComponentsInChildren <UIText>()) { UITexts.Add(UIText_.ID, UIText_); } UITexts["Status"].setText("Top Down Camera"); // initialize reference to Camera foreach (Camera Camera_ in GetComponentsInChildren <Camera>()) { string ID_; int InitialCameraDepth = 0; if (Camera_.CompareTag("TopDownCamera")) { ID_ = "TopDownCamera"; InitialCameraDepth = UpperCameraDepth; if (AgentCameraDisplayMode == AgentCameraDisplayModes.All) { Debug.LogWarning( "AgentCameraDisplayMode = AgentCameraDisplayModes.All is not recommended, as it results in camera feild that is too small and UI will be resized."); Camera_.rect = new Rect(0.5f, 0f, 0.5f, 1f); } else if (AgentCameraDisplayMode == AgentCameraDisplayModes.Single) { Camera_.rect = new Rect(0f, 0f, 1f, 1f); } else { Debug.LogError("Invalid AgentCameraDisplayMode"); } } else if (Camera_.CompareTag("AgentCamera")) { ID_ = Camera_.GetComponentInParent <ArenaAgent>().GetLogTag(); InitialCameraDepth = DownerCameraDepth; } else { Debug.LogError( "A camera in Arena should be either TopDownCamera or AgentCamera, use corresponding prefab provided in ArenaSDK/SharedPrefabs"); ID_ = "None"; } Cameras.Add(Camera_); Cameras[Cameras.Count - 1].depth = InitialCameraDepth; } if (!isDebugging()) { foreach (GameObject each_gameobject in GameObject.FindGameObjectsWithTag("Debug")) { each_gameobject.SetActive(false); } } } // InitializeAcademy
InitializeAcademy() { tag = "GlobalManager"; // Debug.Log(GetLogTag() + " Initialize"); broadcastHub.Clear(); broadcastHub.broadcastingBrains.Add(SharedBrain); if (!Application.isEditor) { broadcastHub.SetControlled(SharedBrain, true); } foreach (ArenaAgent ArenaAgent_ in GetComponentsInChildren <ArenaAgent>()) { ArenaAgent_.brain = SharedBrain; } base.InitializeAcademy(); InitGameObjectToBeRespawned(); InitLightReinitializors(); foreach (TagPair TagPair_ in IgnoreCollisionTagPairs) { Utils.IgnoreCollision(TagPair_.TagA, TagPair_.TagB); } // InitRamObservation(); // if (isTurnBasedGame()) { // InitTurnBasedGame(); // } // initialize reference of TopDownCamera if (GameObject.FindGameObjectWithTag("TopDownCamera") == null) { Debug.LogError("Add prefab ArenaSDK/SharedPrefabs/TopDownCamera in your game sence"); } // initialize reference to UIPercentageBarsTopDownCamera foreach (UIPercentageBar UIPercentageBar_ in GameObject.FindGameObjectWithTag("TopDownCamera"). GetComponentsInChildren <UIPercentageBar>()) { UIPercentageBarsTopDownCamera.Add(UIPercentageBar_.ID, UIPercentageBar_); } UIPercentageBarsTopDownCamera["Episode Length"].Enable(); // initialize reference to UITextsTopDownCamera foreach (UIText UIText_ in GameObject.FindGameObjectWithTag("TopDownCamera"). GetComponentsInChildren <UIText>()) { UITextsTopDownCamera.Add(UIText_.ID, UIText_); } UITextsTopDownCamera["Status"].setText("Top Down Camera"); // initialize reference to VisualizationCamera if (GameObject.FindGameObjectWithTag("VisualizationCamera") == null) { Debug.LogError("Add prefab ArenaSDK/SharedPrefabs/VisualizationCamera in your game sence"); } // initialize reference to UIPercentageBarsVisualizationCamera foreach (UIPercentageBar UIPercentageBar_ in GameObject.FindGameObjectWithTag("VisualizationCamera"). GetComponentsInChildren <UIPercentageBar>()) { UIPercentageBarsVisualizationCamera.Add(UIPercentageBar_.ID, UIPercentageBar_); } UIPercentageBarsVisualizationCamera["Episode Length"].Enable(); // initialize reference to UITextsVisualizationCamera foreach (UIText UIText_ in GameObject.FindGameObjectWithTag("VisualizationCamera"). GetComponentsInChildren <UIText>()) { UITextsVisualizationCamera.Add(UIText_.ID, UIText_); } UITextsVisualizationCamera["Status"].setText("Visualization Camera"); // initialize reference to Camera foreach (Camera Camera_ in GetComponentsInChildren <Camera>()) { string ID_; int InitialCameraDepth = 0; if (Camera_.CompareTag("TopDownCamera")) { ID_ = "TopDownCamera"; InitialCameraDepth = UpperCameraDepth; Camera_.rect = new Rect(0f, 0f, 1f, 1f); } else if (Camera_.CompareTag("VisualizationCamera")) { ID_ = "VisualizationCamera"; InitialCameraDepth = DownerCameraDepth; Camera_.rect = new Rect(0f, 0f, 1f, 1f); } else if (Camera_.CompareTag("AgentCamera")) { ID_ = Camera_.GetComponentInParent <ArenaAgent>().GetLogTag(); InitialCameraDepth = DownerCameraDepth; } else { Debug.LogError( "A camera in Arena should be either TopDownCamera or VisualizationCamera or AgentCamera, use corresponding prefab provided in ArenaSDK/SharedPrefabs"); ID_ = "None"; } Cameras.Add(Camera_); Cameras[Cameras.Count - 1].depth = InitialCameraDepth; } if (!isDebugging()) { foreach (GameObject each_gameobject in GameObject.FindGameObjectsWithTag("Debug")) { each_gameobject.SetActive(false); } } InitializeVisVecObs(); } // InitializeAcademy