Esempio n. 1
0
    private void FindObjects()
    {
        Transform child;

        for (int i = 0; i < transform.childCount; i++)
        {
            child = transform.GetChild(i);
            switch (child.name)
            {
            case "LaserContainer":
                _laserManager = child.gameObject.GetComponent <LaserManager>();
                break;

            case "EnemyContainer":
                _enemyManager = child.gameObject.GetComponent <EnemyManager>();
                break;

            case "PUContainer":
                _powerUpManager = child.gameObject.GetComponent <PU_Manager>();
                break;

            case "ObjectContainer":
                _objectManager = child.gameObject.GetComponent <ObjectManager>();
                break;

            default:
                Debug.LogWarning("There is an unrecognized child of Spawn Manager.");
                break;
            }
        }
        _audio_Background = GetComponent <AudioSource>();

        CheckObjects();
    }
Esempio n. 2
0
    protected override void Start()
    {
        Transform PU_Container = transform.parent;

        if (PU_Container == null)
        {
            Debug.LogError("Power Up could not locate its parent.");
            _isChildOfManager = false;
        }
        else
        {
            _PU_Manager = PU_Container.GetComponent <PU_Manager>();
            if (_PU_Manager == null)
            {
                Debug.LogError("Power Up could not locate its Manager on the parent.");
                _isChildOfManager = false;
            }
        }

        base.Start();
    }