public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window         = (ObstacleManagerWindow)EditorWindow.GetWindow(typeof(ObstacleManagerWindow));
        window.minSize = new Vector2(375, 449);
        window.maxSize = new Vector2(375, 800);

        prefab       = LoadObstacle();
        obstacleList = prefab.obstacleList;

        foreach (Obstacle obs in obstacleList)
        {
            obstacleIDList.Add(obs.prefabID);
        }

        intVal = new int[3];
        for (int i = 0; i < intVal.Length; i++)
        {
            intVal[i] = i;
        }

        coverTypeLabel    = new string[3];
        coverTypeLabel[0] = "None";
        coverTypeLabel[1] = "Half";
        coverTypeLabel[2] = "Full";

        tileTypeLabel    = new string[3];
        tileTypeLabel[0] = "Hex";
        tileTypeLabel[1] = "Square";
        tileTypeLabel[2] = "Universal";

        obstacleTypeLabel    = new string[2];
        obstacleTypeLabel[0] = "Obstacle";
        obstacleTypeLabel[1] = "Wall";
    }
Esempio n. 2
0
    public static void Init()
    {
        // Get existing open window or if none, make a new one:
        window = (ObstacleManagerWindow)EditorWindow.GetWindow(typeof (ObstacleManagerWindow));
        window.minSize=new Vector2(375, 449);
        window.maxSize=new Vector2(375, 800);

        prefab=LoadObstacle();
        obstacleList=prefab.obstacleList;

        foreach(Obstacle obs in obstacleList){
            obstacleIDList.Add(obs.prefabID);
        }

        intVal=new int[3];
        for(int i=0; i<intVal.Length; i++) intVal[i]=i;

        coverTypeLabel=new string[3];
        coverTypeLabel[0]="None";
        coverTypeLabel[1]="Half";
        coverTypeLabel[2]="Full";

        tileTypeLabel=new string[3];
        tileTypeLabel[0]="Hex";
        tileTypeLabel[1]="Square";
        tileTypeLabel[2]="Universal";

        obstacleTypeLabel=new string[2];
        obstacleTypeLabel[0]="Obstacle";
        obstacleTypeLabel[1]="Wall";
    }
Esempio n. 3
0
    public static ObstacleListPrefab LoadObstacle()
    {
        GameObject obj=Resources.Load("PrefabList/ObstacleListPrefab", typeof(GameObject)) as GameObject;
        if(obj==null) obj=CreatePrefab();

        ObstacleListPrefab prefab=obj.GetComponent<ObstacleListPrefab>();
        if(prefab==null) prefab=obj.AddComponent<ObstacleListPrefab>();

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

        /*
        string[] nameList=new string[prefab.obstacleList.Count];
        for(int i=0; i<prefab.obstacleList.Count; i++){
            if(prefab.unitList[i]!=null){
                //nameList[i]=prefab.unitList[i].unitName;
                //prefab.unitList[i].prefabID=i;
                unitIDList.Add(prefab.unitList[i].prefabID);
            }
        }
        */

        //EditorUnitList eUnitList=new EditorUnitList();
        //eUnitList.prefab=prefab;
        //eUnitList.nameList=nameList;

        return prefab;
    }
Esempio n. 4
0
    void LoadObstacle()
    {
        ObstacleListPrefab prefab = ObstacleManagerWindow.LoadObstacle();

        obstacleList     = new List <Obstacle>();
        obstacleNameList = new string[prefab.obstacleList.Count + 2];

        obstacleList.Add(null);
        obstacleList.Add(null);
        obstacleNameList[0] = "empty(invisible)";
        obstacleNameList[1] = "empty(visible)";

        for (int i = 0; i < prefab.obstacleList.Count; i++)
        {
            obstacleList.Add(prefab.obstacleList[i]);
            obstacleNameList[i + 2] = prefab.obstacleList[i].obsName;
        }
    }
    public static ObstacleListPrefab LoadObstacle()
    {
        GameObject obj = Resources.Load("PrefabList/ObstacleListPrefab", typeof(GameObject)) as GameObject;

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

        ObstacleListPrefab prefab = obj.GetComponent <ObstacleListPrefab>();

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

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

        /*
         * string[] nameList=new string[prefab.obstacleList.Count];
         * for(int i=0; i<prefab.obstacleList.Count; i++){
         *      if(prefab.unitList[i]!=null){
         *              //nameList[i]=prefab.unitList[i].unitName;
         *              //prefab.unitList[i].prefabID=i;
         *              unitIDList.Add(prefab.unitList[i].prefabID);
         *      }
         * }
         */

        //EditorUnitList eUnitList=new EditorUnitList();
        //eUnitList.prefab=prefab;
        //eUnitList.nameList=nameList;

        return(prefab);
    }