using System; using System.Collections.Generic; using System.Text; namespace tAC_Engine { /// /// Serves as the parent to any specific games that use tAC_Engine, providing a generic interface /// to any specific game. /// public class GenericGame { protected GenericScoreCard mStockpile; // Resources for this game /// /// Use the generic resource card /// public GenericGame() { mStockpile = new GenericScoreCard(); } /// /// Ask about the overall quantity of a specific resource /// /// Type of resource to inquire /// Overall amount of that resource public virtual int QueryResource(string resourceType) { return mStockpile.QueryResource(resourceType); } /// /// Increases a specific overall resource /// /// Type of resource to add /// Amount of that resource to add public virtual void IncreaseResource(string resourceType, int amount) { mStockpile.Gather(resourceType, amount); } /// /// Attempts to decrement a specific overall resource /// /// Type of resource to decrement /// Amount to decrement /// True if successful, False otherwise (for lack of funds) public virtual bool DecreaseResource(string resourceType, int amount) { mStockpile.Gather(resourceType, -1 * amount); if (mStockpile.QueryResource(resourceType) < 0) { int negative = mStockpile.QueryResource(resourceType); mStockpile.Gather(resourceType, -1 * negative); return false; } return true; } /// /// Allows the game to run logic. /// public virtual void Update() { } } }