Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     //if (other.CompareTag("Player"))
     //{
     //    // spawn the sun button at the first available inventory slot !
     //    for (int i = 0; i < inventory.slots.Length; i++)
     //    {
     //        if (inventory.isFull[i] == false)
     //        { // check whether the slot is EMPTY
     //            inventory.isFull[i] = true; // makes sure that the slot is now considered FULL
     //            inventory.destroyedObj[inventory.numberOfDestroyedObj] = gameObject.name;
     //            inventory.numberOfDestroyedObj++;
     //            Instantiate(itemButton, inventory.slots[i].transform, false); // spawn the button so that the player can interact with it
     //            Destroy(gameObject);
     //            break;
     //        }
     //    }
     //}
     HealthPointManager.AddHealthPoints(healthPointsToAdd);
     Destroy(gameObject);
 }
Beispiel #2
0
 public void Use()
 {
     HealthPointManager.AddHealthPoints(healthPointsToAdd);
     Destroy(gameObject);
 }