Exemple #1
0
    public override void Execute(Miner miner)
    {
        //The miner digs for gold until he's carrying in excess of MaxNuggets.
        //If he gets thirsty during his digging he stops work and changes state to go to the saloon for a whiskey.
        miner.AddToGoldCarrier(1);

        //Diggin' is hard work
        miner.IncreaseFatigue();
        Debug.Log(miner.ID + " Pickin' up a nugget");

        //If enough gold mined, go and put it in the bank
        if (miner.IsPocketFull())
        {
            miner.ChangeState(VisitBankAndDepositGold.Instance);
        }

        //If thirsty go and get a whiskey
        if (miner.IsThirsty())
        {
            miner.ChangeState(QuenchThirst.Instance);
        }
    }