|
@ -22,20 +22,34 @@ public class GameDataManager { |
|
|
_gameData = deserializer.Deserialize<GameData>(yamlText); |
|
|
_gameData = deserializer.Deserialize<GameData>(yamlText); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public TopicData GetRandomTopicData() |
|
|
public TopicData GetRandomTopicData(bool ignoreFirst=false) |
|
|
{ |
|
|
{ |
|
|
if (_gameData.Topics.Count == 0) |
|
|
if (_gameData.Topics.Count == 0 || (ignoreFirst && _gameData.Topics.Count == 1)) |
|
|
{ |
|
|
{ |
|
|
Reset(); |
|
|
Reset(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int topicIndex = Random.Range(0, _gameData.Topics.Count); |
|
|
int topicIndex = Random.Range(0, _gameData.Topics.Count); |
|
|
|
|
|
if (ignoreFirst && topicIndex == 0) |
|
|
|
|
|
topicIndex = 1; |
|
|
|
|
|
|
|
|
TopicData topicData = _gameData.Topics[topicIndex]; |
|
|
TopicData topicData = _gameData.Topics[topicIndex]; |
|
|
_gameData.Topics.RemoveAt(topicIndex); |
|
|
_gameData.Topics.RemoveAt(topicIndex); |
|
|
|
|
|
|
|
|
return topicData; |
|
|
return topicData; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public TopicData GetFirstTopicData() |
|
|
|
|
|
{ |
|
|
|
|
|
if (_gameData.Topics.Count == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
Reset(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TopicData topicData = _gameData.Topics[0]; |
|
|
|
|
|
return topicData; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public CategoryData GetRandomCategoryData(TopicData topicData, bool removeFromTopic = true) |
|
|
public CategoryData GetRandomCategoryData(TopicData topicData, bool removeFromTopic = true) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|