Skip to content

Added StarCoin system and test script - #1

Open
sedemabla wants to merge 2 commits into
mainfrom
feature/coin-system
Open

sedemabla wants to merge 2 commits into
mainfrom
feature/coin-system

Conversation

@sedemabla

Copy link
Copy Markdown
Collaborator

StarCoin currency system for Popstar Hub.

Features:

  • Singleton with DontDestroyOnLoad (persists across scenes)
  • AddCoins, SpendCoins, GetBalance, HasEnough
  • PlayerPrefs persistence (coins save between sessions)
  • Debug mode toggle from Inspector
  • Events for UI integration:
    • OnCoinsEarned (for coin burst particles, floating "+100" text)
    • OnCoinsSpent (for spend animations, floating "-200" text)
    • OnPurchaseFailed (for error shake, flash red)
    • OnBalanceChanged (for keeping HUD updated)
    • OnCoinsReset (for reset animations)
  • RewardFromScore for mini-game score conversion
  • AddCoinsWithMultiplier for combo/streak bonuses
  • GetDeficit for shop "you need X more" display
  • CoinSystemTest script with keyboard controls (G/H/R/B)

How to use from any script:
StarCoinManager.Instance.AddCoins(100);
StarCoinManager.Instance.SpendCoins(200);
StarCoinManager.Instance.GetBalance();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant