private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { PlayerModel.ChangeNumberOfCoins(1); Destroy(gameObject); } }
public void BuyGrenade() { if (PlayerModel.Coins < grenadePrice) { return; } PlayerModel.ChangeNumberOfGrenades(1); PlayerModel.ChangeNumberOfCoins(-grenadePrice); }
public void BuyFirstAidKit() { if (PlayerModel.Coins < firstAidKitPrice) { return; } PlayerModel.ChangeNumberOfFirstAidKits(1); PlayerModel.ChangeNumberOfCoins(-firstAidKitPrice); }
public void BuyShotgun() { if (PlayerModel.Coins < shotgunPrice || isShotgunBought) { return; } var gameObject = new GameObject(); Shotgun shotgun = gameObject.AddComponent <Shotgun>(); shotgun.Unlock(); isShotgunBought = true; PlayerModel.ChangeNumberOfCoins(-shotgunPrice); }
public void BuyFlamethrower() { if (PlayerModel.Coins < flamethrowerPrice || isFlamethrowerBought) { return; } var gameObject = new GameObject(); Flamethrower rifle = gameObject.AddComponent <Flamethrower>(); rifle.Unlock(); isFlamethrowerBought = true; PlayerModel.ChangeNumberOfCoins(-flamethrowerPrice); }
public void BuyAR() { if (PlayerModel.Coins < arPrice || isARBought) { return; } var gameObject = new GameObject(); AssaultRifle ar = gameObject.AddComponent <AssaultRifle>(); ar.Unlock(); isARBought = true; PlayerModel.ChangeNumberOfCoins(-arPrice); }
public void BuyRifle() { if (PlayerModel.Coins < riflePrice || isRifleBought) { return; } var gameObject = new GameObject(); Rifle rifle = gameObject.AddComponent <Rifle>(); rifle.Unlock(); isRifleBought = true; PlayerModel.ChangeNumberOfCoins(-riflePrice); }