Ejemplo n.º 1
0
        public static void Init()
        {
            // Get existing open window or if none, make a new one:
            window         = (AbilityEditorWindow)EditorWindow.GetWindow(typeof(AbilityEditorWindow), false, "Ability Editor");
            window.minSize = new Vector2(400, 300);
            //~ window.maxSize=new Vector2(375, 800);

            LoadDB();

            InitLabel();

            window.SetupCallback();
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            // Get existing open window or if none, make a new one:
            window = (AbilityEditorWindow)EditorWindow.GetWindow(typeof (AbilityEditorWindow), false, "Ability Editor");
            window.minSize=new Vector2(400, 300);
            //~ window.maxSize=new Vector2(375, 800);

            LoadDB();

            InitLabel();

            window.SetupCallback();
        }
Ejemplo n.º 3
0
        private float DrawAddAbility(float startX, float startY, Perk perk)
        {
            startY += 45;

            int abilityIdx = perk.newAbilityID >= 0 ? TDSEditor.GetAbilityIndex(perk.newAbilityID) : 0;

            TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), abilityIdx > 0 ? abilityDB.abilityList[abilityIdx - 1].icon : null);
            if (GUI.Button(new Rect(startX + spaceX, startY - 2, 40, height - 2), "Edit "))
            {
                AbilityEditorWindow.Init();
            }

            cont = new GUIContent("New Ability:", "New ability to be made available to player");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont, headerStyle);

            abilityIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abilityIdx, abilityLabel);
            if (abilityIdx > 0)
            {
                perk.newAbilityID = abilityDB.abilityList[abilityIdx - 1].ID;
            }
            else
            {
                perk.newAbilityID = -1;
            }


            abilityIdx = perk.replaceAbilityID >= 0 ? TDSEditor.GetAbilityIndex(perk.replaceAbilityID) : 0;

            cont = new GUIContent("Replace Existing:", "If the new ability is to replace a existing player's ability\n\nIf no matching ability is found during runtime, the new ability will simply be added");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);

            abilityIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abilityIdx, abilityLabel);
            if (abilityIdx > 0)
            {
                perk.replaceAbilityID = abilityDB.abilityList[abilityIdx - 1].ID;
            }
            else
            {
                perk.replaceAbilityID = -1;
            }

            return(startY);
        }
Ejemplo n.º 4
0
        Vector2 DrawWeaponConfigurator(float startX, float startY, Weapon weapon)
        {
            //float cachedX=startX;
            //float cachedY=startY;

            TDSEditorUtility.DrawSprite(new Rect(startX, startY, 60, 60), weapon.icon);
            startX += 65;

            float offsetY = TDSEditor.IsPrefab(weapon.gameObject) ? 5 : 0;

            cont = new GUIContent("Name:", "The weapon name to be displayed in game");
            EditorGUI.LabelField(new Rect(startX, startY += offsetY, width, height), cont);
            weapon.weaponName = EditorGUI.DelayedTextField(new Rect(startX + spaceX - 65, startY, width - 5, height), weapon.weaponName);

            cont = new GUIContent("Icon:", "The weapon icon to be displayed in game, must be a sprite");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.icon = (Sprite)EditorGUI.ObjectField(new Rect(startX + spaceX - 65, startY, width - 5, height), weapon.icon, typeof(Sprite), false);

            cont = new GUIContent("Prefab:", "The prefab object of the weapon\nClick this to highlight it in the ProjectTab");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            EditorGUI.ObjectField(new Rect(startX + spaceX - 65, startY, width - 5, height), weapon.gameObject, typeof(GameObject), false);

            startX -= 65;
            startY += spaceY;           //cachedY=startY;


            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Weapon Stats", headerStyle);

            cont = new GUIContent("Shoot Object:", "The prefab of the bullet/object fired by the weapon\nMust be a prefab with ShootObject component attached on it");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.shootObject = (GameObject)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), weapon.shootObject, typeof(GameObject), false);

            cont = new GUIContent("ShootPoint:", "The transform which indicate the position where the shootObject will be fired from (Optional)\nEach shootPoint assigned will fire a shootObject instance in each attack\nIf left empty, the weapon transform itself will be use as the shootPoint\nThe orientation of the shootPoint matter as they dictate the orientation of the firing direction.\n");
            shootPointFoldout = EditorGUI.Foldout(new Rect(startX, startY += spaceY, spaceX, height), shootPointFoldout, cont);
            int shootPointCount = weapon.shootPointList.Count;

            shootPointCount = EditorGUI.DelayedIntField(new Rect(startX + spaceX, startY, 40, height), shootPointCount);

            if (shootPointCount != weapon.shootPointList.Count)
            {
                while (weapon.shootPointList.Count < shootPointCount)
                {
                    weapon.shootPointList.Add(null);
                }
                while (weapon.shootPointList.Count > shootPointCount)
                {
                    weapon.shootPointList.RemoveAt(weapon.shootPointList.Count - 1);
                }
            }

            if (shootPointFoldout)
            {
                for (int i = 0; i < weapon.shootPointList.Count; i++)
                {
                    int objID = GetObjectIDFromHList(weapon.shootPointList[i], objHList);
                    EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "    - Element " + (i + 1));
                    objID = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), objID, objHLabelList);
                    weapon.shootPointList[i] = (objHList[objID] == null) ? null : objHList[objID].transform;
                }
            }

            cont = new GUIContent("Shoot Point Delay:", "The delay in seconds between subsequent shot in each shoot point");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (weapon.shootPointList.Count > 1)
            {
                weapon.shootPointDelay = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.shootPointDelay);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }


            startY += 5;

            cont = new GUIContent("Continous Fire:", "Check to enable continous firing on the weapon when holding down fire button");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.continousFire = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), weapon.continousFire);

            startY += 5;

            cont = new GUIContent("Range:", "The effective range of the weapon.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.range = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.range);

            cont = new GUIContent("Cooldown:", "The cooldown in seconds between subsequent shot");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.cooldown = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.cooldown);

            startY += 5;

            cont = new GUIContent("UseEnergyAsAmmo:", "Check to use energy as ammunition");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.useEnergyAsAmmo = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), weapon.useEnergyAsAmmo);

            cont = new GUIContent(" - Cost Per Shot:", "The energy cost per shot");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (!weapon.useEnergyAsAmmo)
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }
            else
            {
                weapon.energyCost = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.energyCost);
            }

            startY += 5;

            cont = new GUIContent("Clip Size:", "How many times the weapon can be fired before it needs a reload. Set to -1 if the weapon can be fired indefinitely without reloading");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (weapon.useEnergyAsAmmo)
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }
            else
            {
                weapon.clipSize = EditorGUI.DelayedIntField(new Rect(startX + spaceX, startY, 40, height), weapon.clipSize);
            }

            cont = new GUIContent("Ammo Cap:", "How many ammo of the weapon the player can keep. Set to -1 if the weapon has unlimited ammo cap");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (weapon.useEnergyAsAmmo)
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }
            else
            {
                weapon.ammoCap = EditorGUI.DelayedIntField(new Rect(startX + spaceX, startY, 40, height), weapon.ammoCap);
            }

            cont = new GUIContent("Reload Duration:", "The duration in seconds to reload the weapon");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (weapon.useEnergyAsAmmo)
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }
            else
            {
                weapon.reloadDuration = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.reloadDuration);
            }

            startY += 5;

            cont = new GUIContent("Recoil:", "The recoil magnitude of the weapon. The higher the value, the less accurate the weapon become when fired continously");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.recoilMagnitude = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.recoilMagnitude);

            cont = new GUIContent("Recoil Cam Shake:", "The camera shake magnitude whenever the weapon is fired");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.recoilCamShake = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.recoilCamShake);

            startY += 5;

            cont = new GUIContent("Spread:", "The number of shoot object split from each shoot point. This is to create a shotgun effect");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.spread = EditorGUI.DelayedIntField(new Rect(startX + spaceX, startY, 40, height), weapon.spread);
            weapon.spread = Mathf.Max(1, weapon.spread);

            cont = new GUIContent("Spread Angle:", "The angle (in degree) between each spread");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (weapon.spread > 1)
            {
                weapon.spreadAngle = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), weapon.spreadAngle);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, 40, height), "-");
            }

            startY += 10;

            Vector2 v2 = DrawAttackStats1(startX, startY + spaceY, weapon.aStats);

            startY = v2.y + 20;

            startY += 30;


            //int abilityIdx=weapon.ability==null ? 0 : TDSEditor.GetEffectIndex(weapon.ability.ID);
            //if(abilityIdx==0) weapon.ability=null;
            int abilityIdx = weapon.abilityID >= 0 ? TDSEditor.GetAbilityIndex(weapon.abilityID) : 0;

            TDSEditorUtility.DrawSprite(new Rect(startX + spaceX + width - 40, startY + spaceY - 45, 40, 40), abilityIdx > 0 ? abilityDB.abilityList[abilityIdx - 1].icon : null);
            if (GUI.Button(new Rect(startX + spaceX, startY - 2, 40, height - 2), "Edit "))
            {
                AbilityEditorWindow.Init();
            }

            cont = new GUIContent("AltAttack(Ability):", "Ability that is being used as the weapon alternate fire mode (optional)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont, headerStyle);

            abilityIdx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), abilityIdx, abilityLabel);
            if (abilityIdx > 0)
            {
                weapon.abilityID = abilityDB.abilityList[abilityIdx - 1].ID;
            }
            else
            {
                weapon.abilityID = -1;
            }

            //if(abilityIdx>0) weapon.ability=abilityDB.abilityList[abilityIdx-1];
            //else weapon.ability=null;


            startY += 15;


            cont = new GUIContent("Shoot SFX:", "Audio clip to play when the weapon fires (optional)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.shootSFX = (AudioClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), weapon.shootSFX, typeof(AudioClip), false);

            cont = new GUIContent("Reload SFX:", "Audio clip to play when the weapon reloads (optional)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            weapon.reloadSFX = (AudioClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), weapon.reloadSFX, typeof(AudioClip), false);


            startY += 15;

            GUIStyle style = new GUIStyle("TextArea");

            style.wordWrap = true;
            cont           = new GUIContent("Weapon description (to be used in runtime): ", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, 400, 20), cont);
            weapon.desp = EditorGUI.DelayedTextField(new Rect(startX, startY + spaceY - 3, 270, 150), weapon.desp, style);


            return(new Vector2(startX, startY + 200));
        }
Ejemplo n.º 5
0
        Vector2 DrawUnitConfigurator(float startX, float startY, UnitPlayer unit)
        {
            Vector2 v2 = DrawUnitBaseStats(startX, startY, unit, true);

            startY = v2.y;

            startY += 10;

            int objID = GetObjectIDFromHList(unit.turretObj, objHList);

            cont = new GUIContent("Turret Object:", "The pivot transform on the unit to track the shoot direction");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            objID          = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), objID, objHLabelList);
            unit.turretObj = (objHList[objID] == null) ? null : objHList[objID].transform;

            objID = GetObjectIDFromHList(unit.weaponMountPoint, objHList);
            cont  = new GUIContent("WeaponMount:", "The transform where the weapon object to be anchored to as child object");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            objID = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), objID, objHLabelList);
            unit.weaponMountPoint = (objHList[objID] == null) ? null : objHList[objID].transform;

            startY += 10;

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Weapons", headerStyle);

            cont = new GUIContent("Enable All   -  ", "Check to enable all weapons");
            EditorGUI.LabelField(new Rect(startX + spaceX + 50, startY, width, height), cont);
            unit.enableAllWeapons = EditorGUI.Toggle(new Rect(startX + spaceX + width - 15, startY, width, height), unit.enableAllWeapons);

            if (!unit.enableAllWeapons)
            {
                int enabledCount = 0;
                for (int i = 0; i < weaponDB.weaponList.Count; i++)
                {
                    Weapon weapon = weaponDB.weaponList[i];

                    bool enabled       = unit.weaponList.Contains(weapon);
                    bool enabledCached = enabled;

                    TDSEditorUtility.DrawSprite(new Rect(startX + 20, startY += spaceY, 30, 30), weapon.icon, weapon.desp);
                    cont = new GUIContent(weapon.weaponName, weapon.desp);
                    EditorGUI.LabelField(new Rect(startX + 65, startY + 15, width, height), cont);
                    enabled = EditorGUI.Toggle(new Rect(startX + spaceX + width - 15, startY + 15, width, height), enabled);
                    startY += 14;

                    if (enabled != enabledCached)
                    {
                        if (enabled)
                        {
                            unit.weaponList.Insert(enabledCount, weapon);
                        }
                        else
                        {
                            unit.weaponList.Remove(weapon);
                        }
                    }

                    if (enabled)
                    {
                        enabledCount += 1;
                    }
                }

                startY += 10;
            }
            if (GUI.Button(new Rect(startX + spaceX + width - 100, startY += spaceY, 100, height - 2), "Weapon Editor"))
            {
                WeaponEditorWindow.Init();
            }


            startY += 20;


            unit.enableAbility = EditorGUI.Toggle(new Rect(startX, startY += spaceY, width, height), unit.enableAbility);
            EditorGUI.LabelField(new Rect(startX + 20, startY, width, height), "Abilities", headerStyle);

            if (unit.enableAbility)
            {
                cont = new GUIContent("Enable All   -  ", "Check to enable all abilities");
                EditorGUI.LabelField(new Rect(startX + spaceX + 50, startY, width, height), cont);
                unit.enableAllAbilities = EditorGUI.Toggle(new Rect(startX + spaceX + width - 15, startY, width, height), unit.enableAllAbilities);

                if (!unit.enableAllAbilities)
                {
                    int enabledCount = 0;
                    for (int i = 0; i < abilityDB.abilityList.Count; i++)
                    {
                        Ability ability = abilityDB.abilityList[i];

                        bool enabled       = unit.abilityIDList.Contains(ability.ID);
                        bool enabledCached = enabled;

                        TDSEditorUtility.DrawSprite(new Rect(startX + 20, startY += spaceY, 30, 30), ability.icon);
                        cont = new GUIContent(ability.name, ability.desp);
                        EditorGUI.LabelField(new Rect(startX + 65, startY + 15, width, height), cont);
                        enabled = EditorGUI.Toggle(new Rect(startX + spaceX + width - 15, startY + 15, width, height), enabled);
                        startY += 14;

                        if (enabled != enabledCached)
                        {
                            if (enabled)
                            {
                                unit.abilityIDList.Insert(enabledCount, ability.ID);
                            }
                            else
                            {
                                unit.abilityIDList.Remove(ability.ID);
                            }
                        }

                        if (enabled)
                        {
                            enabledCount += 1;
                        }
                    }

                    startY += 10;
                }
                if (GUI.Button(new Rect(startX + spaceX + width - 100, startY += spaceY, 100, height - 2), "Ability Editor"))
                {
                    AbilityEditorWindow.Init();
                }
            }

            startY += 10;


            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Movement & Control", headerStyle);

            cont = new GUIContent("EnableTurretAiming:", "Check to allow turret object to rotate and aim towards cursor position");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.enableTurretRotate = EditorGUI.Toggle(new Rect(startX + spaceX, startY, width, height), unit.enableTurretRotate);

            cont = new GUIContent("Turret Aim Mode:", "The way in which the turret aim direction will be calculated");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (unit.enableTurretRotate)
            {
                int aimMode = (int)unit.turretAimMode;
                contL = new GUIContent[turretAimModeLabel.Length];
                for (int i = 0; i < contL.Length; i++)
                {
                    contL[i] = new GUIContent(turretAimModeLabel[i], turretAimModeTooltip[i]);
                }
                aimMode            = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), new GUIContent(""), aimMode, contL);
                unit.turretAimMode = (_TurretAimMode)aimMode;
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, width, height), "-");
            }

            cont = new GUIContent("Aim At Move Dir.:", "Check to have the unit's aim locked with it's move direction");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (unit.enableTurretRotate)
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, width, height), "-");
            }
            else
            {
                unit.aimAtTravelDirection = EditorGUI.Toggle(new Rect(startX + spaceX, startY, width, height), unit.aimAtTravelDirection);
            }

            startY += 10;

            cont = new GUIContent("FaceTravelDirection:", "Enable to have the unit's transform rotates to face its travel direction");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.faceTravelDirection = EditorGUI.Toggle(new Rect(startX + spaceX, startY, width, height), unit.faceTravelDirection);

            cont = new GUIContent("x-axis movement:", "Check to enabled unit movement in x-axis");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.enabledMovementX = EditorGUI.Toggle(new Rect(startX + spaceX, startY, width, height), unit.enabledMovementX);

            cont = new GUIContent("z-axis movement:", "Check to enabled unit movement in z-axis");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.enabledMovementZ = EditorGUI.Toggle(new Rect(startX + spaceX, startY, width, height), unit.enabledMovementZ);

            startY += 10;

            int mode = (int)unit.movementMode;

            cont = new GUIContent("Movement Mode:", "The way in which the movement of the unit is handled with regard to the input");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            contL = new GUIContent[movementModeLabel.Length];
            for (int i = 0; i < contL.Length; i++)
            {
                contL[i] = new GUIContent(movementModeLabel[i], movementModeTooltip[i]);
            }
            mode = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, 15), new GUIContent(""), mode, contL);
            unit.movementMode = (_MovementMode)mode;

            cont = new GUIContent("Move Speed:", "The move speed of the unit");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.moveSpeed = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.moveSpeed);

            cont = new GUIContent("Boost Speed Mul:", "Speed-Multiplier(rigid mode)/Acceleration-Multiplier(free-form mode) when using boost (left-shift by default)");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.boostMultiplier = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.boostMultiplier);

            cont = new GUIContent("Boost Energy Rate:", "Energy consumption rate (per second) when using boost (left-shift by default)\n0.3 being 30% of total energy per second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.boostEnergyRate = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.boostEnergyRate);

            if (unit.movementMode == _MovementMode.FreeForm)
            {
                cont = new GUIContent("Acceleration:", "The acceleration of the unit");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                unit.acceleration = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.acceleration);

                cont = new GUIContent("Decceleration:", "The rate of the unit losing it's speed");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                unit.decceleration = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.decceleration);

                cont = new GUIContent("Active Braking:", "Stopping power when using active braking (space by default)");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                unit.activeBrakingRate = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 40, height), unit.activeBrakingRate);
            }

            startY += 10;


            cont = new GUIContent("Enable Limit ", "Check to limit player movement to a defined area");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            unit.useLimit = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 30, height), unit.useLimit);

            if (unit.useLimit)
            {
                cont         = new GUIContent("Show", "");
                limitFoldout = EditorGUI.Foldout(new Rect(startX + spaceX + 40, startY, spaceX, height), limitFoldout, cont);

                if (limitFoldout)
                {
                    cont = new GUIContent("x-axis (min/max):", "Stopping power when using active braking (space by default)");
                    EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                    unit.minPosX = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 70, height), unit.minPosX);
                    unit.maxPosX = EditorGUI.DelayedFloatField(new Rect(startX + spaceX + 75, startY, 70, height), unit.maxPosX);

                    cont = new GUIContent("z-axis (min/max):", "Stopping power when using active braking (space by default)");
                    EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                    unit.minPosZ = EditorGUI.DelayedFloatField(new Rect(startX + spaceX, startY, 70, height), unit.minPosZ);
                    unit.maxPosZ = EditorGUI.DelayedFloatField(new Rect(startX + spaceX + 75, startY, 70, height), unit.maxPosZ);
                }
            }

            startY += 10;

            Vector2 v3 = DrawDestroyEffectObj(startX, startY + spaceY, unit);

            startY = v3.y + 20;


            GUIStyle style = new GUIStyle("TextArea");

            style.wordWrap = true;
            cont           = new GUIContent("Unit description (to be used in runtime): ", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, 400, 20), cont);
            unit.desp = EditorGUI.DelayedTextField(new Rect(startX, startY + spaceY - 3, 270, 150), unit.desp, style);


            return(new Vector2(startX, startY + 200));
        }
Ejemplo n.º 6
0
 static void OpenAbilityEditor()
 {
     AbilityEditorWindow.Init();
 }