/// MonoBehaviour function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { m_Id = gameObject.GetInstanceID(); OnEnableHelper(); m_Recorder = GetComponent <DemonstrationRecorder>(); }
/// Helper method for the <see cref="OnEnable"/> event, created to /// facilitate testing. public void LazyInitialize() { if (m_Initialized) { return; } m_Initialized = true; // Grab the "static" properties for the Agent. m_EpisodeId = EpisodeIdCounter.GetEpisodeId(); m_PolicyFactory = GetComponent <BehaviorParameters>(); m_Recorder = GetComponent <DemonstrationRecorder>(); m_Info = new AgentInfo(); m_Action = new AgentAction(); sensors = new List <ISensor>(); Academy.Instance.AgentSendState += SendInfo; Academy.Instance.DecideAction += DecideAction; Academy.Instance.AgentAct += AgentStep; Academy.Instance.AgentForceReset += _AgentReset; m_Brain = m_PolicyFactory.GeneratePolicy(Heuristic); ResetData(); InitializeAgent(); InitializeSensors(); }
/// MonoBehaviour function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { m_EpisodeId = EpisodeIdCounter.GetEpisodeId(); OnEnableHelper(); m_Recorder = GetComponent <DemonstrationRecorder>(); }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. public virtual void OnEnable() { m_Id = gameObject.GetInstanceID(); OnEnableHelper(Academy.Instance); m_Recorder = GetComponent <DemonstrationRecorder>(); }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { textureArray = new Texture2D[agentParameters.agentCameras.Count]; for (int i = 0; i < agentParameters.agentCameras.Count; i++) { textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false); } blackTextures = new Texture2D[agentParameters.agentCameras.Count]; for (int i = 0; i < agentParameters.agentCameras.Count; i++) { blackTextures[i] = new Texture2D(brain.brainParameters.cameraResolutions[i].width, brain.brainParameters.cameraResolutions[i].height, TextureFormat.RGB24, false); Color[] blackArray = blackTextures[i].GetPixels(); int nBlackArray = blackArray.Length; for (int j = 0; j < nBlackArray; j++) { blackArray[j] = Color.black; } blackTextures[i].SetPixels(blackArray); blackTextures[i].Apply(); } id = gameObject.GetInstanceID(); Academy academy = Object.FindObjectOfType <Academy>() as Academy; OnEnableHelper(academy); recorder = GetComponent <DemonstrationRecorder>(); }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { id = gameObject.GetInstanceID(); Academy academy = Object.FindObjectOfType <Academy>() as Academy; OnEnableHelper(academy); recorder = GetComponent <DemonstrationRecorder>(); }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { m_Id = gameObject.GetInstanceID(); var academy = FindObjectOfType <Academy>(); OnEnableHelper(academy); m_Recorder = GetComponent <DemonstrationRecorder>(); }
/// Monobehavior function that is called when the attached GameObject /// becomes enabled or active. void OnEnable() { textureArray = new Texture2D[agentParameters.agentCameras.Count]; for (int i = 0; i < agentParameters.agentCameras.Count; i++) { textureArray[i] = new Texture2D(1, 1, TextureFormat.RGB24, false); } id = gameObject.GetInstanceID(); Academy academy = Object.FindObjectOfType <Academy>() as Academy; OnEnableHelper(academy); recorder = GetComponent <DemonstrationRecorder>(); }
/// Used by the brain to make the agent perform a step. void AgentStep() { if (!recorder) { if (GetComponent <DemonstrationRecorder>()) { recorder = GetComponent <DemonstrationRecorder>(); } } if (terminate) { terminate = false; ResetReward(); done = false; maxStepReached = false; requestDecision = false; requestAction = false; hasAlreadyReset = false; OnDisable(); AgentOnDone(); } if ((requestAction) && (brain != null)) { requestAction = false; AgentAction(action.vectorActions, action.textActions, action.customAction); } if ((stepCount >= agentParameters.maxStep) && (agentParameters.maxStep > 0)) { maxStepReached = true; Done(); } stepCount += 1; }