Esempio n. 1
0
    void DestroyBall()
    {
        GameObject  elasticRopeGameObj = GameObject.FindGameObjectWithTag("Chain");
        ElasticRope rope = elasticRopeGameObj.GetComponent <ElasticRope>();
        GameObject  ball = rope.endPoint;

        rope.DisconnectRope();
        ropeCutSound.Play();
        alienSavedSound.Play();
        Destroy(ball);
        Destroy(rope);

        TransporterLevelGM.instance.checkWinCondition();
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Ball")
        {
            if (GameManagerScript.instance.playerWithBall != -1)
            {
                GameObject  elasticRopeGameObj = GameObject.FindGameObjectWithTag("Chain");
                ElasticRope rope = elasticRopeGameObj.GetComponent <ElasticRope>();
                rope.DisconnectRope();
            }

            GameManagerScript.instance.ScoreGoal(scorerPlayer);

            ParticleHelperScript.Instance.Explosion(other.gameObject.GetComponent <Rigidbody2D>().position, scorerPlayer);
            GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>().shakeDuration = 0.25f;

            // Destroy(other.gameObject);
        }
    }