Example #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Bad Guy" && Game_Manager.playing)
     {
         Game_Manager.playing = false;
         StartCoroutine(Game_Manager.EndGame(true));
     }
 }
Example #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!collision.GetComponent <Bullet>())
     {
         if (collision.tag == "Good Guy" && collision.gameObject.name == "Good Guy" && Game_Manager.playing)
         {
             Game_Manager.playing = false;
             StartCoroutine(Game_Manager.EndGame(false));
         }
         else if (collision.tag == "Bad Guy" && collision.gameObject.name == "Bad Guy" && Game_Manager.playing)
         {
             Game_Manager.playing = false;
             StartCoroutine(Game_Manager.EndGame(true));
         }
     }
 }
Example #3
0
    void OnCollisionEnter(Collision collision)
    {
        switch (collision.transform.name)
        {
        case "Right Bounding Wall":
        case "Left Bounding Wall":
            //play the bounce sounnd
            source.PlayOneShot(clips[0]);

            // When hitting bounding walls ball will go opposite direction it was going
            velocity.x *= -1f;
            return;

        case "Player Score Wall":
        case "Opp Score Wall":
            //play the bounce sounnd
            source.PlayOneShot(clips[1]);
            ResetBall();
            //Invoke("ResetBall", 3);
            //gameObject.SetActive(false);
            //logicManager.BallResetCountdown();
            logicManager.score(collision.transform.name);
            Debug.Log("Point Scored");
            if (logicManager.ai_score >= 11)
            {
                gameManager.EndGame();
                //return;
            }

            /* We decided for player to keep playing so they can achieve a high score
             * else if (logicManager.player_score >=11)
             * {
             *  gameManager.EndGame();
             * }
             */
            return;

        case "Player Paddle":
        case "Opp Paddle":
            //play the bounce sounnd
            source.PlayOneShot(clips[0]);
            velocity.z *= -1f;
            return;
        }
    }
Example #4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Destroy Bullets")
        {
            GetComponent <Rigidbody2D>().velocity = new Vector3();

            moving = false;

            GetComponent <Animator>().Play("Bullet Break");

            BlackHole.rbs.Remove(GetComponent <Rigidbody2D>());

            enabled = false;

            Invoke("kill", .05f);
        }
        else if (collision.tag == "Good Guy" && collision.gameObject.name == "Good Guy" && Game_Manager.playing && collision.transform.parent.GetComponent <GoodGuy>())
        {
            Game_Manager.playing = false;
            StartCoroutine(Game_Manager.EndGame(false));
        }
    }