/// <Summary> /// Set the event executed flag if the event parts had. /// </Summary> /// <param name="parts">The executed event parts data.</param> protected void SetEventExecutedFlag(AriadneEventParts parts) { if (parts.hasExecutedFlag && parts.executedFlagName != "") { FlagManager.SetEventFlagDict(parts.executedFlagName, true); } }
/// <Summary> /// Set treasure box open state by checking event flags. /// When all flags in the event are true, open the treasure box. /// </Summary> /// <param name="treasureBoxObj">The treasure box object to instantiate.</param> /// <param name="index">Index of the position in MapInfo list.</param> void SetTreasureBoxState(GameObject treasureBoxObj, int index) { TreasureAnimator treasureAnim = treasureBoxObj.GetComponent <TreasureAnimator>(); if (treasureAnim == null) { return; } EventMasterData eventData = null; int eventId = currentFloorMapData.mapInfo[index].eventId; if (eventId > 0) { string path = "EventData/event_" + eventId.ToString("D5"); eventData = (EventMasterData)Resources.Load(path); } if (eventData == null) { return; } bool isOpend = false; AriadneEventParts parts = null; for (int i = eventData.eventParts.Count - 1; i >= 0; i--) { parts = eventData.eventParts[i]; if (parts == null) { continue; } if (parts.hasExecutedFlag && !string.IsNullOrEmpty(parts.executedFlagName)) { isOpend = FlagManager.CheckEventFlag(parts.executedFlagName); } } if (!isOpend) { return; } treasureAnim.OpenTreasureBoxImmediately(); }
/// <Summary> /// Initialize state of dungeon. /// </Summary> void InitializeDungeonState() { // Get settings from dungeon manager. GetSettings(); // Get references of UI components. GetRef(); // Set unit size of dungeon. SetUnitSize(); // Set player init position. SetInitPos(); // Set traverse data of init position. SetTraverse(); // Set reference of map objects list. SetMapObjList(); // Set state of UGUI buttons. SetUGUIButtons(); // Fade in map. FadeInMap(); // Refrect traversed data of init position to map. SendSetDirtyMsg(); // Set event dict. FlagManager.InitializeEventFlagList(); // Set holding item dict. ItemManager.InitializeHoldItemDict(); // Fade in. StartCoroutine(DelayFadeIn()); }
/// <Summary> /// Returns that event parts condition is matched. /// </Summary> /// <param name="parts">The event parts to check the condition.</param> bool CheckEventPartsCondition(AriadneEventParts parts) { bool isMatched = false; switch (parts.startCondition) { case AriadneEventCondition.Flag: isMatched = FlagManager.CheckEventFlag(parts.startFlagName); break; case AriadneEventCondition.Item: isMatched = ItemManager.CheckEventConditionItem(parts.startItemId, parts.comparisonOperator, parts.startNum); break; case AriadneEventCondition.Money: isMatched = ItemManager.CheckEventConditionMoney(parts.comparisonOperator, parts.startNum); break; case AriadneEventCondition.NoCondition: isMatched = true; break; } return(isMatched); }