Exemple #1
0
 void PopulateInitialReferences()
 {
     // find the golf ball in the scene and save reference
     m_golfBall = GameObject.FindGameObjectWithTag("GolfBall").GetComponent <GolfBallScript>();
     if (m_golfBall == null)
     {
         Debug.LogWarning("Ball Not Found");
     }
     else
     {
         Debug.Log("Ball Found");
     }
 }
Exemple #2
0
    void Start()
    {
        GameObject[] UIObjs;

        ballScript = golfball.GetComponent <GolfBallScript>();
        ballBody   = golfball.GetComponent <Rigidbody>();
        curState   = SliderState.WAITING;

        UIObjs = GameObject.FindGameObjectsWithTag("UI");
        for (int i = 0; i < UIObjs.Length; i++)
        {
            if (UIObjs[i].name == "PowerSlider")
            {
                PowerSlider = UIObjs[i].GetComponent <Slider>();
            }

            if (UIObjs[i].name == "ClubName")
            {
                clubName = UIObjs[i].GetComponent <Text>();
            }
        }
    }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     myBallScript = GetComponentInParent <GolfBallScript>();
     myBody       = GetComponentInParent <Rigidbody>();
 }