protected override void OnAssetDataLoaded(IntegratedAuthoringToolAsset asset) { textBoxScenarioName.Text = asset.ScenarioName; textBoxScenarioDescription.Text = asset.ScenarioDescription; _characterSources = new BindingListView <CharacterSourceDTO>(asset.GetAllCharacterSources().ToList()); _wmSource = asset.GetWorldModelSource(); dataGridViewCharacters.DataSource = _characterSources; _dialogs = new BindingListView <DialogueStateActionDTO>(new List <DialogueStateActionDTO>()); dataGridViewDialogueActions.DataSource = _dialogs; if (_wmSource != null) { if (_wmSource.Source != "") { pathTextBoxWorldModel.Text = _wmSource.Source; LoadWorldModelForm(); } } //ResetSimulator richTextBoxChat.Clear(); buttonContinue.Enabled = false; textBoxTick.Text = ""; RefreshDialogs(); }
private IEnumerator LoadScenario(ScenarioData data) { ClearButtons(); _iat = data.IAT; _introPanel.SetActive(true); _introText.text = string.Format("<b>{0}</b>\n\n\n{1}", _iat.ScenarioName, _iat.ScenarioDescription); previousState = ""; var characterSources = _iat.GetAllCharacterSources().ToList(); var addedDialogs = new List <string>(); _wm = WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().Source); foreach (var source in characterSources) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); rpc.LoadAssociatedAssets(); if (rpc.CharacterName.ToString() == "Player") { Player = rpc; _iat.BindToRegistry(Player.DynamicPropertiesRegistry); continue; } _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); AddButton(characterSources.Count <= 2 ? "Start" : rpc.CharacterName.ToString(), () => { Debug.Log("Interacted with the start button"); var body = m_bodies.FirstOrDefault(b => b.BodyName == rpc.BodyName); _agentController = new AgentControler(data, rpc, _iat, body.CharaterArchtype, m_characterAnchor, m_dialogController); StopAllCoroutines(); _agentController.storeFinalScore(_finalScore); _agentController.Start(this, VersionMenu); _agentController.startingTime = this.startingTime; InstantiateScore(); }); } if (m_scenarios.Length > 1) { AddButton("Back to Scenario Selection Menu", () => { _iat = null; LoadScenarioMenu(); }); } yield return(nextframe); }
private void LoadScenario(SingleCharacterDemo.ScenarioData data) { ClearButtons(); _iat = data.IAT; if (skipDescription) { _introPanel.SetActive(true); _introText.text = string.Format("<b>{0}</b>\n\n\n{1}", _iat.ScenarioName, _iat.ScenarioDescription); } if (_iat.m_worldModelSource != null) { if (_iat.m_worldModelSource.Source != "" && _iat.m_worldModelSource.Source != null) { _wm = WorldModel.WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().Source); } } var characterSources = _iat.GetAllCharacterSources().ToList(); int CharacterCount = 0; foreach (var source in characterSources) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); rpc.LoadAssociatedAssets(); _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); rpcList.Add(rpc); var body = m_bodies.FirstOrDefault(b => b.BodyName == rpc.BodyName); UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks); var r = UnityEngine.Random.Range(0, 30); Debug.Log("Going to wait" + r); StartCoroutine(JustWait(UnityEngine.Random.Range(0, 3))); _agentController = new MultiCharacterAgentController(data, rpc, _iat, body.CharaterArchtype, m_characterAnchors[CharacterCount], m_dialogController); // StopAllCoroutines(); _agentControllers.Add(_agentController); if (rpc.CharacterName == _player.CharacterName) { _player = rpc; } CharacterCount++; } foreach (var agent in _agentControllers) { if (agent.RPC.CharacterName != _player.CharacterName) { agent.StartBehaviour(this, VersionMenu); } } foreach (var actor in rpcList) { foreach (var anotherActor in rpcList) { if (actor != anotherActor) { var changed = new[] { EventHelper.ActionEnd(anotherActor.CharacterName.ToString(), "Enters", "Room") }; actor.Perceive(changed); } } } SetCamera(); PlayerDecide(); }
private void LoadScenario(ScenarioData data) { ClearButtons(); _iat = data.IAT; _introPanel.SetActive(true); _introText.text = string.Format("<b>{0}</b>\n\n\n{1}", _iat.ScenarioName, _iat.ScenarioDescription); if (_iat.m_worldModelSource != null) { if (!string.IsNullOrEmpty(_iat.m_worldModelSource.Source)) { var wat = _iat.GetWorldModelSource(); string errorsOnLoad; // _wm = WorldModel.WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().RelativePath); _wm = WorldModel.WorldModelAsset.LoadFromFile(_iat.GetWorldModelSource().Source, out errorsOnLoad); if (errorsOnLoad != null) { throw new Exception(errorsOnLoad); } } } var characterSources = _iat.GetAllCharacterSources().ToList(); foreach (var source in characterSources) { var rpc = RolePlayCharacterAsset.LoadFromFile(source.Source); rpc.LoadAssociatedAssets(); _iat.BindToRegistry(rpc.DynamicPropertiesRegistry); if (rpc.CharacterName.ToString().Contains("Player")) { Player = rpc; continue; } AddButton(characterSources.Count <= 2 ? "Start" : rpc.CharacterName.ToString(), () => { var body = m_bodies.FirstOrDefault(b => b.BodyName == rpc.BodyName); _agentController = new AgentControler(data, rpc, _iat, body.CharaterArchtype, m_characterAnchor, m_dialogController); StopAllCoroutines(); _agentController.Start(this, VersionMenu); _background.SetActive(true); if (!backgrounds.IsEmpty()) { if (!backgrounds.ToList().FindAll(x => x.scenarioName == _iat.ScenarioName).IsEmpty()) { _background.GetComponent <Renderer>().material = backgrounds.ToList().Find(x => x.scenarioName == _iat.ScenarioName).mat; } else { _background.GetComponent <Renderer>().material = activeBackgroundMaterial; } } else { _background.GetComponent <Renderer>().material = activeBackgroundMaterial; } }); } AddButton("Back to Scenario Selection Menu", () => { _iat = null; LoadScenarioMenu(); }); }