// Use this for initialization
    void Start()
    {
        if (catchZoneObject != null)
        {
            CatchZone   = GameObject.FindWithTag(catchZoneObject);
            catchScript = CatchZone.GetComponent <CatchBall_Test> ();
        }
        CatchBall_Test.onBallCaught           += OnBallCaught;
        KickZone.onBallKicked                 += OnBallKicked;
        ScrumHalfDestructor.onScrumHalf_Awake += HandleonScrumHalf_Awake;
        ThrowBall_Test.onBallThrown           += HandleonBallThrown;

        GameObject spawnPointCollection = GameObject.FindWithTag("SpawnPoints");

        ScrumHalfPositionPoints = spawnPointCollection.GetComponentsInChildren <Transform>();
        print(ScrumHalfPositionPoints.Length);
        //ScrumHalfPositions.Length = ScrumHalfPositionPoints.Length - 1;
        for (int i = 1; i < ScrumHalfPositionPoints.Length; i++)        // start i at 1 because the spawn collection includes the parent
        {
            print(ScrumHalfPositionPoints[i].name);
            //ScrumHalfPositions[i-1] = ScrumHalfPositionPoints[i].transform.position;
        }
        timerText      = timerUI.GetComponent <Text>();
        timerText.text = "";
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        //PrefabSpawner.onScrumhalfSpawned += ScrumHalfSpawned;
        //PrefabSpawner.onScrumhalfDestroyed += ScrumHalfDestroyed;

        CatchBall_Test.onKickBallSpawned += KickBallSpawned;

        if (catchBallObject != null)
        {
            CatchBall   = GameObject.FindWithTag(catchBallObject);
            catchScript = CatchBall.GetComponent <CatchBall_Test> ();
        }

        swipeScript = gameObject.GetComponent <SwipeDetector> ();
        hasKicked   = false;
    }