Ejemplo n.º 1
0
        public void CoinPickupDropTest()
        {
            CoinDisplayManager manager = CoinDisplayManager.getCoinDisplaymanager();

            // set manager to state with no held coin
            manager.DropCoin();

            manager.CreateNewRandomCoin();
            Assert.IsTrue(manager.CheckCoinHeld());

            // manager is in state with a coin being held if last test passed
            manager.DropCoin();
            Assert.IsFalse(manager.CheckCoinHeld());

            manager.DropCoin();
            manager.ProcessPileClicked();
            while (!manager.isPlayerCoinAQuarter())
            {
                manager.CreateNewRandomCoin();
            }

            manager.ProcessPileClicked();
            Assert.IsFalse(manager.isPlayerCoinAQuarter()); // coin was dropped, so it should be null
        }
Ejemplo n.º 2
0
        /**
         * Mouse Move for moving coing to the coin slot or pile
         */
        private void GameBoxForm_MouseMove(object sender, MouseEventArgs e)
        {
            long currentTicks         = DateTime.Now.Ticks;
            long ticksSinceLastRender = currentTicks - previousRenderTicks;

            if (coinManager.IsOverCoinPile(e.X, e.Y) || coinManager.IsOverCoinMech(e.X, e.Y))
            {
                Cursor.Current = Cursors.Hand;
            }
            else
            {
                Cursor.Current = Cursors.Default;
            }

            if ((ticksSinceLastRender > MIN_RENDER_TICKS) && coinManager.CheckCoinHeld())
            {
                coinManager.MovePlayersCoin(e.X, e.Y);
                this.Refresh();
                previousRenderTicks = currentTicks;
            }
        }