Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<GameObject> targets;
- int targetMax=3;
- OnTriggerEnter(collider c){
- if(targets.Count<targetMax && !targets.Contains(c.gameObject))
- targets.add(c.gameObject);
- }
- OnTriggerExit(collider c){
- if(targets.Contains(c.gameObject))
- targets.remove(c.gameObject);
- }
- Update(){
- //fire on enemies
- foreach(GameObject go in targets){
- Shoot(go);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement