void OnTriggerEnter() { // enter log UiLog.Log(message); AudioSource.PlayClipAtPoint(secretSound, transform.position); Destroy(gameObject); }
public void Pickup(Transform player) { var isConsumed = false; var inventory = player.GetComponentInChildren <FpsInventory>(); var weaponSlot = inventory.GetSlot(slot); if (!weaponSlot.obtained) { // obtain new weapon inventory.Obtained(slot); isConsumed = true; } if (weaponSlot.weaponInterface.CanReload()) { // give ammo weaponSlot.weaponInterface.Reload(ammo); isConsumed = true; } if (isConsumed) { // enter log UiLog.Log(pickupLog); AudioSource.PlayClipAtPoint(pickupSound, transform.position); Destroy(gameObject); } }
public void Pickup(Transform player) { door.Unlock(); // enter log UiLog.Log(pickupLog); AudioSource.PlayClipAtPoint(pickupSound, transform.position); Destroy(gameObject); }
public void Pickup(Transform player) { var health = player.GetComponentInChildren <Health>(); if (health.CanHeal()) { AudioSource.PlayClipAtPoint(pickupSound, transform.position); // give hit points health.Heal(hitPoints); // enter log UiLog.Log(pickupLog); Destroy(gameObject); } }
public void Pickup(Transform player) { var inventory = player.GetComponentInChildren <FpsInventory>(); var weaponSlot = inventory.weaponSlots.Where(s => s.slot == slot).First(); if (weaponSlot.weaponInterface.CanReload()) { AudioSource.PlayClipAtPoint(pickupSound, transform.position); // give ammo weaponSlot.weaponInterface.Reload(ammo); // enter log UiLog.Log(pickupLog); Destroy(gameObject); } }
void OnTriggerEnter(Collider co) { if (locked) { // enter log UiLog.Log(pickupLog); aud.PlayOneShot(lockedSound); return; } colliders.Add(co); if (!open) { open = true; aud.PlayOneShot(openSound); foreach (var anim in anims) { anim.SetTrigger("open"); } } }