Ejemplo n.º 1
0
        public void Init()              //to match the rscList with the DB
        {
            instance = this;

            rscList = ResourceDB.LoadClone();

            if (carryFromLastScene)
            {
                for (int i = 0; i < lastLevelValueList.Count; i++)
                {
                    rscList[i].value = lastLevelValueList[i];
                }
            }
            else
            {
                for (int i = 0; i < rscList.Count; i++)
                {
                    if (i < startingValueList.Count)
                    {
                        rscList[i].value = startingValueList[i];
                    }
                }
            }

            for (int i = 0; i < rscList.Count; i++)
            {
                initialValueList.Add(rscList[i].value);
            }

            if (enableRscGen)
            {
                StartCoroutine(RscGenRoutine());
            }
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            // Get existing open window or if none, make a new one:
            window         = (SpawnEditorWindow)EditorWindow.GetWindow(typeof(SpawnEditorWindow));
            window.minSize = new Vector2(670, 620);


            int enumLength = Enum.GetValues(typeof(SpawnManager._SpawnMode)).Length;

            spawnModeLabel   = new string[enumLength];
            spawnModeTooltip = new string[enumLength];
            for (int i = 0; i < enumLength; i++)
            {
                spawnModeLabel[i] = ((SpawnManager._SpawnMode)i).ToString();
                if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.Continous)
                {
                    spawnModeTooltip[i] = "A new wave is spawn upon every wave duration countdown (with option to skip the timer)";
                }
                if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.WaveCleared)
                {
                    spawnModeTooltip[i] = "A new wave is spawned when the current wave is cleared (with option to spawn next wave in advance)";
                }
                if ((SpawnManager._SpawnMode)i == SpawnManager._SpawnMode.Round)
                {
                    spawnModeTooltip[i] = "Each wave is treated like a round. a new wave can only take place when the previous wave is cleared. Each round require initiation from user";
                }
            }


            creepList = CreepDB.Load();
            rscList   = ResourceDB.Load();
            GetSpawnManager();
        }
Ejemplo n.º 3
0
        public static void LoadRsc()
        {
            rscDB = ResourceDB.LoadDB();

            TDEditorWindow.SetResourceDB(rscDB);
            TDEditorInspector.SetResourceDB(rscDB);
        }
Ejemplo n.º 4
0
        void Awake()
        {
            instance = (ResourceManager)target;

            rscList = ResourceDB.Load();

            //VerifyingList();
            instance.Init();
            EditorUtility.SetDirty(instance);
        }
Ejemplo n.º 5
0
        private static void LoadRsc()
        {
            rscPrefabDB = ResourceDB.LoadDB();
            rscList     = rscPrefabDB.rscList;

            for (int i = 0; i < rscList.Count; i++)
            {
                rscIDList.Add(rscList[i].ID);
            }
        }
Ejemplo n.º 6
0
        public static List <Rsc> Load()
        {
            GameObject obj = Resources.Load("DB_TDTK/ResourceDB", typeof(GameObject)) as GameObject;

                        #if UNITY_EDITOR
            if (obj == null)
            {
                obj = CreatePrefab();
            }
                        #endif

            ResourceDB instance = obj.GetComponent <ResourceDB>();
            return(instance.rscList);
        }
Ejemplo n.º 7
0
        public static List <Rsc> LoadClone()
        {
            GameObject obj      = Resources.Load("DB_TDTK/ResourceDB", typeof(GameObject)) as GameObject;
            ResourceDB instance = obj.GetComponent <ResourceDB>();

            List <Rsc> newList = new List <Rsc>();

            if (instance != null)
            {
                for (int i = 0; i < instance.rscList.Count; i++)
                {
                    newList.Add(instance.rscList[i].Clone());
                }
            }

            return(newList);
        }
Ejemplo n.º 8
0
        public void Init()              //to match the rscList with the DB
        {
            instance = this;

            List <Rsc> rscL = ResourceDB.Load();

            for (int i = 0; i < rscL.Count; i++)
            {
                for (int n = 0; n < rscList.Count; n++)
                {
                    if (rscL[i].ID == rscList[n].ID)
                    {
                        rscL[i].value = rscList[n].value;
                        break;
                    }
                }
            }

            rscList = rscL;

            if (carryFromLastScene)
            {
                for (int i = 0; i < lastLevelValueList.Count; i++)
                {
                    rscList[i].value = lastLevelValueList[i];
                }
            }

            for (int i = 0; i < rscList.Count; i++)
            {
                initialValueList.Add(rscList[i].value);
            }

            if (enableRscGen)
            {
                StartCoroutine(RscGenRoutine());
            }
        }
Ejemplo n.º 9
0
        public void Init()              //to match the rscList with the DB
        {
            List <Rsc> rscL = ResourceDB.Load();

            for (int i = 0; i < rscL.Count; i++)
            {
                for (int n = 0; n < rscList.Count; n++)
                {
                    if (rscL[i].ID == rscList[n].ID)
                    {
                        rscL[i].value = rscList[n].value;
                        break;
                    }
                }
            }

            rscList = rscL;

            if (enableRscGen)
            {
                StartCoroutine(RscGenRoutine());
            }
        }
		private static void LoadRsc(){ 
			rscPrefabDB=ResourceDB.LoadDB();
			rscList=rscPrefabDB.rscList;
			
			for(int i=0; i<rscList.Count; i++) rscIDList.Add(rscList[i].ID);
		}
Ejemplo n.º 11
0
 public static void SetResourceDB(ResourceDB db)
 {
     rscDB = db;
 }