示例#1
0
    private void BallHit(GameObject ball, ContactPoint contactPoint)
    {
        if (ball == null)
        {
            return;
        }
        BallScripts ballScripts = ball.GetComponent <BallScripts>();

        if (ballScripts.Equals(null) || ballScripts.willExplode)
        {
            return;
        }
        gameManager.Score();
        ballScripts.ExplodeWithDelay(true);
        ballScripts.ReflectBallWithNormal(Vector3.right);
        ballScripts.DisableCollisionDetectionFor(.25f);
    }
    private void EndGame()
    {
        spawner.StopSpawning();
        startButton.gameObject.SetActive(true);
        soundButton.gameObject.SetActive(true);
        StartCoroutine(BlinkScore());

        GameObject[] balls = GameObject.FindGameObjectsWithTag("Ball");
        foreach (GameObject ball in balls)
        {
            if (ball == null)
            {
                continue;
            }
            BallScripts ballScript = ball.GetComponent <BallScripts>();
            if (ballScript.Equals(null))
            {
                return;
            }
            ballScript.ExplodeWithDelay(false);
        }

        adScripts.ShowInterstitial();
    }