void OnCollisionEnter2D() { JuiceBox.Rattle(door); Destroy(door, 0.6f); JuiceBox.Rattle(door2); Destroy(door2, 0.6f); JuiceBox.Wobble(View, 0.5f); Destroy(gameObject); }
public void DamagePlayer(int damageAmount) { // Checks if the health is more than 0. if (health > 0) { // Rattles the camera. JuiceBox.Rattle(Camera.main.gameObject, rattlePower, rattleTime); // Damages the player by the damageAmount. health = health - damageAmount; // Updates the Health GUI. UpdateHealth(); } }
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); } } }
// A nice easy use of the Rock function. // Rocking objects will rotate endlessly back and forth (Z-axis only). void Start() { JuiceBox.Rock(gameObject); }
// A nice easy use of the Wobble function. // A good way to show an object was bumped/clicked/etc. void OnMouseDown() { JuiceBox.Wobble(gameObject); }
// A more customisable version of Jiggle. // Control the force of the jiggle by changing the number. void OnMouseDown() { JuiceBox.Jiggle(gameObject, .3f); }
// 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); }
// A more customisable version of Rock. // Control the angle and duration. void Start() { JuiceBox.Rock(gameObject, 15, .4f); }
// A nice easy use of the Rattle function. // A good way to show an object was bumped/clicked/etc. void OnMouseDown() { JuiceBox.Rattle(gameObject); }
// A more customisable version of PopIn. // Control the duration of the pop by changing the number. void Start() { JuiceBox.PopIn(gameObject, 2f); }
// The full version of PopIn, using all 4 options. // Control the duration of the pop, the delay before popping and the type of easing. void Start() { JuiceBox.PopIn(gameObject, .6f, 1, iTween.EaseType.easeOutBack); }
// A full version of Rattle. // Control the force and duration of the rattle. void OnMouseDown() { JuiceBox.Rattle(gameObject, 20, 1.8f); }
// A full version of Rock. // Control the angle, duration and easing of the rocking. void Start() { JuiceBox.Rock(gameObject, 20, .6f, iTween.EaseType.linear); }
// 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); }