Пример #1
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     // Checks if it has collided with a player.
     if (coll.gameObject.tag == "Player")
     {
         // Checks if the player has less than max health.
         if (coll.gameObject.GetComponent <PlayerHealth>().health < 3)
         {
             // Heals the player by the healAmount.
             coll.gameObject.GetComponent <PlayerHealth>().HealPlayer(healAmount);
             // The Item dissapears.
             JuiceBox.PopOut(gameObject);
             // Destroys the item after 3 seconds.
             Destroy(gameObject, 3f);
         }
     }
 }
Пример #2
0
    // A nice easy use of the PopOut function.
    // A juicy way to hide objects.
    // Note: does not delete the object.

    void OnMouseDown()
    {
        JuiceBox.PopOut(gameObject);
    }
Пример #3
0
    // The full version of PopOut, using all 4 options.
    // Control the duration of the pop, the delay before popping and the type of easing.

    void OnMouseDown()
    {
        JuiceBox.PopOut(gameObject, .6f, .5f, iTween.EaseType.easeOutBounce);
    }