Example #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Debug.Log("Game Over");
         //xSpeed = 0;
         MainGameStateController.Restart();
         SceneManager.LoadScene(0, LoadSceneMode.Single);
     }
 }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag != "Player")
        {
            //EditorApplication.isPaused = true;
            MainGameStateController.Restart();

            SceneManager.LoadScene(0, LoadSceneMode.Single);
        }
    }
Example #3
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Collided");
        if (other.gameObject.CompareTag("Block"))
        {
            ySpeed = -ySpeed;
            Debug.Log("Collided with a block");
            Destroy(other.gameObject);
            Debug.Log(blocksContainer.childCount);
            if (blocksContainer.childCount == 1)
            {
                SceneManager.LoadScene(0, LoadSceneMode.Single);
            }
            //GetComponent<Renderer>().enabled = false;
            //GetComponent<BoxCollider>().enabled = false;
        }
        if (other.gameObject.CompareTag("Paddle"))
        {
            ySpeed = -ySpeed;
            xSpeed = other.GetComponent <PaddleScript>().xSpeed;
        }
        if (other.gameObject.CompareTag("Vertical Wall"))
        {
            Debug.Log("Bounce!");
            xSpeed = -xSpeed;
        }
        if (other.gameObject.CompareTag("Horizontal Wall"))
        {
            ySpeed = -ySpeed;
        }
        if (other.gameObject.CompareTag("Bottom"))
        {
            Debug.Log("Game Over");
            //xSpeed = 0;
            MainGameStateController.Restart();

            SceneManager.LoadScene(0, LoadSceneMode.Single);
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        float movement = Input.GetAxis("Horizontal");

        if (pauseTimer < 1f)
        {
            pauseTimer += Time.deltaTime;
        }
        else
        {
            //rb.velocity = new Vector3(movement * sideSpeed, rb.velocity.y, forwardSpeed);

            transform.position = transform.position + new Vector3(movement * sideSpeed, 0, forwardSpeed);

            if (transform.position.y < lossHeight)
            {
                Debug.Log("restarting");
                MainGameStateController.Restart();
                Debug.Log("exit restart");
                SceneManager.LoadScene(0, LoadSceneMode.Single);
            }
        }
    }
Example #5
0
 private void OnTriggerEnter(Collider other)
 {
     MainGameStateController.Restart();
     SceneManager.LoadScene(0, LoadSceneMode.Single);
 }