Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KillGhostAfterPowerUp : MonoBehaviour {
- public bool killCommand = false;
- public float startingTime = 0f;
- private float powerUpExpireTime = 2f;
- private float powerTimer = 0;
- void OnCollisionEnter2D (Collision2D other){
- if (killCommand == true) {
- if (other.gameObject.name == "Ghost") {
- Destroy (other.gameObject);
- }else if(time.time - startingTime > powerUpExpireTime){
- killCommand = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment