Ejemplo n.º 1
0
        void Awake()
        {
            Time.fixedDeltaTime = timeStep;

            instance = this;
            thisT    = transform;

            ObjectPoolManager.Init();

            NodeGenerator nodeGenerator = (NodeGenerator)FindObjectOfType(typeof(NodeGenerator));

            if (nodeGenerator != null)
            {
                nodeGenerator.Awake();
            }
            PathFinder pathFinder = (PathFinder)FindObjectOfType(typeof(PathFinder));

            if (pathFinder != null)
            {
                pathFinder.Awake();
            }

            PathTD[] paths = FindObjectsOfType(typeof(PathTD)) as PathTD[];
            if (paths.Length > 0)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    paths[i].Init();
                }
            }

            TDTK.InitDB();

            ResourceManager rscManager = (ResourceManager)FindObjectOfType(typeof(ResourceManager));

            if (rscManager != null)
            {
                rscManager.Init();
            }

            PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager));

            if (perkManager != null)
            {
                perkManager.Init();
            }

            BuildManager buildManager = (BuildManager)FindObjectOfType(typeof(BuildManager));

            if (buildManager != null)
            {
                buildManager.Init();
            }

            AbilityManager abilityManager = (AbilityManager)FindObjectOfType(typeof(AbilityManager));

            if (abilityManager != null)
            {
                abilityManager.Init();
            }

            FPSControl fpsControl = (FPSControl)FindObjectOfType(typeof(FPSControl));

            if (fpsControl != null)
            {
                fpsControl.Init();
            }

            IndicatorControl indicatorControl = (IndicatorControl)FindObjectOfType(typeof(IndicatorControl));

            if (indicatorControl != null)
            {
                indicatorControl.Init();
            }


            //if(loadAudioManager){
            //	Instantiate(Resources.Load("AudioManager", typeof(GameObject)));
            //}

            Time.timeScale = 1;
        }
Ejemplo n.º 2
0
        void Awake()
        {
            Time.fixedDeltaTime = timeStep;

            instance = this;
            thisT    = transform;

            ObjectPoolManager.Init();

            BuildManager buildManager = (BuildManager)FindObjectOfType(typeof(BuildManager));

            if (buildManager != null)
            {
                buildManager.Init();
            }

            NodeGenerator nodeGenerator = (NodeGenerator)FindObjectOfType(typeof(NodeGenerator));

            if (nodeGenerator != null)
            {
                nodeGenerator.Awake();
            }
            PathFinder pathFinder = (PathFinder)FindObjectOfType(typeof(PathFinder));

            if (pathFinder != null)
            {
                pathFinder.Awake();
            }

            PathTD[] paths = FindObjectsOfType(typeof(PathTD)) as PathTD[];
            if (paths.Length > 0)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    paths[i].Init();
                }
            }

            if (buildManager != null)
            {
                for (int i = 0; i < buildManager.buildPlatforms.Count; i++)
                {
                    buildManager.buildPlatforms[i].Init();
                }
            }

            gameObject.GetComponent <ResourceManager>().Init();

            PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager));

            if (perkManager != null)
            {
                perkManager.Init();
            }

            if (loadAudioManager)
            {
                Instantiate(Resources.Load("AudioManager", typeof(GameObject)));
            }

            if (rangeIndicator)
            {
                rangeIndicator        = (Transform)Instantiate(rangeIndicator);
                rangeIndicator.parent = thisT;
                rangeIndicatorObj     = rangeIndicator.gameObject;
            }
            if (rangeIndicatorCone)
            {
                rangeIndicatorCone        = (Transform)Instantiate(rangeIndicatorCone);
                rangeIndicatorCone.parent = thisT;
                rangeIndicatorConeObj     = rangeIndicatorCone.gameObject;
            }
            ClearSelectedTower();

            Time.timeScale = 1;
        }