void Pickup(Collider collider) { // Create and destroy PowerUp effect GameObject effect = Instantiate(pickupEffect, transform.position, transform.rotation) as GameObject; Destroy(effect, 0.5f); // Get rid of the PowerUp for a few seconds transform.position = new Vector3(5000f, transform.position.y, 5000f); isPowerUpOnStage = false; nextPowerUpTime = Random.Range(30f, 100f) + Time.time; Vector3 position = collider.transform.position; if (this.gameObject.name == "Elephant") { if (collider.transform.localScale.x == 0.5f) { collider.transform.localScale = new Vector3(1f, 1f, 1f); collider.transform.position = new Vector3(position.x, 1f, position.z); } else { collider.transform.localScale = new Vector3(2f, 2f, 2f); collider.transform.position = new Vector3(position.x, 1.5f, position.z); } } if (this.gameObject.name == "Mouse") { if (collider.transform.localScale.x == 2f) { collider.transform.localScale = new Vector3(1f, 1f, 1f); collider.transform.position = new Vector3(position.x, 1f, position.z); } else { collider.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); collider.transform.position = new Vector3(position.x, 0.75f, position.z); } } if (this.gameObject.name == "Rabbit") { ball.setOriginalSpeed(ball.getOriginalSpeed() * 2); } if (this.gameObject.name == "Turtle") { ball.setOriginalSpeed(ball.getOriginalSpeed() / 2); } if (this.gameObject.name == "Giraffe") { if (ball.lastCollision == 1) { player1.localScale = new Vector3(5f, 1f, 1f); } if (ball.lastCollision == 2) { player2.localScale = new Vector3(5f, 1f, 1f); } } if (this.gameObject.name == "Monkey") { if (ball.lastCollision == 1) { computerAgent.CanShoot(); } if (ball.lastCollision == 2) { joybutton.Unhide(); } } }