-
-
Notifications
You must be signed in to change notification settings - Fork 105
TokenDrawer
Extends: Node2D
This script handles interactions with the token drawer on a Card.
var is_drawer_open: bool
-
Setter:
set_is_drawer_open
A flag on whether the token drawer is currently open
var owner_card
Stores a reference to the Card that is hosting this node
func set_is_drawer_open(value: bool) -> void
Setter for is_drawer_open Simply calls token_drawer()
func token_drawer(requested_state: bool = true) -> var
Reveals or Hides the token drawer
The drawer will not appear while another animation is ongoing and it will appear only while the card is on the board.
func mod_token(token_name: String, mod: int = 1, set_to_mod: bool = false, check: bool = false, tags: Array = "Manual") -> int
Adds a token to the card
If the token of that name doesn't exist, it creates it according to the config.
If the amount of existing tokens of that type drops to 0 or lower, the token node is also removed.
func get_all_tokens() -> Dictionary
Returns a dictionary of card tokens name on this card.
- Key is the name of the token.
- Value is the token scene.
func get_token(token_name: String) -> Token
Returns the token node of the provided name or null if not found.
func get_token_count(token_name: String) -> int
Returns only the token count if it exists. Else it returns 0
func are_hovered() -> bool
Returns true, when the mouse cursor is over the drawer. This is used to retain focus on the card while the player is manipulating tokens.