//Called when Player hand changes private void OnInventoryChanged(SyncListInt.Operation op, int index) { switch (op) { case SyncList <int> .Operation.OP_ADD: { CardSprites.CardSprite tSprite = CardSprites.InstantiateCard(mPlayerDeck [index]); tSprite.transform.position = new Vector2((float)index / 6f - 5f, 0); } break; } Debug.Log("Items changed " + op); }
void Awake() //make Singleton { if (sCR == null) { sCR = this; DontDestroyOnLoad(gameObject); if (sSpritesFront == null) { sSpritesFront = Resources.LoadAll <Sprite>("CardDeckSpriteSheet"); } if (sSpritesBack == null) { sSpritesBack = Resources.Load <Sprite>("HiResBack"); } } else if (sCR != this) { Destroy(gameObject); } }