c-pid

Untitled

Mar 1st, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. public class KillGhostAfterPowerUp : MonoBehaviour {
  2.             public bool killCommand = false;
  3.         public float startingTime = 0f;
  4.             private float powerUpExpireTime = 2f;
  5.             private float powerTimer = 0;
  6.             void OnCollisionEnter2D (Collision2D other){
  7.                     if (killCommand == true) {
  8.                             if (other.gameObject.name == "Ghost") {
  9.                                     Destroy (other.gameObject);
  10.                             }else if(time.time - startingTime > powerUpExpireTime){
  11.                                     killCommand = false;
  12.                             }
  13.                     }
  14.             }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment