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); } } }
void OnTriggerExit2D(Collider2D other) { PickupRespawn pickup = other.GetComponent <PickupRespawn> (); if (pickup == null) { return; } if (!pickup.active) { return; } pickup.SetAButton(false); }