Ejemplo n.º 1
0
    public void AddMoneyTest()
    {
        var moreMoney = 10;

        model.AddMoney(moreMoney);
        Assert.AreEqual((startingMoney + moreMoney), model.GetMoney());
    }
Ejemplo n.º 2
0
    public void SellTurret()
    {
        var turret = nodeToBuildOn.GetTurret();

        playerMoney.AddMoney(turret.GetComponent <TurretConfig> ().sellPrice);
        worker.SellTurret(nodeToBuildOn, turret);
    }
Ejemplo n.º 3
0
    public void Earn(GameObject player)
    {
        PlayerMoney playerMoney = player.GetComponent <PlayerMoney>();

        if (playerMoney)
        {
            playerMoney.AddMoney(moneyAmount);
        }
    }
Ejemplo n.º 4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        int indexMetal = Mathf.RoundToInt(UnityEngine.Random.Range(1f, 3f));

        int   gainMoney  = Mathf.RoundToInt(UnityEngine.Random.Range(5f, 15f));
        float gainEnergy = UnityEngine.Random.Range(1f, 3f);

        if (collision.tag == "Player")
        {
            switch (objet.gainType)
            {
            case ObjectClass.GainType.MONEY:
                PlayerMoney pm = collision.gameObject.GetComponent <PlayerMoney>();
                if (indexMetal == 1)
                {
                    anim.SetBool("scrap1", true);
                    anim.SetBool("scrap2", false);
                    anim.SetBool("scrap3", false);
                }
                else
                {
                    if (indexMetal == 2)
                    {
                        anim.SetBool("scrap1", false);
                        anim.SetBool("scrap2", true);
                        anim.SetBool("scrap3", false);
                    }
                    else
                    {
                        if (indexMetal == 3)
                        {
                            anim.SetBool("scrap1", false);
                            anim.SetBool("scrap2", false);
                            anim.SetBool("scrap3", true);
                        }
                    }
                }
                pm.AddMoney(gainMoney);
                break;

            case ObjectClass.GainType.ENERGY:
                PlayerRage pr = collision.gameObject.GetComponent <PlayerRage>();
                pr.AddEnergy(gainEnergy);
                break;

            case ObjectClass.GainType.ARMOR:
                PlayerUI pui = collision.gameObject.GetComponent <PlayerUI>();
                pui.previousShield = 0;
                break;
            }

            Destroy(gameObject, 0.5f);
        }
    }
Ejemplo n.º 5
0
    public void TakeDamage(int damage)
    {
        health -= damage;
        if (health < 0)
        {
            //敌人死亡
            //......

            //增加玩家金钱
            playerMoney.AddMoney(enemyVal);
        }
    }
Ejemplo n.º 6
0
 // Insert in these three function the scrap cost
 public void AddArmor(int amount)
 {
     playerLife.IncreaseArmor(amount, true);
     playerInventory.AddMoney(-addArmorCost);
 }
Ejemplo n.º 7
0
    public void DoubleMoneyWon()
    {
        _playerMoney.AddMoney(_totalReward * 2);

        _menu.ShowCompletePanel(true, _currentLevel - 1, rewardAmount: _totalReward * 3);
    }