コード例 #1
0
ファイル: Ball.cs プロジェクト: Mhendricks850/WallBall
    public void OnCollisionEnter2D(Collision2D col)
    {
        if (col.transform.name == "Top Border")
        {
            rb.velocity = new Vector2(0f, -10f);
            highscore.addPoints();
            AudioManager.instance.Play("Bounce");
        }
        else if (col.transform.name == "Bottom Border")
        {
            rb.velocity = new Vector2(0f, 10f);
            highscore.addPoints();
            AudioManager.instance.Play("Bounce");
        }

        if (col.gameObject.tag == "Enemy")
        {
            GameObject other = col.gameObject;
            //Destroy(other); <----- Destroy and Collect Points Mode
            highscore.ballisActive = false;
            shake.Camshake();
            camRipple.RippleEffect();
            AudioManager.instance.Play("Player Death");
            Gm.setDeath();
            Instantiate(explosion, transform.position, Quaternion.identity);
            //Deactivate this for Weird Physics Mode (Add Borders On all 4 sides)
            this.gameObject.SetActive(false);
        }
    }