Hello everyone.
I’m new in Unity and i want some help in writing the script for my first game.
I wrote a script with a public static boolean variable Draggable and i added it to the card prefab as a component.
Now i’m writing the GameManager Script.
Here is the Hierarchy for the project :
Now i’m writing the GameManager script. Since it’s a turn based card game i want Only the cards in the player1hand to be draggable during his turn. So i thought i have to acces the Player1_Hand GameObject children ( which are the cards ) and make them iterable ( array or list ), and depending on which player turn it is i will set the Draggable boolean for the cards to True or false.
So basically i need to know how to :
- Make an iterable variable ( List, Array ) Called PlayerXHand that contains the cards for PlayerX.
- For each card, Change the public static Draggable boolean which is declared on another script component “Card” attached to the Card Prefab.
Since i’m a beginner in game developping and c#, this is a bit difficult so i’m looking forward to your help.
Thank you