-1

We are coding a new card game for a customer who would like cards to have "double actions" like the following:

Deal +2 Damage to any Enemy Spaceship

OR

Restore any of your Spaceships to Full Health

Obviously we have Action 1 and Action 2 as separate parameters on the card itself, so that's not the problem. If you think of card games like Hearthstone where you are dragging and dropping cards onto the game area. How can the player inform the system which action they are playing?

4
  • Play some Sentinels of the Multiverse. Commented May 29, 2018 at 14:08
  • 1
    Game Dev SE
    – Daxtron2
    Commented May 29, 2018 at 14:55
  • @TJWolschon - Didn't realize there was a Game Dev SE....learn something new every day. Thank you.
    – Indy-Jones
    Commented May 29, 2018 at 16:55
  • This question is more on-topic there than it is here, as it's a little too broad for SO
    – Daxtron2
    Commented May 29, 2018 at 16:56

1 Answer 1

3

You can do this in multiple ways. Probably the easiest one is to have List<YourBehaviour>or YourBehaviour[] in the card class and to pass the index of the behaviour that the player chose in the constructor and set your main behaviour like so

Card(... int behaviourIndex)
{
   ...
   this.MainBehaviour = YourBehaviour[behaviourIndex];
} 

Or have custom method in Card class like:

public void SetupMainBehaviour(int behaviourIndex)
{
   this.MainBehaviour = YourBehaviour[behaviourIndex];
}

When it comes to Unity you can have some cool popup and with multiple choices

1
  • Great idea. So choose the card you want to play, then perhaps do a popup which has the text of each action from the card so the player can choose which one they want to use. Then set it accordingly.
    – Indy-Jones
    Commented May 29, 2018 at 16:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.