示例#1
0
    private List <RealFakeData> getData()
    {
        //Remove all data without chosen topics
        string[] chosenTopics = GameObject.FindGameObjectWithTag("GameLogic").GetComponent <GameStats>().getChosenTopics();

        //Get the real fake data from data object
        List <RealFakeData> dataList = GameObject.FindGameObjectWithTag("GameLogic").GetComponent <GamesData>().getRealFakeData();

        List <RealFakeData> shuffledData = dataList.OrderBy(x => UnityEngine.Random.value).ToList();
        RealFakeData        r;

        foreach (RealFakeData d in shuffledData)
        {
            string topic = d.getTopic();
            if (topic == chosenTopics[0] || topic == chosenTopics[1] || topic == chosenTopics[2])
            {
                data = d;
                shuffledData.Remove(d);
                return(shuffledData);
            }
        }
        return(shuffledData);
    }