StatePattern.HasPin.RequestCash C# (CSharp) Method

RequestCash() public method

public RequestCash ( int cash ) : void
cash int
return void
        public void RequestCash(int cash)
        {
            if(cash <= atm.cashInMachine)
            {
                Debug.Log (cash + " provided by machine");
                atm.cashInMachine -= cash;
                atm.SetATMState(atm.noCard);

                if(atm.cashInMachine <= 0)
                {
                    atm.SetATMState(atm.atmOutOfMoney);
                }

                Debug.Log ("Card ejected.");
            }
            else
            {
                Debug.Log ("Don't have enough cash");
                atm.SetATMState(atm.noCard);
                Debug.Log ("Card ejected.");
            }
        }