Beispiel #1
0
    public override bool Apply(GameObject p)
    {
        TankHealth h = p.GetComponent <TankHealth>();

        if (h)
        {
            h.AddHealth(amount);
        }
        Hide();
        return(true);
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            if (other.GetComponent <TankController>())
            {
                TankHealth tankHealth = other.GetComponent <TankHealth>();
                tankHealth.AddHealth(healthValue);
            }

            NetworkServer.Destroy(gameObject);
            PowerUpsManager.Instance.RemovePowerUp(gameObject);
        }
    }
Beispiel #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Pick Up"))
        {
            other.gameObject.SetActive(false);
            TankHealth targetHealth = gameObject.GetComponent <TankHealth> ();

            targetHealth.AddHealth();
        }

        if (other.gameObject.CompareTag("Pick Down"))
        {
            other.gameObject.SetActive(false);
            TankHealth targetHealth = gameObject.GetComponent <TankHealth> ();

            targetHealth.SubHealth();
        }
    }
Beispiel #4
0
    /// <summary>
    /// Acts as a med pack for the player, recovers lost health and caps at their max health
    /// </summary>
    private void BonusHealth()
    {
        TankHealth th = _rb.GetComponent <TankHealth>();

        if (th.GetHealth() == th.m_StartingHealth)
        {
            return;
        }

        th.AddHealth(_healthAdd);
        if (th.GetHealth() > th.m_StartingHealth)
        {
            th.SetHealth(th.m_StartingHealth);
        }
        th.SetHealthUI();

        Destroy(gameObject);
    }