Beispiel #1
0
    private void Awake()
    {
        if (instance == null)
        {
            hud.SetActive(false);
            cards    = new List <GameObject>();
            instance = this;
            prefabs  = new GameObject[] { diamonds_2, diamonds_3, diamonds_4, diamonds_5,
                                          diamonds_6, diamonds_7, diamonds_8, diamonds_9, diamonds_10, diamonds_j,
                                          diamonds_q, diamonds_k, diamonds_a, hearts_2, hearts_3, hearts_4, hearts_5,
                                          hearts_6, hearts_7, hearts_8, hearts_9, hearts_10, hearts_j, hearts_q, hearts_k,
                                          hearts_a, spades_2, spades_3, spades_4, spades_5, spades_6, spades_7, spades_8, spades_9,
                                          spades_10, spades_j, spades_q, spades_k, spades_a, clubs_2, clubs_3, clubs_4, clubs_5, clubs_6,
                                          clubs_7, clubs_8, clubs_9, clubs_10, clubs_j, clubs_q, clubs_k, clubs_a };
            rand        = new System.Random();
            snapZone    = 0;
            maxPos      = 0;
            numPlayers  = 1;
            playerCards = new List <GameObject>();
            tableCards  = new List <GameObject>();
            OnlineZone onlineZone = FindObjectOfType <OnlineZone>();
            limitz     = onlineZone.GetLimitZ();
            limitx     = onlineZone.GetLimitX();
            sizeSquare = onlineZone.GetSize();


            fillStack();
        }
        else if (instance != this)
        {
            Debug.Log("Instance already exists, destroying object!");
            Destroy(this);
        }
    }
Beispiel #2
0
 // had to extract from start to be able to call from external scripts
 public void setup()
 {
     onlineZone = FindObjectOfType <OnlineZone>();
     position   = -1;
 }