Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     //Initializing and Start methods
     P = Camera.main.GetComponent <Main>().MPlayer;
     R = Camera.main.GetComponent <ReadJson>();
     W = Camera.main.GetComponent <WriteJson>();
     G = Camera.main.GetComponent <Grave>();
     B = Camera.main.GetComponent <Main>().MBoard;
     T = Camera.main.GetComponent <Main>().MTurns;
     H = Camera.main.GetComponent <Main>().MHero;
     P.Start();
     R.Start();
     W.Start();
     B.Start();
     T.TStart();
     //get 50 random cards [only for testing]
     for (int co = 0; co < 50; co++)
     {
         GameObject thisCard = Instantiate(PreCard, new Vector3(7.91f, -2.31f, -.1f), Quaternion.Euler(0, 180, 90));
         R.GetCard(thisCard, Random.Range(0, R.CardDataCards["Cards"].Count));
         P.Deck.Add(thisCard);
         if (thisCard.GetComponent <Card>().GetPath() != "path")
         {
             thisCard.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(thisCard.GetComponent <Card>().GetPath());
         }
         thisCard.GetComponent <Card>().UpdateTM();
     }
     //Shuffling the Deck
     for (int i = 0; i < P.Deck.Count; i++)
     {
         GameObject temp        = P.Deck[i];
         int        randomIndex = Random.Range(i, P.Deck.Count);
         P.Deck[i]           = P.Deck[randomIndex];
         P.Deck[randomIndex] = temp;
     }
     //Drawing the first four cards
     StartCoroutine(P.Draw4());
 }