예제 #1
0
    public static void RandomizeCardsForPlayer()
    {
        Instance.randomSeed = PlayerDataBucket.GetPlayerName().GetHashCode();
        Debug.Log("seed:" + Instance.randomSeed);
        Random.InitState(Instance.randomSeed);
        for (int i = 0; i < Instance.cards.Count; i++)
        {
            bool tapeIsRightResrouce = (Random.value > 0.5f);
            if (tapeIsRightResrouce)
            {
                Instance.cards[i].correctResrouce = ResourceItem.Ductape;
            }
            else
            {
                Instance.cards[i].correctResrouce = ResourceItem.Wd;
            }

            CardData tempCard    = Instance.cards[i];
            int      randomIndex = Random.Range(i, Instance.cards.Count);
            Instance.cards[i]           = Instance.cards[randomIndex];
            Instance.cards[randomIndex] = tempCard;
        }
    }