/// <summary> /// Gets the random type of the unlocked minigame /// NOTE: Should only get called ONCE, it can repeat if called again, leading to error /// </summary> /// <returns>The random unlocked minigame type.</returns> public MinigameTypes GetRandomUnlockedMinigameType(){ if(!isMinigameRandomCallLocked){ isMinigameRandomCallLocked = true; // Lock the function call so its not called again int latestAbsolutePartition = GetLatestUnlockedAbsolutePartition(); List<MinigameTypes> minigameAux = new List<MinigameTypes>(); foreach(ImmutableDataPartition partitionData in DataLoaderPartitions.GetDataList()){ if(partitionData.Number <= latestAbsolutePartition && partitionData.MinigameList != null){ foreach(MinigameTypes minigameType in partitionData.MinigameList){ minigameAux.Add(minigameType); } } } if(minigameAux.Count == 0){ return MinigameTypes.None; } else{ int randomIndex = UnityEngine.Random.Range(0, minigameAux.Count); return minigameAux[randomIndex]; } } else{ Debug.LogError("Illegal second call for minigame"); return MinigameTypes.None; } }
private int GetLatestUnlockedAbsolutePartition(){ ImmutableDataGate latestGate = GatingManager.Instance.GetLatestLockedGate(); if(latestGate != null){ // All gates unlocked return latestGate.AbsolutePartition - 1; // Get latest gate and subtract 1 } else{ // All gates unlocked List<ImmutableDataPartition> list = DataLoaderPartitions.GetDataList(); return DataLoaderPartitions.GetDataList().Count - 1; // Get the gates list count, off by 1 } }
/// <summary> /// When store opens, get the latest gate and return the allowed decoration types /// based on the partition xml data. /// </summary> /// <returns>The allowed deco type from latest unlocked gate.</returns> public List<string> GetAllowedDecoTypeFromLatestPartition(){ string preparedPartitionString = "Partition" + StringUtils.FormatIntToDoubleDigitString(GetLatestUnlockedAbsolutePartition()); ImmutableDataPartition partitionData = DataLoaderPartitions.GetData(preparedPartitionString); return new List<string>(partitionData.DecoCategoriesStore); }
public bool IsPartitionInCurrentZone(int absolutePartitionNumber){ string craftedId = "Partition" + StringUtils.FormatIntToDoubleDigitString(absolutePartitionNumber); ImmutableDataPartition partition = DataLoaderPartitions.GetData(craftedId); return (partition.Zone == SceneUtils.GetZoneTypeFromSceneName(SceneUtils.CurrentScene)) ? true : false; }