public override void ExtractInterests(ChallengeStage stage) { ObstacleDatabase obstacleDatabase = null; bool extractionSuccess = false; base.ExtractInterests(stage); stageComponent = stage; if (stage != null) { obstacleDatabase = stage.GetObstacleDatabase(); if (obstacleDatabase != null) { obstacleModel = obstacleDatabase.GetObstacleModel(obstacleCode); if ((obstacleModel != null) && stage.GetNodeStructurePosition(placementNodeID, ref obstaclePosition)) { obstaclePosition += offsetWithinNode; extractionSuccess = true; } } } if (!extractionSuccess) { stage = null; obstacleModel = null; obstaclePosition = Vector2.zero; } }
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 void SetObstacle(string obstacleId) { _obstacleId = obstacleId; ObstacleData data = ObstacleDatabase.GetObstacleData(obstacleId); MessageManager.SendStringMessage(data.EncounterMessage); _health = data.Health; }
public void ExeuteObstacleActions() { if (ObstaclePresent()) { ObstacleData data = ObstacleDatabase.GetObstacleData(_obstacleId); if (data.ObstacleActions != null && data.ObstacleActions.Length > 0) { //Get random action and execute int outcomeIndex = Random.Range(0, data.ObstacleActions.Length); data.ObstacleActions[outcomeIndex].ExecuteOutcome(); } } }
public bool SubmitObstacleAction(string action, string target) { ObstacleData data = ObstacleDatabase.GetObstacleData(_obstacleId); 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(); return(true); } } return(false); }
public void DamageObstacle(int damage) { if (!string.IsNullOrEmpty(_obstacleId)) { _health -= damage; if (_health <= 0) { //Execute final outcome ObstacleData data = ObstacleDatabase.GetObstacleData(_obstacleId); data.CompletedOutcome.ExecuteOutcome(); _obstacleId = null; } } }
/// <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."; }