示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         PlayerModel.ChangeNumberOfCoins(1);
         Destroy(gameObject);
     }
 }
示例#2
0
 public void BuyGrenade()
 {
     if (PlayerModel.Coins < grenadePrice)
     {
         return;
     }
     PlayerModel.ChangeNumberOfGrenades(1);
     PlayerModel.ChangeNumberOfCoins(-grenadePrice);
 }
示例#3
0
 public void BuyFirstAidKit()
 {
     if (PlayerModel.Coins < firstAidKitPrice)
     {
         return;
     }
     PlayerModel.ChangeNumberOfFirstAidKits(1);
     PlayerModel.ChangeNumberOfCoins(-firstAidKitPrice);
 }
示例#4
0
    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);
    }
示例#5
0
    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);
    }
示例#6
0
    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);
    }
示例#7
0
    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);
    }