Example #1
0
    public override void action(Collider col)
    {
        RefToPlayer playerRef = col.gameObject.GetComponent <RefToPlayer> ();

        if (playerRef != null)
        {
            HP playerHp = playerRef.player.GetComponent <HP> ();
            if (playerHp != null)
            {
                playerHp.hp += amount;
            }
        }
    }
Example #2
0
    public override void action(Collider col)
    {
        RefToPlayer playerRef = col.gameObject.GetComponent <RefToPlayer> ();

        if (playerRef != null)
        {
            M4A1Controller wb = playerRef.player.GetComponentInChildren <M4A1Controller> ();
            if (wb != null)
            {
                Amunition ammo = wb.getAmmo();
                ammo.reserve += amount;
                wb.setAmmo(ammo);
            }
        }
    }