示例#1
0
 //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);
 }
示例#2
0
 void    ClickFlip()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray          tRay = Camera.main.ScreenPointToRay(Input.mousePosition);                      //Make a ray from screen position into the game scene
         RaycastHit2D tHit = Physics2D.Raycast(tRay.origin, tRay.direction);                         //Cast ray, if it hits a game object we will know, NB only first collision is reported
         if (tHit.collider != null)
         {
             CardSprites.CardSprite tCS = tHit.collider.gameObject.GetComponent <CardSprites.CardSprite> ();
             if (tCS != null)
             {
                 tCS.Show = !tCS.Show;
                 CmdReturnCard(tCS.mCard.ID);
                 Destroy(tHit.collider.gameObject);                                  //Remove local image of card, note this does not use Networked GO, all local
             }
         }
     }
 }