public override void OnInspectorGUI() { TriggerController controller = target as TriggerController; DrawDefaultInspector(); if (GUILayout.Button("Update Triggers")) { UpdateTriggers(controller); } GUILayout.Space(20); GUILayout.Label("Current chapter: " + controller.currentChapter.value); chapter = EditorGUILayout.TextField("Current Chapter", chapter); Constants.SCENE_INDEXES cArea = (Constants.SCENE_INDEXES)controller.currentScene.value; cArea = (Constants.SCENE_INDEXES)EditorGUILayout.EnumPopup("Current Area", (Constants.SCENE_INDEXES)cArea); controller.currentScene.value = (int)cArea; Constants.RoomNumber cRoom = (Constants.RoomNumber)controller.currentRoomNumber.value; cRoom = (Constants.RoomNumber)EditorGUILayout.EnumPopup("Room Number", (Constants.RoomNumber)cRoom); controller.currentRoomNumber.value = (int)cRoom; GUILayout.Space(20); if (GUILayout.Button("Reactivate", GUILayout.Height(50))) { controller.currentChapter.value = chapter; ReactivateTriggers(controller); } }
/// <summary> /// Goes through all sections and activates the current section. /// </summary> public void ReactivateTriggers() { Constants.OverworldArea index = (Constants.OverworldArea)currentScene.value; Constants.RoomNumber roomNumber = (Constants.RoomNumber)currentRoomNumber.value; for (int i = 0; i < sectionList.Length; i++) { sectionList[i].ActivateSection(currentChapter.value, index, roomNumber); } }
public CameraValues GetValues(Constants.OverworldArea area, Constants.RoomNumber number) { for (int i = 0; i < values.Length; i++) { if (values[i].area == area && values[i].roomNumber == number) { return(values[i]); } } return(null); }
/// <summary> /// Activates the chapter with the given id and deactivates the rest. /// </summary> /// <param name="chapterID"></param> public void ActivateSection(string chapterID, Constants.OverworldArea sceneIndex, Constants.RoomNumber number) { if (containers.Count == 0) { Debug.LogWarning("Empty area"); return; } bool state = (sceneIndex == activeArea && roomNumber == number); containers[0].gameObject.SetActive(state); for (int i = 1; i < containers.Count; i++) { containers[i].gameObject.SetActive(state && chapterID == chapterIDs[i]); } }