void OnCollisionStay2D(Collision2D other) { CharacterMovement2_5b sonny = other.gameObject.GetComponent <CharacterMovement2_5b>(); if (sonny != null) { sonny.ChangeHealth(-1); } }
void OnTriggerEnter2D(Collider2D other) { CharacterMovement2_5b sonny = other.GetComponent <CharacterMovement2_5b>(); if (sonny != null) { sonny.getGun(); Destroy(this.gameObject); } }
void OnCollisionEnter2D(Collision2D other) { CharacterMovement2_5b sonny = other.collider.GetComponent <CharacterMovement2_5b>(); if (sonny != null) { sonny.ChangeHealth(-1); } Destroy(gameObject, despawnTime); }
public void GiveItemToPlayer() { Debug.Log("Give TIem To PLayer"); CharacterMovement2_5b inventoryUI = TargetPlayer.GetComponent <CharacterMovement2_5b>(); if ((inventoryUI != null) && (itemonPedestal)) { // inventoryUI.inventoryItems.Add(giftItem); inventoryUI.hasEgg = true; itemonPedestal = false; displayItem.SetActive(false); } Debug.Log("Giving"); }