当前位置: 首页>>代码示例>>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;未经允许,请勿转载。