Example #1
0
    //  NB: This was copied from BarSlot.cs. This could be made generic if we need criteria for other things eventually.
    //	if the locked dice have the proper dice to purchase this, then return true. return false otherwise.
    public bool isQualified()
    {
        bool             isQual   = false;
        PurchaseCriteria criteria = this.GetComponent <PurchaseCriteria>();

        if (criteria == null)
        {
            return(true);        //  early bail if no criteria needs to be met
        }
        isQual = true;

        GameState gs = GameState.GetCurrentGameState();

        //  this checks only the locked dice list.
        List <PharoahDie> diceList = gs.GetLockedDiceList();

        if (criteria)
        {
            isQual = criteria.MatchesCriteria(diceList);
        }

        //  optional, check all dice on current player. May make things easier, but may make things more confusing.

        /*
         *      if (criteria) {
         *              isQual = criteria.MatchesCriteria(gs.currentPlayer.diceList);
         *      }
         */
        return(isQual);
    }
Example #2
0
 public void NewGame()
 {
     if (nTiles <= 0)    //  0 is equal to number of players. positive numbers are exact tile count.
     {
         nTiles += GameState.GetCurrentGameState().allPlayers.Count;
     }
     if (nTiles < 1)
         nTiles = 1;
     //	tbd: roll a number and add the correct tile
     Tile	childTile;
     if (childTile = this.GetComponentInChildren<Tile>()) {
         addChild(childTile.gameObject);
         Debug.Log("BarSlot " + this.name + " added Tile " + childTile.name);
     }
     else {
         Debug.LogWarning("BarSlot " + this.name + " could not find a Tile on Start().");
     }
     criteria = GetComponent<PurchaseCriteria>();
 }
Example #3
0
    public void NewGame()
    {
        if (nTiles <= 0)            //  0 is equal to number of players. positive numbers are exact tile count.
        {
            nTiles += GameState.GetCurrentGameState().allPlayers.Count;
        }
        if (nTiles < 1)
        {
            nTiles = 1;
        }
        //	tbd: roll a number and add the correct tile
        Tile childTile;

        if (childTile = this.GetComponentInChildren <Tile>())
        {
            addChild(childTile.gameObject);
            Debug.Log("BarSlot " + this.name + " added Tile " + childTile.name);
        }
        else
        {
            Debug.LogWarning("BarSlot " + this.name + " could not find a Tile on Start().");
        }
        criteria = GetComponent <PurchaseCriteria>();
    }