Esempio n. 1
0
        Vector2 SubWaveConfigurator(Wave wave, float startX, float startY, float spaceX, float width, float spaceY, float height)
        {
            float cachedY = startY;

            startX += 5;

            float width2 = width * .6f;

            for (int i = 0; i < wave.subWaveList.Count; i++)
            {
                SubWave subWave = wave.subWaveList[i];

                float cachedX = startX;

                GUI.Box(new Rect(startX - 5, startY + spaceY - 5, spaceX + width2 + 10, 8 * spaceY + 47), "");

                int unitID = -1;
                for (int n = 0; n < creepList.Count; n++)
                {
                    if (subWave.unit == creepList[n].gameObject)
                    {
                        unitID = n;
                    }
                }

                Sprite icon = unitID == -1 ? null : creepList[unitID].iconSprite;
                EditorUtilities.DrawSprite(new Rect(startX, startY + spaceY, 30, 30), icon);

                cont = new GUIContent("Creep Prefab:", "The creep prefab to be spawned");
                EditorGUI.LabelField(new Rect(startX + 32, startY += spaceY - 2, width, height), cont);
                unitID = EditorGUI.Popup(new Rect(startX + 32, startY += spaceY - 5, width + 20, height), unitID, creepNameList);
                if (unitID >= 0)
                {
                    subWave.unit = creepList[unitID].gameObject;
                }

                //subWave.unit=DrawCreepSelect(startX, startY+=spaceY, subWave.unit); startY+=14;


                startX = cachedX;

                cont = new GUIContent("Number of Unit:", "Number of unit to be spawned");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.count = EditorGUI.IntField(new Rect(startX + spaceX, startY, width2, height), subWave.count);

                cont = new GUIContent("Start Delay:", "Time delay before the first creep of this subwave start spawn");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.delay = EditorGUI.FloatField(new Rect(startX + spaceX, startY, width2, height), subWave.delay);

                cont = new GUIContent("Spawn Interval:", "The time interval in second between each single individual spawned");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, width2, height), subWave.interval);

                cont = new GUIContent("Alternate Path:", "The path to use for this subwave, if it's different from the default path. Optional and can be left blank");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.path = (PathTD)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width2, height), subWave.path, typeof(PathTD), true);


                EditorGUI.LabelField(new Rect(startX, startY += spaceY + 5, width, height), "Override:");

                GUI.color = new Color(.5f, .5f, .5f, 1f);
                if (subWave.overrideHP >= 0)
                {
                    GUI.color = Color.white;
                }

                cont = new GUIContent(" - HP:", "Override the value of default HP set in CreepEditor. Only valid if value is set to >0");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.overrideHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, width2, height), subWave.overrideHP);

                GUI.color = new Color(.5f, .5f, .5f, 1f);
                if (subWave.overrideShield >= 0)
                {
                    GUI.color = Color.white;
                }

                cont = new GUIContent(" - Shield:", "Override the value of default shield set in CreepEditor. Only valid if value is set to >0");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.overrideShield = EditorGUI.FloatField(new Rect(startX + spaceX, startY, width2, height), subWave.overrideShield);

                GUI.color = new Color(.5f, .5f, .5f, 1f);
                if (subWave.overrideMoveSpd >= 0)
                {
                    GUI.color = Color.white;
                }

                cont = new GUIContent(" - Move Speed:", "Override the value of default MoveSpeed set in CreepEditor. Only valid if value is set to >0");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                subWave.overrideMoveSpd = EditorGUI.FloatField(new Rect(startX + spaceX, startY, width2, height), subWave.overrideMoveSpd);

                GUI.color = Color.white;


                if (i < wave.subWaveList.Count - 1)
                {
                    startY = cachedY;
                }
                startX += spaceX + width * 0.85f;

                if (contentWidth < startX)
                {
                    contentWidth = startX;
                }
            }
            return(new Vector2(startX, startY + 3));
        }