當前位置: 首頁>>代碼示例>>C#>>正文


C# Coin類代碼示例

本文整理匯總了C#中Coin的典型用法代碼示例。如果您正苦於以下問題:C# Coin類的具體用法?C# Coin怎麽用?C# Coin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Coin類屬於命名空間,在下文中一共展示了Coin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HandleCoin

 public override void HandleCoin(Coin coin)
 {
     if (Math.Abs(coin.Weight - 5) < 0.01 && Math.Abs(coin.Diameter - 21.4) < 0.1)
         Debug.WriteLine("Captured 20p");
     else if (_successor != null)
         _successor.HandleCoin(coin);
 }
開發者ID:FrUi7c4k3,項目名稱:PatternsAndPractices,代碼行數:7,代碼來源:TwentyPenceHandler.cs

示例2: getAndRemoveCoin

    void getAndRemoveCoin(Coin coin)
    {
        this.coinGain += coin.price;
        AudioSource.PlayClipAtPoint (coinSound, transform.position);

        Destroy (coin.gameObject);
    }
開發者ID:kkabdol,項目名稱:MassageTheHero,代碼行數:7,代碼來源:Pet.cs

示例3: BigMarioCoinTopSideCollisionTest

        public void BigMarioCoinTopSideCollisionTest()
        {
            MarioInstance testMario = new MarioInstance(game);
            MarioInstance expectedMario = new MarioInstance(game);
            testMario.Mushroom();
            expectedMario.Mushroom();

            Coin testCoin = new Coin(game);
            Coin expectedCoin = new Coin(game);
            expectedCoin.Disappear();

            ICollisionSide side = new TopSideCollision();
            CollisionData collision = new CollisionData(testMario, testCoin, side);
            MarioItemCollisionHandler collisionHandler = new MarioItemCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool testState = testMario.MarioState is NormalRightIdleState;
            bool expectedState = expectedMario.MarioState is NormalRightIdleState;

            Vector2 testLocation = testMario.VectorCoordinates;
            Vector2 expectedLocation = expectedMario.VectorCoordinates;

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }
開發者ID:Bartholomew-m134,項目名稱:BuckeyeGameEngine,代碼行數:26,代碼來源:BigMarioCoinCollisionTests.cs

示例4: Awake

 void Awake()
 {
     float i = 1.0f;
     List<Coin> p1coins = new List<Coin>();
     List<Coin> p2coins = new List<Coin>();
     foreach(GameObject c in GameObject.FindGameObjectsWithTag("p1"))
     {
         Vector3 pos = c.transform.position;
         float id = 1.0f;
         id += i/10;
         i += 1;
         Coin c1 = new Coin(pos,id);
         p1coins.Add(c1);
         c.name = id.ToString();
     }
     float j = 1.0f;
     foreach(GameObject c in GameObject.FindGameObjectsWithTag("p2"))
     {
         Vector3 pos = c.transform.position;
         float id = 2.0f;
         id += j/10;
         j += 1;
         Coin c2 = new Coin(pos,id);
         p2coins.Add(c2);
         c.name = id.ToString();
     }
     curr = new GameState (p1coins, p2coins);
     //curr.print ();
 }
開發者ID:tedavtar,項目名稱:CoinWars,代碼行數:29,代碼來源:getInterpolationData.cs

示例5: PutCoin

		public void PutCoin(Coin coin)
		{
			if (!Stock.ContainsKey(coin))
				Stock[coin] = 1;
			else
				++Stock[coin];
		}
開發者ID:pkuderov,項目名稱:vending-machine,代碼行數:7,代碼來源:CoinStock.cs

示例6: DropItem

     public void DropItem()
     {
          // Check if an item will drop
          randomDropChance = Random.Range(0, 100);

          // If an item does drop, pick one randomly with the given drop chances
          if (randomDropChance <= dropChance)
          {
               itemDropRate = Random.Range(0, 10);

               for (int i = 0; i < items.Count; i++)
               {
                    for (int j = 0; j < itemDropRates[i]; j++)
                    {
                         itemDrop.Add(items[i]);
                    }
               }
               //If it will drop an item, set the item it will drop to a random item that it can drop
               item = itemDrop[itemDropRate];

               //If it was a coin, give it a value
               if (item.GetComponent<Coin>())
               {
                    coin = item.GetComponent<Coin>();
                    coin.setValue(coinValue);
               }

               //Spawn the item
               if (item != null)
               {
                    Instantiate(item, transform.position, transform.rotation);
               }
          }
     }
開發者ID:pmer,項目名稱:zombie-ninja-attack-craft,代碼行數:34,代碼來源:DropLoot.cs

示例7: Given_TwentyRubles_Then_NotEnoughMoneyToBuyCoffee_CanBuyTea_And_SevenRublesInChange

		public void Given_TwentyRubles_Then_NotEnoughMoneyToBuyCoffee_CanBuyTea_And_SevenRublesInChange()
		{
			var coin10 = new Coin(10);

			var userAmount = _controller.UserCoins().Amount();
			var sum = TotalSum();
			var totalCoins10 = TotalCoins(10);

			_controller.PutCoin(coin10);
			_controller.PutCoin(coin10);

			Assert.Throws<ProductIsNotInAssortmentException>(() => _controller.BuyProduct("RRR"));
			Assert.Throws<NotEnoughMoneyException>(() => _controller.BuyProduct("Кофе с молоком"));

			const string teaTitle = "Чай";
			var product = _controller.BuyProduct(teaTitle);
			Assert.AreEqual(product.Title, teaTitle);

			Assert.AreEqual(_controller.PaidAmount(), 7);
			var change = _controller.ReturnChange();

			Assert.AreEqual(change.Amount(), 7);
			Assert.AreEqual(sum, TotalSum());
			Assert.AreEqual(totalCoins10, TotalCoins(10));
			Assert.AreEqual(_controller.UserCoins().Amount(), userAmount - product.Cost);
		}
開發者ID:pkuderov,項目名稱:vending-machine,代碼行數:26,代碼來源:VendingMachineControllerTests.cs

示例8: Start

    // Use this for initialization
    void Start()
    {
        //path = new Vector3[pathLength];
        ghostIndex = 0;
        romeosTurnNext = true;
        romeo.SetActive(false);
        rghost.SetActive(false);
        jghost.SetActive(false);

        juliaMove = julia.GetComponent<PlayerMovement>();
        romeoMove = romeo.GetComponent<PlayerMovement>();
        //ghostRend = ghost.GetComponent<SpriteRenderer>();
        juliaMove.speed = speed;
        juliaMove.ready = false;
        romeoMove.ready = false;
        juliaAnim.SetBool("fleeing", true);
        paused = true;

        Coin c = new Coin { picked = false, 
            coin = (GameObject)Instantiate(pathObject, startPosition, transform.rotation),
            position = startPosition };
        path.Add(c);

        //SEt GUi
        startGUI.InitPosition();
    }
開發者ID:polusto,項目名稱:Love-Birds,代碼行數:27,代碼來源:LevelController.cs

示例9: HandleCoin

 public override void HandleCoin(Coin coin)
 {
     if (Math.Abs(coin.Weight - 9.5) < 0.02 && Math.Abs(coin.Diameter - 22.5) < 0.13)
         Debug.WriteLine("Captured £1");
     else if (_successor != null)
         _successor.HandleCoin(coin);
 }
開發者ID:FrUi7c4k3,項目名稱:PatternsAndPractices,代碼行數:7,代碼來源:OnePoundHandler.cs

示例10: Add

		public void Add(Coin c)
		{
			if (c.MatchID != Id)
			{
				c.MatchID = Id;
				Coins.Add(c);
			}
		}
開發者ID:mahnovsky,項目名稱:PT,代碼行數:8,代碼來源:Board.cs

示例11: OnEnable

 // Use this for initialization
 void OnEnable()
 {
     rb = GetComponent<Rigidbody> ();
     coinScript = transform.GetChild (0).GetComponent<Coin> ();
     coinScript.enabled = false;
     Launch ();
     Invoke ("Reenable", resetTime);
 }
開發者ID:ianburnette,項目名稱:IslandFox,代碼行數:9,代碼來源:seedSpawn.cs

示例12: Retrieve_WhenInsufficientFundsInWalletForGivenPar_ThenShouldThrowDoesNotHaveFundsException

        public void Retrieve_WhenInsufficientFundsInWalletForGivenPar_ThenShouldThrowDoesNotHaveFundsException(int parValue, int coinCount)
        {
            var coin = new Coin(parValue, coinCount);
            var inWalletCoinCount = new Random().Next(1, coinCount - 1);
            var inWalletCoin = new Coin(parValue, inWalletCoinCount);
            var wallet = new Wallet(new [] {inWalletCoin});

            Assert.Throws<InsufficientFundsWithParValueException>(() => wallet.Retrieve(coin));
        }
開發者ID:DrunkyBard,項目名稱:VendingMachine,代碼行數:9,代碼來源:WalletTests.cs

示例13: PropertyShouldBeAssigned

        public void PropertyShouldBeAssigned()
        {
            var regionInfo = new RegionInfo("RU-ru");
            var expectedDenomination = 1.2m;
            var coin = new Coin(expectedDenomination, regionInfo);

            Assert.AreEqual(expectedDenomination, coin.Denomination);
            Assert.AreEqual(regionInfo.ISOCurrencySymbol, coin.Currency);
        }
開發者ID:Bazaleev,項目名稱:VendingMachine,代碼行數:9,代碼來源:CointTests.cs

示例14: AddCoin

 internal void AddCoin(
     [PexAssumeUnderTest]CoinManager target,
     Coin coin,
     int ammount
 )
 {
     PexAssume.IsTrue(5 >= (int)coin && 0 <= (int)coin, "proper coin");
     target.AddCoin(coin, ammount);
 }
開發者ID:haljin,項目名稱:robust,代碼行數:9,代碼來源:CoinManagerTest.cs

示例15: EqualityAndInequalityShouldBeCheckedCorrectly

        public void EqualityAndInequalityShouldBeCheckedCorrectly()
        {
            var coin1 = new Coin(1);
            var coin2 = new Coin(1);

            Assert.IsTrue(coin1 == coin2);

            var coin3 = new Coin(2);
            Assert.IsTrue(coin1 != coin3);
        }
開發者ID:Bazaleev,項目名稱:VendingMachine,代碼行數:10,代碼來源:CointTests.cs


注:本文中的Coin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。