Пример #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        PickupRespawn pickup = other.GetComponent <PickupRespawn> ();

        if (pickup == null)
        {
            return;
        }
        if (!pickup.active)
        {
            return;
        }
        pickup.SetAButton(true);
        if (other.GetComponent <AmmoPickup> () != null)
        {
            PickUpAmmo(pickup);
        }
        else if (other.GetComponent <PickupGun> () != null)
        {
            if (Input.GetButtonDown("aButton_" + playerTag.Id.ToString()))
            {
                PickUpWeapon(pickup);
            }
        }
    }
Пример #2
0
    void OnTriggerExit2D(Collider2D other)
    {
        PickupRespawn pickup = other.GetComponent <PickupRespawn> ();

        if (pickup == null)
        {
            return;
        }
        if (!pickup.active)
        {
            return;
        }
        pickup.SetAButton(false);
    }