Example #1
0
        void OnTriggerExit2D(Collider2D collision)
        {
            collision.transform.SetParent(null);
            if (collision.transform.CompareTag("Ball"))
            {
                --LeftBallCount;
                leftText.text = LeftBallCount.ToString();
            }
            if (collision.transform.CompareTag("AIBall"))
            {
                --RightBallCount;
                rightText.text = RightBallCount.ToString();
            }
            BasketBall basket = collision.GetComponent <BasketBall>();

            basket.SetActiveTraill(true);
        }
Example #2
0
        void OnTriggerEnter2D(Collider2D collision)
        {
            if (collision.transform.CompareTag("Ball"))
            {
                ++LeftBallCount;
                leftText.text = LeftBallCount.ToString();
                AudioManager.Instance.PlaySound(eSoundId.Score);
                goalInEffectPrefab.PlayEffect(collision.transform);
            }
            else if (collision.transform.CompareTag("AIBall"))
            {
                ++RightBallCount;
                rightText.text = RightBallCount.ToString();
                AudioManager.Instance.PlaySound(eSoundId.Score);
                goalInEffectPrefab.PlayEffect(collision.transform);
            }

            BasketBall basket = collision.GetComponent <BasketBall>();

            basket.SetActiveTraill(false);
        }