Ejemplo n.º 1
0
    public void TakeDamage(int amount)
    {
        int hpLeft = _hp.DecreaseHealth(amount);

        if (_hp.isDead)
        {
        }
    }
Ejemplo n.º 2
0
    public int TakeDamage(int amount)
    {
        int hpLeft = _hp.DecreaseHealth(amount);

        if (_hp.isDead)
        {
            Dead();
        }

        return(hpLeft);
    }
    void Update()
    {
        if (topHealthManager && bottomHealthManager)
        {
            totalHealth = topHealthManager.GetHealth() + bottomHealthManager.GetHealth();

            if (!bottomHealthManager.IsVampireDead() && !topHealthManager.IsVampireDead())
            {
                // Transfer from top to bottom
                if (Input.GetKey(KeyCode.S))
                {
                    if ((topHealthManager.GetHealth() - transferStepAmount) >= 0)
                    {
                        topHealthManager.DecreaseHealth(transferStepAmount);
                        bottomHealthManager.GiveHealth(transferStepAmount);
                        topVa.PlaySound_Transfusion();
                    }
                }
                else
                {
                    topVa.StopTransfusionSound();
                }

                // Transfer from bottom to top
                if (Input.GetKey(KeyCode.DownArrow))
                {
                    if ((bottomHealthManager.GetHealth() - transferStepAmount) >= 0)
                    {
                        bottomHealthManager.DecreaseHealth(transferStepAmount);
                        topHealthManager.GiveHealth(transferStepAmount);
                        bottomVa.PlaySound_Transfusion();
                    }
                }
                else
                {
                    bottomVa.StopTransfusionSound();
                }
            }
            else
            {
                topVa.StopTransfusionSound();
                bottomVa.StopTransfusionSound();
            }
        }
        else
        {
            topHealthManager    = GameObject.Find("Top Vampire").GetComponent <HealthManager>();
            bottomHealthManager = GameObject.Find("Bottom Vampire").GetComponent <HealthManager>();
        }
    }
Ejemplo n.º 4
0
    public int TakeDamage(int amount)
    {
        int hpLeft = _hp.DecreaseHealth(amount);

        return(hpLeft);
    }