0

I am developing a game for cards. I have a deck of cards. want to display the cards like an arc shape. I have implements it but its showing all the cards in deck horizontally by using horizontal layout group script provided by unity. I am trying to use game object with vector3 function by giving it custom X and Y but it has no effect. Below is the code i am trying

GameObject DealCard(float x,float y)
{
    if(hand.Count >= 13)
    {
        //showReset = true;
        return null;
        //Alternatively to auto reset the deck:
        //ResetDeck();
    }
    GameObject handObject = GameObject.FindWithTag("handObject");

    int card = Random.Range(0, cards.Count - 1);
    GameObject go = GameObject.Instantiate(deck[card]) as GameObject;

    go.transform.SetParent (handObject.transform,true);
    go.transform.position = new Vector3(x+((float)cardsDealt / 4), y+((float)cardsDealt / -4), (float)cardsDealt / -4); // place card 1/4 up on all axis from last
    //go.transform.position = new Vector3(200, 300, (float)cardsDealt / -4); // place card 1/4 up on all axis from last
    cards.RemoveAt(card);
    //Debug.Log(transform.parent.gameObject.tag);
    Debug.Log(x +"," + y);

    if(cards.Count == 0) {
        showReset = true;
    }

    return go;
}

Here is a screenshot for a better idea what i want to achieve. These are just images placed manually

farhan678
  • 85
  • 13
  • Can't you just define their position and rotation manually? Have some placeholders where and how they should appear and use those instead of making it happen by code. – Everts Dec 29 '15 at 09:56
  • No deck will be controlled by code these cards will vary in gameplay – farhan678 Dec 29 '15 at 10:17

0 Answers0