Example #1
0
        /**
         * Moves a coin from the player to a specified retrun
         */
        private void ReturnCoin(CoinMechs coinReturn)
        {
            var coinReturnRectangle = COIN_RETURN_RECTANGLE_XREF[coinReturn];

            if (CheckCoinHeld())
            {
                playersCoin.UpdatePosition(coinReturnRectangle.X + COIN_RETURN_RENDER_OFFSET, coinReturnRectangle.Y + COIN_RETURN_RENDER_OFFSET);
                COIN_RETURN_COIN_XREF[coinReturn].Push(playersCoin);
                playersCoin = null;
            }
        }
Example #2
0
 /**
  * Checks if user click was in a coin return and that the player is not currently holding a coin. If both are true,
  *  the coin from the clicked return mechanism is picked up.
  */
 public void ProcessCoinReturnClick(CoinMechs coinReturn)
 {
     if (!CheckCoinHeld() && coinReturn != CoinMechs.None) // coin cant be grabbed if already holding one
     {
         if (coinReturn == CoinMechs.Mech1)
         {
             GrabReturnedCoin(CoinMechs.Mech1);
         }
         else
         {
             GrabReturnedCoin(CoinMechs.Mech2);
         }
     }
 }
Example #3
0
        /**
         *   Processes click on coin slot where coin is held. Returns the number of credits
         *   received, 0 for dime, 1 for quarter. If coin is dime, places coin in the appropriate return;
         */
        public int InsertCoin(CoinMechs coinSlot)
        {
            int credits = 0;

            if (CheckCoinHeld() && coinSlot != CoinMechs.None)
            {
                if (playersCoin.CoinType == Coin.CoinTypes.Quarter)
                {
                    credits = 1;
                }
                else
                {
                    ReturnCoin(coinSlot);
                }
                playersCoin = null;
            }

            return(credits);
        }
Example #4
0
 public int getNumberCoinsInReturn(CoinMechs mech)
 {
     return(COIN_RETURN_COIN_XREF[mech].Count);
 }
Example #5
0
 // Picks up a coin from the specified coinReturn mech
 private void GrabReturnedCoin(CoinMechs coinReturn)
 {
     playersCoin = COIN_RETURN_COIN_XREF[coinReturn].Pop();
 }