Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CollectableObject : MonoBehaviour
- {
- public float amountGained = 10f;
- public GameObject collectionParticles;
- // Start is called before the first frame update
- void Start()
- {
- myAudioSource = GetComponent<AudioSource>();
- }
- void OnTriggerEnter2D(Collider2D other)
- {
- if (other.gameObject.tag == "Player")
- {
- Instantiate(collectionParticles, transform.position, Quaternion.identity);
- NewBehaviourScript1.healf += amountGained;
- Destroy(this.gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement