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(); } }
// 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 full version of Rattle. // Control the force and duration of the rattle. void OnMouseDown() { JuiceBox.Rattle(gameObject, 20, 1.8f); }