Esempio n. 1
0
    static void LoadCreep()
    {
        GameObject obj = Resources.Load("PrefabListCreep", typeof(GameObject)) as GameObject;

        if (obj != null)
        {
            CreepListPrefab prefab = obj.GetComponent <CreepListPrefab>();

            if (prefab != null)
            {
                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] == null)
                    {
                        prefab.creepList.RemoveAt(i);
                        i -= 1;
                    }
                }

                creepList      = new List <UnitCreep>();
                creepNameList  = new string[prefab.creepList.Count];
                creepIDMapList = new int[prefab.creepList.Count];

                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] != null)
                    {
                        creepList.Add(prefab.creepList[i]);
                        creepNameList[i]  = creepList[i].unitName;
                        creepIDMapList[i] = creepList[i].prefabID;
                    }
                }

                if (creepFoldList.Length == 0)
                {
                    creepFoldList = new bool[creepList.Count];
                    for (int i = 0; i < creepFoldList.Length; i++)
                    {
                        creepFoldList[i] = true;
                    }
                }
                else
                {
                    bool[] tempList = new bool[creepList.Count];
                    for (int i = 0; i < creepList.Count; i++)
                    {
                        if (i < creepFoldList.Length)
                        {
                            tempList[i] = creepFoldList[i];
                        }
                        else
                        {
                            tempList[i] = true;
                        }
                    }
                    creepFoldList = tempList;
                }
            }
        }
    }
Esempio n. 2
0
    //~ private static List<Tower> towerList=new List<Resource>();

    // Add menu named "PerkEditor" to the Window menu
    //[MenuItem ("TDTK/PerkEditor")]
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window         = (CreepManager)EditorWindow.GetWindow(typeof(CreepManager));
        window.minSize = new Vector2(375, 449);
        window.maxSize = new Vector2(375, 800);

        GameObject obj = Resources.Load("PrefabListCreep", typeof(GameObject)) as GameObject;

        if (obj == null)
        {
            obj = CreatePrefab();
        }

        prefab = obj.GetComponent <CreepListPrefab>();
        if (prefab == null)
        {
            prefab = obj.AddComponent <CreepListPrefab>();
        }

        creepList = prefab.creepList;

        for (int i = 0; i < creepList.Count; i++)
        {
            //creepList[i].prefabID=i;
            if (creepList[i] != null)
            {
                creepIDList.Add(creepList[i].prefabID);
            }
            else
            {
                creepList.RemoveAt(i);
                i -= 1;
            }
        }



        //~ resourceList.Add(new Resource());

        //~ Load();

        //AssetDatabase.GetAssetPath

        //~ for(int i=0; i<towerList.Count; i++) EditorUtility.SetDirty(towerList[i]);
    }
Esempio n. 3
0
    void LoadCreep()
    {
        //Debug.Log("load");
        GameObject obj = Resources.Load("PrefabListCreep", typeof(GameObject)) as GameObject;

        if (obj != null)
        {
            CreepListPrefab prefab = obj.GetComponent <CreepListPrefab>();

            if (prefab != null)
            {
                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] == null)
                    {
                        prefab.creepList.RemoveAt(i);
                        i -= 1;
                    }
                }

                creepList = new List <UnitCreep>();

                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] != null)
                    {
                        creepList.Add(prefab.creepList[i]);
                    }
                }
            }
        }

        //~ creepParameter=new UnitParameter[creepList.Count];
        //~ if(creepParameter.Length!=creepList.Count){
        //~ UnitParameter[] temp=new UnitParameter[creepList.Count];
        //~ for(int i=0; i<temp.Length; i++){
        //~ if(i<creepParameter.Length){
        //~ temp[i]=creepParameter[i];
        //~ }
        //~ else{
        //~ temp[i]=new UnitParameter();
        //~ }
        //~ }
        //~ creepParameter=temp;
        //~ }
    }
Esempio n. 4
0
    static void GetCreep()
    {
        creepList = new UnitCreep[0];
        nameList  = new string[0];

        GameObject obj = Resources.Load("PrefabListCreep", typeof(GameObject)) as GameObject;

        if (obj != null)
        {
            CreepListPrefab prefab = obj.GetComponent <CreepListPrefab>();

            if (prefab != null)
            {
                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] == null)
                    {
                        prefab.creepList.RemoveAt(i);
                        i -= 1;
                    }
                }

                creepList = new UnitCreep[prefab.creepList.Count];
                nameList  = new string[prefab.creepList.Count];

                for (int i = 0; i < prefab.creepList.Count; i++)
                {
                    if (prefab.creepList[i] != null)
                    {
                        creepList[i] = prefab.creepList[i];
                        nameList[i]  = prefab.creepList[i].unitName;
                    }
                }
            }
        }

        //~ rscManager=(ResourceManager)FindObjectOfType(typeof(ResourceManager));
    }