Ejemplo n.º 1
0
    private void Awake()
    {
        toSequence = new Rotator[balls.Length];
        for (int i = 0; i < toSequence.Length; i++)
        {
            BallData ball = balls[i];
            if (!ball)
            {
                Debug.LogErrorFormat("{0} of type {1} found a null reference in its ballsdata array index {2}!", this, this.GetType(), i);
                continue;
            }

            GameObject prefab = ball.GetBallPrefab();
            if (!prefab)
            {
                Debug.LogErrorFormat("{0} of type {1} found a null reference while attempting to get ball prefab from ballsdata array index {2}!", this, this.GetType(), i);
                continue;
            }

            Rotator rotator = GameObject.Instantiate(prefab, spawnsParent).AddComponent <Rotator>();
            rotator.gameObject.SetActive(false);
            rotator.SetValues(this.rotationSpeed, this.rotationAx);
            rotator.transform.localPosition = Vector3.zero;
            toSequence[i] = rotator;
        }
        if (!playerData || !currency)
        {
            Debug.LogErrorFormat("{0} of type {1} required PlayerData and CurrencyHolder valid references!", this, this.GetType());
            gameObject.SetActive(false);
        }
    }