private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("Enter"); if (collision.gameObject.tag == "Ball") { Debug.Log(collision.transform.position.x); if (collision.transform.position.x > this.transform.position.x) { //player 1 powerup Debug.Log("Player right"); //slowMo Code /* * Time.timeScale = 0.2f; */ Player2.transform.localScale += new Vector3(0.5f, 1f, 0.0f); player = 2; powerUpOn = true; } else { //player 2 powerup Debug.Log("Plyer Left"); //slowMo code //Time.timeScale = 0.2f; Player1.transform.localScale += new Vector3(0.5f, 1f, 0.0f); player = 1; powerUpOn = true; } collision.transform.localScale = new Vector3(2.0f, 2.0f, collision.transform.localScale.z); this.transform.position = new Vector3(30.0f, 30.0f, this.transform.position.z); ps.setStayTimer(10.0f); } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("Enter"); if (collision.gameObject.tag == "Ball") { Debug.Log(collision.transform.position.x); //player 2 powerup Debug.Log("Plyer Left"); //slowMo code //Time.timeScale = 0.2f; //do something Paddle.transform.localScale += new Vector3(1.5f, 0f, 0f); Debug.Log("powerup"); powerUpOn = true; collision.transform.localScale = new Vector3(2.0f, 2.0f, collision.transform.localScale.z); this.transform.position = new Vector3(50.0f, 50.0f, this.transform.position.z); ps.setStayTimer(10.0f); } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("Enter"); if (collision.gameObject.tag == "Ball") { Debug.Log(collision.transform.position.x); //player 2 powerup //slowMo code //Time.timeScale = 0.2f; //do something Debug.Log("powerup"); b.lives += 1; scoreText.text = "Lives : " + b.lives + " Score : " + score; powerUpOn = true; collision.transform.localScale = new Vector3(2.0f, 2.0f, collision.transform.localScale.z); this.transform.position = new Vector3(50.0f, 50.0f, this.transform.position.z); ps.setStayTimer(60.0f); } }