示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            //access the player
            Ball golfBall = other.GetComponent <Ball>();
            if (golfBall != null)
            {
                if (_powerUpID == 0)
                {
                    //Increase force limit
                    hitManager.IncreaseForce();
                    StartCoroutine(SpeedCountDownRoutine());
                }
                else if (_powerUpID == 1)
                {
                    //Transport next to the end hole
                    golfBall.TransportToTheEnd();
                }
                else if (_powerUpID == 2)
                {
                    SwapPlayersPositions();
                }
            }

            //destroy the power up
            Destroy(this.gameObject);
        }
    }