本文整理汇总了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);
}
示例2: getAndRemoveCoin
void getAndRemoveCoin(Coin coin)
{
this.coinGain += coin.price;
AudioSource.PlayClipAtPoint (coinSound, transform.position);
Destroy (coin.gameObject);
}
示例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);
}
示例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 ();
}
示例5: PutCoin
public void PutCoin(Coin coin)
{
if (!Stock.ContainsKey(coin))
Stock[coin] = 1;
else
++Stock[coin];
}
示例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);
}
}
}
示例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);
}
示例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();
}
示例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);
}
示例10: Add
public void Add(Coin c)
{
if (c.MatchID != Id)
{
c.MatchID = Id;
Coins.Add(c);
}
}
示例11: OnEnable
// Use this for initialization
void OnEnable()
{
rb = GetComponent<Rigidbody> ();
coinScript = transform.GetChild (0).GetComponent<Coin> ();
coinScript.enabled = false;
Launch ();
Invoke ("Reenable", resetTime);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}