-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
add asteroid field and collision for firing
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class AsteroidCollison : MonoBehaviour | ||
{ | ||
[SerializeField] private GameObject asteroidExplosion; | ||
public void OnCollisionEnter(Collision collision) | ||
{ | ||
if (collision.gameObject.tag == "Asteroid") | ||
{ | ||
Destroy(collision.gameObject); | ||
|
||
Instantiate(asteroidExplosion, collision.transform.position, collision.transform.rotation); | ||
|
||
Destroy(gameObject); | ||
} else { | ||
Destroy(gameObject); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class AsteroidKillzone : MonoBehaviour | ||
{ | ||
|
||
public void OnTriggerEnter(Collider other) | ||
{ | ||
if (other.gameObject.tag == "Asteroid") | ||
{ | ||
Destroy(other.gameObject); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.