Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (timepassed > 0.0f)
     {
         timepassed -= Time.deltaTime;
         timer.ChangeAmount(type, 1);     //add the amount of health boost
                                          //Debug.Log("You changed the inital amount +10");
         timer.type        = type;        //tell the timer what type of powerup it is
         timer.TimerActive = TimerActive; //set the timer to the number of seconds
         if (timer.playerstats.health > 100)
         {
             failed = 1;
         }
     }
     else
     {
         if (failed == 1)
         {
             Debug.Log("Failed the test. Exceeded max player value");
         }
         else
         {
             Debug.Log("Passed the test. Didnot exceed max player  value.");
         }
         Destroy(gameObject); //destory the object
     }
 }
Esempio n. 2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player" && collided == 0) //if collides with player (and hasn't already)
     {
         collided    = 1;
         TimerActive = 10.0f;             //set the timer variable to the number of seconds for the powerup
         Debug.Log("Hit the player");
         timer.ChangeAmount(type, 1);     //add the amount of health boost
         Debug.Log("You changed the inital amount +10");
         timer.type        = type;        //tell the timer what type of powerup it is
         timer.TimerActive = TimerActive; //set the timer to the number of seconds
         Destroy(gameObject);             //destory the object
     }
 }