- Home /
Question about Point adding / Destroying after collision.
So what I'm trying to do is make my player game object destroy objects of identicle or lower mass. I've managed to Destroy ANY objects but I cannot figure out how to add points upon destroying, or how to prevent destruction of higher mass objects. Here's my code that I've been using to destroy objects.
using UnityEngine;
using System.Collections;
public int score = 0;
public class DestroyEnemy : MonoBehaviour {
void OnTriggerEnter(Collider Player) {
//THIS IS WHERE I"M STUMPED. Pseudo code: if Player Hits gameObject, do the following...//
Destroy(gameObject);
score = score + 1; // ?????? Maybe?
}
}
**PS, I also am attempting to Add to my players mass upon enemy destruction if you have any tips about that too!
Comment