private void Start() { //TODO: This shouldn't be neccesary once I've got the cartridge loader scene up and running //Will check that all data exists before even entering the game scene //Load all Data, Make sure none are missing if (!WorldDatabase.LoadWorldData()) { Debug.LogWarning("World Data is Missing!"); } else if (!LevelDatabase.LoadLevelData()) { Debug.LogWarning("Level Data is Missing!"); } else if (!RoomDatabase.LoadRoomData()) { Debug.LogWarning("Room Data is Missing!"); } else if (!InteractableDatabase.LoadInteractableData()) { Debug.LogWarning("Interaction Data is Missing!"); } else if (!ObstacleDatabase.LoadObstacleData()) { Debug.LogWarning("Obstacle Data is Missing!"); } else if (!ItemDatabase.LoadItemData()) { Debug.LogWarning("Item Data is Missing!"); } else { WorldManagerInst.EnterWorld(); UIController.Instance.EnableUI(); } }
public bool SubmitAction(string action, string target) { bool actionExecuted = false; //Check obstacle if (ObstacleController.Instance.ObstaclePresent()) { actionExecuted = ObstacleController.Instance.SubmitObstacleAction(action, target); } if (!actionExecuted) { //Check through interactables for (int i = 0; i < StaticData.InteractableIds.Length; i++) { string interactableId = StaticData.InteractableIds[i]; InteractableData data = InteractableDatabase.GetInteractableData(interactableId); for (int j = 0; j < data.Interactions.Length; j++) { Interaction interaction = data.Interactions[j]; if ((Helpers.LooseCompare(target, interaction.Target) || Helpers.LooseCompare(target, data.Name)) && Helpers.LooseCompare(action, interaction.Action)) { interaction.ExecuteInteractionOutcome(); actionExecuted = true; } } } } return(actionExecuted); }
public bool SubmitExamineAction(string target) { for (int i = 0; i < StaticData.InteractableIds.Length; i++) { string interactableId = StaticData.InteractableIds[i]; InteractableData data = InteractableDatabase.GetInteractableData(interactableId); if (Helpers.LooseCompare(target, data.Name)) { MessageManager.SendStringMessage(data.Description); return(true); } } return(false); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } foreach (InteractableData data in Resources.LoadAll("", typeof(InteractableData))) { if (!_assets.ContainsKey(data.Name)) { _assets.Add(data.Name, data); } } }
/// <summary> /// Entry point for populating screen with information from JSON /// Based on Current Information Set as dictated by dropdown. /// </summary> private void PopulateFromJson() { for (int i = 0; i < InfoContent.childCount; i++) { Destroy(InfoContent.GetChild(i).gameObject); } if (_currentInformationSet == InformationSet.WorldInformation) { _rootObject = WorldDatabase.GetWorldData() ?? Activator.CreateInstance(typeof(WorldData)); } else if (_currentInformationSet == InformationSet.LevelInformation) { _rootObject = LevelDatabase.GetLevelArrayData() ?? Activator.CreateInstance(typeof(LevelArray)); } else if (_currentInformationSet == InformationSet.RoomInformation) { _rootObject = RoomDatabase.GetRoomArayData() ?? Activator.CreateInstance(typeof(RoomArray)); } else if (_currentInformationSet == InformationSet.InteractableInformation) { _rootObject = InteractableDatabase.GetInteractableArray() ?? Activator.CreateInstance(typeof(InteractableArray)); } else if (_currentInformationSet == InformationSet.ObstacleInformation) { _rootObject = ObstacleDatabase.GetObstacleArray() ?? Activator.CreateInstance(typeof(ObstacleArray)); } else if (_currentInformationSet == InformationSet.ItemInformation) { _rootObject = ItemDatabase.GetItemArray() ?? Activator.CreateInstance(typeof(ItemArray)); } else if (_currentInformationSet == InformationSet.MessageInformation) { _rootObject = MessageDatabase.GetMessageData() ?? Activator.CreateInstance(typeof(MessageData)); } PopulateViewGroup(_rootObject, InfoContent); MessageUI.text = _currentInformationSet.ToString() + " loaded."; }