• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Coin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Coin的典型用法代码示例。如果您正苦于以下问题:C# Coin类的具体用法?C# Coin怎么用?C# Coin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Coin类属于命名空间,在下文中一共展示了Coin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SpendCoin

		public void SpendCoin(Coin coin)
		{
			ExecuteInTransation(() =>
			{
				lock (_objLock)
				{
					Coins.Spend(new[] { new CoinBatch(coin.Value, 1) });
				}
			});
		}
开发者ID:pkuderov,项目名称:vending-machine,代码行数:10,代码来源:User.cs


示例17: Validate

        public static bool Validate(Coin coin)
        {
            for (int i = 0; i < ValidCoins.Length; i++)
            {
                if (ValidCoins[i] == coin.value)
                    return true;
            }

            return false;
        }
开发者ID:rokn,项目名称:HackBulgaria,代码行数:10,代码来源:Coin.cs


示例18: TakeCoin

        public Coin TakeCoin(Coin coin)
        {
            if (CustomerDeposit < (int)coin)
                throw new InsufficientFundsException();

            var taken = _balance.TakeCoin(coin);
            CustomerDeposit -= (int)coin;

            return taken;
        }
开发者ID:shmeleva,项目名称:University-Projects,代码行数:10,代码来源:VendingMachineBalance.cs


示例19: SpendCoin

		public Transaction SpendCoin(Coin coin, Script scriptPubKey, Money value)
		{
			var tx = new Transaction();
			tx.Inputs.Add(new TxIn(coin.Outpoint));
			tx.Outputs.Add(new TxOut(value, scriptPubKey));
			tx.Outputs.Add(new TxOut(coin.Amount - value, coin.ScriptPubKey));
			var h = tx.GetHash();
			Mempool.Add(h, tx);
			OnNewTransaction(tx);
			return tx;
		}
开发者ID:vebin,项目名称:NBitcoin,代码行数:11,代码来源:spv_tests.cs


示例20: WhenInitializeWalletWithRepeatedParValueCoins_ThenWalletShouldContainSumCoinsForGivenParValue

        public void WhenInitializeWalletWithRepeatedParValueCoins_ThenWalletShouldContainSumCoinsForGivenParValue(
            Coin[] inputCoins,
            Coin[] expectedCoins)
        {
            var wallet = new Wallet(inputCoins);

            foreach (var actualCoin in wallet.ShowCoins())
            {
                Assert.True(expectedCoins.Count(c => c.ParValue == actualCoin.ParValue && c.Count == actualCoin.Count) == 1);
            }
        }
开发者ID:DrunkyBard,项目名称:VendingMachine,代码行数:11,代码来源:WalletTests.cs



注:本文中的Coin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CollSeq类代码示例发布时间:2022-05-24
下一篇:
C# Codon类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap