Esempio n. 1
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 100, 20), "Next card"))
     {
         if (cardIndex >= cModel.faces.Length)
         {
             cardIndex = 0;
             cFlipper.flipCard(cModel.faces[cModel.faces.Length - 1], cModel.cardBack, -1);
             //cModel.toggleFace(false);
         }
         else
         {
             if (cardIndex > 0)
             {
                 cFlipper.flipCard(cModel.faces[cardIndex - 1], cModel.faces[cardIndex], cardIndex);
             }
             else
             {
                 cFlipper.flipCard(cModel.cardBack, cModel.faces[cardIndex], cardIndex);
             }
             //cModel.cardIndex = cardIndex;
             //cModel.toggleFace(true);
             cardIndex++;
         }
     }
 }
Esempio n. 2
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 100, 20), "Hit me")) //location 10,10 size 100*20
     {
         if (cardIndex == cardModel.faces.Length)
         {
             cardIndex           = 0;
             cardModel.cardIndex = cardIndex;
             cardModel.ToggleFace(true);
         }
         else
         {
             cardModel.cardIndex = cardIndex;
             cardModel.ToggleFace(true);
         }
         cardIndex++;
     }
     if (GUI.Button(new Rect(120, 10, 100, 20), "Change back"))
     {
         if (backIndex == cardModel.cardBack.Length)
         {
             backIndex           = 0;
             cardModel.backIndex = backIndex;
             cardModel.ToggleFace(false);
         }
         else
         {
             cardModel.backIndex = backIndex;
             cardModel.ToggleFace(false);
         }
         backIndex++;
     }
     if (GUI.Button(new Rect(230, 10, 100, 20), "flip card"))
     {
         if (cardIndex >= cardModel.faces.Length)
         {
             cardIndex = 0;
             flipper.flipCard(cardModel.faces[cardModel.faces.Length - 1], cardModel.cardBack[backIndex], -1);
         }
         else
         {
             if (cardIndex > 0)
             {
                 flipper.flipCard(cardModel.faces[cardIndex - 1], cardModel.faces[cardIndex], cardIndex);
             }
             else
             {
                 flipper.flipCard(cardModel.cardBack[backIndex], cardModel.faces[cardIndex], cardIndex);
             }
             cardIndex++;
         }
     }
 }
Esempio n. 3
0
    void flip()
    {
        Random_Card.openCardClicked = true;
        remainingCards = Random_Card.noOfCards - Random_Card.counter;
        if (Random_Card.openCardClicked == true)
        {
            Random_Card.openCardClicked = false;

            if (remainingCards != 0)
            {
                Debug.Log("In Flip()");
                if (cdClicked == false)
                {
                    cdClicked = true;
                    this.transform.Translate(635, -517, 0);
                    Random_Card.RummyHand.hand1.Add(Random_Card.RummyHand.closedDeck[0]);
                    Random_Card.RummyHand.closedDeck.RemoveAt(0);
                }
                else if (odClicked == false)
                {
                    odClicked = true;
                    this.transform.Translate(399, -453.5715f, 0);
                    Random_Card.RummyHand.hand1.Add(Random_Card.RummyHand.openDeck[Random_Card.RummyHand.openDeck.Count - 1]);
                    Random_Card.RummyHand.openDeck.RemoveAt(Random_Card.RummyHand.openDeck.Count - 1);
                }
                //this.transform.Translate(350, -160, 0);
                Debug.Log("Calling Flip.....");
                flipper.flipCard(Resources.Load <Sprite>("Image/1") as Sprite, Resources.Load <Sprite>("Image/" + Random_Card.RummyHand.gameDeck[++Random_Card.counter]) as Sprite);

                go1.SetActive(true);
            }
        }
    }
Esempio n. 4
0
    public void Flip(int card)
    {
        CardFlipper flipper = fetchedCards [card].Card.GetComponent <CardFlipper> ();
        CardModel   model   = fetchedCards [card].Card.GetComponent <CardModel> ();

        flipper.flipCard(model.cardBack, model.faces [card], card);
        fetchedCards [card].isFaceUp = true;
    }
Esempio n. 5
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 100, 28), "Hit Me!"))
     {
         if (cardIndex >= cardModel.faces.Length)
         {
             cardIndex = 0;
             flipper.flipCard(cardModel.faces [cardModel.faces.Length - 1], cardModel.cardBack, -1);
         }
         else
         {
             if (cardIndex > 0)
             {
                 flipper.flipCard(cardModel.faces [cardIndex - 1], cardModel.faces [cardIndex], cardIndex);
             }
             else
             {
                 flipper.flipCard(cardModel.cardBack, cardModel.faces [cardIndex], cardIndex);
             }
             cardIndex++;
         }
     }
 }
Esempio n. 6
0
 void Awake()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     cardFlipper    = GetComponent <CardFlipper>();
     cardFlipper.flipCard(cardBack, cardFace, true);
 }