Example #1
0
 void OnTriggerEnter(Collider c)
 {
     if (c.tag.Equals("Healthpack"))
     {
         health.Add(Healthpack.HEALTH_GIVEN);
         MainCanvas.Instance.UpdateHealth();
         c.gameObject.GetComponent <Healthpack>().Reset();
     }
     if (c.tag.Equals("AmmoBox"))
     {
         rifle.AddAmmo(AmmoBox.AMMO_GIVEN);
         MainCanvas.Instance.playerHUDScript.SetAmmoText("" + rifle.Ammo);
         c.gameObject.GetComponent <AmmoBox>().Reset();
     }
 }
Example #2
0
    void OnTriggerEnter(Collider c)
    {
        if (personality != null)
        {
            personality.OnTriggerEnter(c);
        }

        if (c.gameObject.tag.Equals("AmmoBox"))
        {
            rifle.AddAmmo(AmmoBox.AMMO_GIVEN);
            c.gameObject.GetComponent <AmmoBox>().Reset();
        }

        if (c.gameObject.tag.Equals("Healthpack"))
        {
            health.Add(Healthpack.HEALTH_GIVEN);
            c.gameObject.GetComponent <Healthpack>().Reset();
            Diagnostic.Instance.UpdateHealth(gameObject, health.GetHealth());
        }
    }