public void StopAllNPCAction() { foreach (GameObject NPCObject in EntityManager.getObjectsOfType <NPCComponent>()) { NPCComponent[] npcComps = NPCObject.GetComponents <NPCComponent> (); foreach (NPCComponent npcComp in npcComps) { npcComp.stop(); } } }
public static void closeSession() { delta = 0f; inSession = false; sessionCloseTime = Time.timeSinceLevelLoad; Debug.Log("Session end time: " + sessionCloseTime); foreach (GameObject NPCObject in EntityManager.getObjectsOfType <NPCComponent>()) { NPCComponent[] npcComps = NPCObject.GetComponents <NPCComponent> (); foreach (NPCComponent npcComp in npcComps) { npcComp.setTimeProbability(90f); npcComp.stop(); } } }
// FixedUpdate is called once per frame protected virtual void FixedUpdate() { EntityManager.Start(); if (EventManager.inSession) { foreach (GameObject NPCObject in EntityManager.getObjectsOfType <NPCComponent>()) { NPCComponent[] npcComps = NPCObject.GetComponents <NPCComponent> (); foreach (NPCComponent npcComp in npcComps) { StartCoroutine(npcComp.NPCAction()); } } } else { GetComponent <EventManager> ().RepeatEvents(); } }
public void ControllerUISetup() { foreach (GameObject NPCObject in EntityManager.getObjectsOfType <NPCComponent>()) { GameObject _newList = Instantiate(npcComponentListPrefab); _newList.transform.position = Vector3.zero; _newList.transform.rotation = Quaternion.identity; _newList.transform.SetParent(compListParent); NPCComponent[] npcComps = NPCObject.GetComponents <NPCComponent> (); compListItemParent = _newList.transform.GetChild(0).GetChild(0).gameObject; GameObject _nameObj = Instantiate(npcGameObjectName); _nameObj.GetComponent <Text> ().text = NPCObject.name; _nameObj.transform.SetParent(compListItemParent.transform); foreach (NPCComponent npcComp in npcComps) { GameObject _newListItem = Instantiate(componentListItemPrefab); _newListItem.transform.SetParent(compListItemParent.transform); _newListItem.GetComponent <ComponentListItem> ().Setup(npcComp); } } }