Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.Space();

            #region Properties
            GUILayout.Toggle(true, "<b><size=11>" + "Properties" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                EditorGUILayout.PropertyField(launchAtStart);
                EditorGUILayout.PropertyField(startTime);
                EditorGUILayout.PropertyField(spawnShape);
                EditorGUILayout.PropertyField(spawnRadius);
                EditorGUILayout.PropertyField(managedByPool);
            } EditorTools.EndGroup();
            #endregion

            #region Wave
            GUILayout.Toggle(true, "<b><size=11>" + "Waves" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                EditorGUILayout.PropertyField(usePoolManager);
                EditorGUILayout.PropertyField(isChild, new GUIContent("Child"));
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(entities, true);
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                SpawnPropertiesInspector(amount);
                EditorGUILayout.Space();
                SpawnPropertiesInspector(simultanemous);
                EditorGUILayout.Space();
                SpawnPropertiesInspector(frequency);

                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(waveAmount);
                EditorGUILayout.PropertyField(reSpawnType);
                SpawnPropertiesInspector(waitingTime);
            } EditorTools.EndGroup();
            #endregion

            #region Events
            GUILayout.Toggle(true, "<b><size=11>" + "Events" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                EditorGUILayout.PropertyField(onSpawnerStart, true);
                EditorGUILayout.PropertyField(onSpawnerEnd, true);
                EditorGUILayout.PropertyField(onWaveStart, true);
                EditorGUILayout.PropertyField(onWaveEnd, true);
                EditorGUILayout.PropertyField(onWaveKill, true);
                EditorGUILayout.PropertyField(onSpawnEntity, true);
            } EditorTools.EndGroup();
            #endregion

            serializedObject.ApplyModifiedProperties();
            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            Weapon launcher = (Weapon)target;

            serializedObject.Update();
            EditorGUILayout.Space();

            if (EditorApplication.isPlaying)
            {
                string label = "Shoot";
                if (launcher.isShooting)
                {
                    label = "Stop shoot";
                }

                if (GUILayout.Button(label))
                {
                    if (launcher.isShooting)
                    {
                        launcher.StopShoot();
                    }
                    else
                    {
                        launcher.Shoot();
                    }
                }
            }

            #region Properties
            showProperties.boolValue = EditorTools.BeginFoldOut("Properties", showProperties.boolValue);
            if (showProperties.boolValue || showProperties.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    // Autonomous
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(isAutonomous, new GUIContent("Autonomous"));
                    EditorGUI.indentLevel++;
                    if (isAutonomous.boolValue)
                    {
                        EditorGUILayout.HelpBox("Radar component required", MessageType.Info);
                        factionIndex = EditorGUILayout.Popup("Faction", factionIndex, factionLabels);
                        if (factionIndex > -1)
                        {
                            faction.objectReferenceValue = (UnityEngine.Object)factions[factionIndex];
                        }
                    }
                    EditorGUI.indentLevel--;

                    EditorGUILayout.Space();

                    // Weapon
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(ammunition);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (ammunition.objectReferenceValue != null)
                        {
                            if (ammunition.objectReferenceValue.GetType() == typeof(LaserBeam))
                            {
                                weaponType.enumValueIndex = 1;
                            }
                            else
                            {
                                weaponType.enumValueIndex = 0;
                            }
                        }
                    }


                    // Fire Rate
                    if (weaponType.enumValueIndex == 0)
                    {
                        EditorGUILayout.PropertyField(fireRate, new GUIContent("Fire Rate /s"));
                    }
                    EditorGUILayout.Space();

                    // Barrels
                    EditorGUILayout.PropertyField(isSynchronizedBarrel, new GUIContent("Synchronized barrel"));
                    EditorGUILayout.PropertyField(fpsAlignment);
                    EditorGUILayout.PropertyField(fixedAlignment);
                    if (fixedAlignment.boolValue)
                    {
                        EditorGUILayout.PropertyField(alignmentPoint);
                    }
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(barrels, true);
                    EditorGUI.indentLevel--;
                } EditorTools.EndGroup();
            }
            #endregion

            #region Weapon Mode
            if (weaponType.enumValueIndex == 0)
            {
                showMode.boolValue = EditorTools.BeginFoldOut("Mode", showMode.boolValue);
                if (showMode.boolValue || showMode.hasMultipleDifferentValues)
                {
                    EditorTools.BeginGroup(); {
                        EditorGUILayout.PropertyField(isOneShot, new GUIContent("One shot"));
                        EditorGUILayout.PropertyField(isBurst, new GUIContent("Burst"));
                        if (isBurst.boolValue)
                        {
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(burstShotsAmount, new GUIContent("Amount"));
                            EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.PropertyField(isFullyAutmotic, new GUIContent("Automatic"));
                    } EditorTools.EndGroup();
                }
            }
            #endregion

            #region Magazine
            showMagazine.boolValue = EditorTools.BeginFoldOut("Magazine", showMagazine.boolValue);
            if (showMagazine.boolValue || showMagazine.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(enableMagazine, new GUIContent("Enable"));
                    if (enableMagazine.boolValue)
                    {
                        string shotValueLabel   = "Shot value";
                        string reloadValueLabel = "Reload Time";
                        if (magazineType.enumValueIndex == 1)
                        {
                            shotValueLabel   = "Speed";
                            reloadValueLabel = "Reload speed";
                        }

                        EditorGUILayout.PropertyField(magazineType, new GUIContent("Type"));
                        if (weaponType.enumValueIndex == 1)
                        {
                            magazineType.enumValueIndex = 1;
                        }

                        EditorGUILayout.PropertyField(magazineCapacity, new GUIContent("Capacity "));
                        EditorGUILayout.PropertyField(shotValue, new GUIContent(shotValueLabel));

                        EditorGUILayout.Space();

                        EditorGUILayout.PropertyField(magazineAutoReload, new GUIContent("Auto reload"));
                        EditorGUILayout.PropertyField(reloadValue, new GUIContent(reloadValueLabel));
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Ammunition stock
            if (enableMagazine.boolValue && magazineType.enumValueIndex == 0)
            {
                showStock.boolValue = EditorTools.BeginFoldOut("Stock of ammuntion", showStock.boolValue);
                if (showStock.boolValue)
                {
                    EditorTools.BeginGroup(); {
                        EditorGUILayout.PropertyField(enableAmmunitionStock, new GUIContent("Enable"));
                        EditorGUILayout.PropertyField(ammunitionMaxStock, new GUIContent("Max Stock"));
                        EditorGUILayout.PropertyField(ammunitionStock, new GUIContent("Initial stock"));
                    } EditorTools.EndGroup();
                }
            }

            #endregion

            #region Effect
            showEffect.boolValue = EditorTools.BeginFoldOut("Effects", showEffect.boolValue);
            if (showEffect.boolValue || showEffect.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(muzzleEffect);
                    EditorGUILayout.PropertyField(startShootingEffect);
                    EditorGUILayout.PropertyField(StopShootingEffect);
                } EditorTools.EndGroup();
            }
            #endregion

            #region event
            showEvents.boolValue = EditorTools.BeginFoldOut("Events", showEvents.boolValue);
            if (showEvents.boolValue || showEvents.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(onStartShooting, true);
                    EditorGUILayout.PropertyField(onShooting, true);
                    EditorGUILayout.PropertyField(onStopShooting, true);
                    EditorGUILayout.PropertyField(onReload, true);
                    EditorGUILayout.PropertyField(OnAutoReload, true);
                    EditorGUILayout.PropertyField(onNeedReload, true);
                    EditorGUILayout.PropertyField(OnReloadEnd, true);
                } EditorTools.EndGroup();
            }
            #endregion

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
            GUI.enabled = true;
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.Space();

            #region Properties
            GUILayout.Toggle(true, "<b><size=11>" + "Properties" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                EditorGUILayout.PropertyField(rayAdvance, new GUIContent("laser length"));
                EditorGUILayout.PropertyField(rayRadius, new GUIContent("Radius"));

                // Layer mash
                EditorGUILayout.PropertyField(layerMask);
            } EditorTools.EndGroup();
            #endregion

            #region Damage
            GUILayout.Toggle(true, "<b><size=11>" + "Damage" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                // Type
                EditorGUILayout.PropertyField(damageType, new GUIContent("Type"));
                if (damageType.enumValueIndex == 1)
                {
                    EditorGUILayout.PropertyField(damageRadius, new GUIContent("Explosion radius"));
                }

                // Nature
                if (!damageNature.hasMultipleDifferentValues)
                {
                    damageNature.intValue = EditorGUILayout.Popup("Nature", damageNature.intValue, damageLabels);
                }
                else
                {
                    int tmpDamageNature = EditorGUILayout.Popup("Nature", -1, damageLabels);
                    if (tmpDamageNature != damageNature.intValue && tmpDamageNature > -1)
                    {
                        damageNature.intValue = tmpDamageNature;
                    }
                }

                EditorGUILayout.PropertyField(damagePoint, new GUIContent("Point"));

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(isPhysic, new GUIContent("Add force at impact"));
                if (isPhysic.boolValue || isPhysic.hasMultipleDifferentValues)
                {
                    EditorGUILayout.PropertyField(force);
                    EditorGUILayout.PropertyField(forceMode);
                }
            } EditorTools.EndGroup();
            #endregion

            #region Effect
            GUILayout.Toggle(true, "<b><size=11>" + "Effect" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                EditorGUILayout.PropertyField(scale, new GUIContent("UV scale"));

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(isUvAnimated, new GUIContent("UV animation"));
                if (isUvAnimated.boolValue || isUvAnimated.hasMultipleDifferentValues)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(animationSpeed);
                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(isOscillation, new GUIContent("Oscillation"));
                if (isOscillation.boolValue || isOscillation.hasMultipleDifferentValues)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(isDynamicOscillation, new GUIContent("Dynamic"));
                    EditorGUILayout.PropertyField(subdivisionAmount);
                    EditorGUILayout.PropertyField(frequency);
                    EditorGUILayout.PropertyField(amplitude);
                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(impactEffect);
            } EditorTools.EndGroup();
            #endregion

            serializedObject.ApplyModifiedProperties();
            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();
            serializedObject.Update();

            #region Properties
            showPropertie.boolValue = EditorTools.BeginFoldOut("Entity properties", showPropertie.boolValue);
            if (showPropertie.boolValue || showPropertie.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(subEntity);
                    if (subEntity.boolValue || subEntity.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(parentEntity);
                    }

                    if (!subEntity.boolValue || subEntity.hasMultipleDifferentValues)
                    {
                        // Faction
                        if (!faction.hasMultipleDifferentValues)
                        {
                            factionIndex = EditorGUILayout.Popup("Faction", factionIndex, factionLabels);
                            if (factionIndex > -1)
                            {
                                faction.objectReferenceValue = (UnityEngine.Object)factions[factionIndex];
                            }
                        }
                        else
                        {
                            int tmpfactionIndex = EditorGUILayout.Popup("Faction", -1, factionLabels);
                            if (tmpfactionIndex != factionIndex && tmpfactionIndex > -1)
                            {
                                factionIndex = tmpfactionIndex;
                                faction.objectReferenceValue = (UnityEngine.Object)factions[factionIndex];
                            }
                        }

                        // Type
                        EditorGUILayout.PropertyField(entityType, new GUIContent("Type"));
                    }

                    EditorGUILayout.Space();

                    // invulnerableSpawn at spawn
                    EditorGUILayout.PropertyField(isInvulnerable, new GUIContent("Invulnerable"));

                    EditorGUILayout.Space();

                    // Life
                    if (!isInvulnerable.boolValue || isInvulnerable.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(randomLife);

                        if (!randomLife.boolValue || randomLife.hasMultipleDifferentValues)
                        {
                            EditorGUILayout.PropertyField(life, new GUIContent("life"));
                        }

                        if (randomLife.boolValue || randomLife.hasMultipleDifferentValues)
                        {
                            EditorGUILayout.PropertyField(rndMinLife, new GUIContent("Min life"));
                            EditorGUILayout.PropertyField(rndMaxLife, new GUIContent("Max life"));
                        }
                        EditorGUILayout.PropertyField(invulnerableSpawn, new GUIContent("Invulnerable spawn time"));
                        EditorGUILayout.PropertyField(scorePoint, new GUIContent("Score Point"));

                        EditorGUILayout.Space();
                    }

                    // Advanced
                    EditorGUILayout.PropertyField(isPooled, new GUIContent("Managed by a pool"));
                    EditorGUILayout.PropertyField(isExternalEndLife, new GUIContent("External end of life"));
                } EditorTools.EndGroup();
            }
            #endregion

            #region Sensitivity to damage
            showSensitivity.boolValue = EditorTools.BeginFoldOut("Sensitivity to damage", showSensitivity.boolValue);
            if (showSensitivity.boolValue || showSensitivity.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(addForceFromImpact, new GUIContent("Enable force from impact"));
                    EditorGUILayout.PropertyField(damageThreshold, new GUIContent("DamageThreshold"));

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Natures", EditorStyles.boldLabel);
                    for (int i = 0; i < damagesSensitivity.arraySize; i++)
                    {
                        EditorGUILayout.PropertyField(damagesSensitivity.GetArrayElementAtIndex(i), new GUIContent(damageLabels[i]));
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Damage
            showDamage.boolValue = EditorTools.BeginFoldOut("Damage on collision", showDamage.boolValue);
            if (showDamage.boolValue || showDamage.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(isCollisionDamage, new GUIContent("Enable"));
                    EditorGUI.indentLevel++;
                    if (isCollisionDamage.boolValue || isCollisionDamage.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(useTrigger);
                        if (!damageNature.hasMultipleDifferentValues)
                        {
                            damageNature.intValue = EditorGUILayout.Popup("Damage nature", damageNature.intValue, damageLabels);
                        }
                        else
                        {
                            int tmpDamageNature = EditorGUILayout.Popup("Damage nature", -1, damageLabels);
                            if (tmpDamageNature != damageNature.intValue && tmpDamageNature > -1)
                            {
                                damageNature.intValue = tmpDamageNature;
                            }
                        }

                        EditorGUILayout.PropertyField(damagePoint, new GUIContent("Damage Point"));
                    }
                    EditorGUI.indentLevel--;
                } EditorTools.EndGroup();
            }
            #endregion

            #region Effect
            showEffect.boolValue = EditorTools.BeginFoldOut("Effects", showEffect.boolValue);
            if (showEffect.boolValue || showEffect.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    //spawnEffectOffset = serializedObject.FindProperty("spawnEffectOffset");
                    //healEffectOffset = serializedObject.FindProperty("healEffectOffset");
                    //hitEffectOffset = serializedObject.FindProperty("hitEffectOffset");
                    //deathEffectOffset = serializedObject.FindProperty("deathEffectOffset");

                    // Spawn
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(spawnEffect);
                    if (spawnEffect.isExpanded)
                    {
                        EditorGUILayout.PropertyField(spawnEffectOffset, new GUIContent("Offset"));
                        SerializedProperty spawnE = serializedObject.FindProperty("spawnEffects");
                        EditorGUILayout.Space();
                        spawnE.Next(true);
                        spawnE.Next(true);
                        EditorGUILayout.PropertyField(spawnE);
                        for (int i = 0; i < spawnEffect.arraySize; i++)
                        {
                            EditorGUILayout.PropertyField(spawnEffect.GetArrayElementAtIndex(i));
                        }
                    }
                    EditorGUI.indentLevel--;
                    EditorGUILayout.Space();

                    // hit
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(hitEffect);
                    if (hitEffect.isExpanded)
                    {
                        EditorGUILayout.PropertyField(hitEffectOffset, new GUIContent("Offset"));
                        SerializedProperty hitE = serializedObject.FindProperty("hitEffects");
                        EditorGUILayout.Space();
                        hitE.Next(true);
                        hitE.Next(true);
                        EditorGUILayout.PropertyField(hitE);
                        for (int i = 0; i < hitEffect.arraySize; i++)
                        {
                            EditorGUILayout.PropertyField(hitEffect.GetArrayElementAtIndex(i));
                        }
                    }
                    EditorGUI.indentLevel--;
                    EditorGUILayout.Space();

                    // Heal
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(healEffect);
                    if (healEffect.isExpanded)
                    {
                        EditorGUILayout.PropertyField(healEffectOffset, new GUIContent("Offset"));
                        SerializedProperty healE = serializedObject.FindProperty("healEffects");
                        EditorGUILayout.Space();
                        healE.Next(true);
                        healE.Next(true);
                        EditorGUILayout.PropertyField(healE);
                        for (int i = 0; i < healEffect.arraySize; i++)
                        {
                            EditorGUILayout.PropertyField(healEffect.GetArrayElementAtIndex(i));
                        }
                    }
                    EditorGUI.indentLevel--;
                    EditorGUILayout.Space();

                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(deathEffect);
                    if (deathEffect.isExpanded)
                    {
                        EditorGUILayout.PropertyField(deathEffectOffset, new GUIContent("Offset"));
                        SerializedProperty deathE = serializedObject.FindProperty("deathEffects");
                        EditorGUILayout.Space();
                        deathE.Next(true);
                        deathE.Next(true);
                        EditorGUILayout.PropertyField(deathE, true);
                        for (int i = 0; i < deathEffect.arraySize; i++)
                        {
                            EditorGUILayout.PropertyField(deathEffect.GetArrayElementAtIndex(i));
                        }
                    }
                    EditorGUI.indentLevel--;
                } EditorTools.EndGroup();
            }
            #endregion

            #region Events
            showEvent.boolValue = EditorTools.BeginFoldOut("Events", showEvent.boolValue);
            if (showEvent.boolValue || showEvent.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(onEntitySpawn, true);
                    EditorGUILayout.PropertyField(onHit, true);
                    EditorGUILayout.PropertyField(onHeal, true);
                    EditorGUILayout.PropertyField(onEntityDestroy, true);
                } EditorTools.EndGroup();
            }
            #endregion

            serializedObject.ApplyModifiedProperties();
            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            PoolManager t = (PoolManager)target;

            EditorGUILayout.Space();

            t.dontDestroyOnLoad = EditorTools.Toggle("Don't destroy on load", t.dontDestroyOnLoad, true);
            EditorGUILayout.Space();

            t.isGarbageCollector = EditorTools.Toggle("Enable garbage collector", t.isGarbageCollector);
            if (t.isGarbageCollector)
            {
                t.garbageCycletime = EditorGUILayout.FloatField("Garbage cycle time", t.garbageCycletime);
            }


            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            EditorTools.Title("Per-Object Pool options", false, Screen.width - 55);
            if (EditorTools.ButtonTitle("+", false, 22))
            {
                PoolProperty po = new PoolProperty();
                t.poolObjectsProperties.Add(po);
            }
            EditorGUILayout.EndHorizontal();


            if (t.poolObjectsProperties.Count > 0)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.Space();
                    for (int i = 0; i < t.poolObjectsProperties.Count; i++)
                    {
                        EditorGUILayout.BeginHorizontal();
                        if (EditorTools.Button("X", Color.red, 19))
                        {
                            PoolManager.DestroyPool(t.poolObjectsProperties[i].obj, true);
                            t.poolObjectsProperties.RemoveAt(i);
                            i--;
                        }
                        if (i >= 0)
                        {
                            string label = "Empty";
                            if (t.poolObjectsProperties[i].obj)
                            {
                                label = t.poolObjectsProperties[i].obj.name;
                            }
                            t.poolObjectsProperties[i].showInpsector = EditorTools.ChildFoldOut(t.poolObjectsProperties[i].showInpsector, label, Color.white, Screen.width - 60);
                        }
                        EditorGUILayout.EndHorizontal();

                        if (i >= 0)
                        {
                            if (t.poolObjectsProperties[i].showInpsector)
                            {
                                EditorTools.BeginGroup(25); {
                                    EditorGUI.indentLevel++;

                                    // Prefab
                                    GameObject tmpObj = (GameObject)EditorGUILayout.ObjectField("Prefab", t.poolObjectsProperties[i].obj, typeof(GameObject), true);
                                    if (tmpObj != t.poolObjectsProperties[i].obj)
                                    {
                                        PoolManager.DestroyPool(t.poolObjectsProperties[i].obj, true);

                                        t.poolObjectsProperties[i].obj = tmpObj;

                                        //if (!t.poolObjectsProperties[i].preLoadAtStart){
                                        PoolManager.CreatePool(t.poolObjectsProperties[i].obj, t.poolObjectsProperties[i].poolAmount);
                                        //}
                                    }

                                    EditorGUILayout.Space();

                                    // Preload
                                    bool tmpBool = EditorTools.Toggle("Pre-Load at start", t.poolObjectsProperties[i].preLoadAtStart);
                                    if (tmpBool != t.poolObjectsProperties[i].preLoadAtStart)
                                    {
                                        t.poolObjectsProperties[i].preLoadAtStart = tmpBool;
                                        if (t.poolObjectsProperties[i].preLoadAtStart)
                                        {
                                            PoolManager.DestroyPool(t.poolObjectsProperties[i].obj, true);
                                        }
                                        else
                                        {
                                            PoolManager.DestroyPool(t.poolObjectsProperties[i].obj, true);
                                            PoolManager.CreatePool(t.poolObjectsProperties[i].obj, t.poolObjectsProperties[i].poolAmount);
                                        }
                                    }

                                    int amount = EditorGUILayout.IntField("Preload Amount", t.poolObjectsProperties[i].poolAmount);
                                    if (amount != t.poolObjectsProperties[i].poolAmount)
                                    {
                                        t.poolObjectsProperties[i].poolAmount = amount;
                                        PoolManager.DestroyPool(t.poolObjectsProperties[i].obj, true);
                                        if (!t.poolObjectsProperties[i].preLoadAtStart)
                                        {
                                            PoolManager.CreatePool(t.poolObjectsProperties[i].obj, t.poolObjectsProperties[i].poolAmount);
                                        }
                                    }

                                    EditorGUILayout.Space();
                                    // WillGrow
                                    t.poolObjectsProperties[i].allowGrowth = EditorTools.Toggle("Allow growth", t.poolObjectsProperties[i].allowGrowth);

                                    EditorGUILayout.BeginHorizontal();
                                    t.poolObjectsProperties[i].limitGrowth = EditorTools.Toggle("Limit growth", t.poolObjectsProperties[i].limitGrowth);
                                    if (t.poolObjectsProperties[i].limitGrowth)
                                    {
                                        t.poolObjectsProperties[i].limit = EditorGUILayout.IntField("", t.poolObjectsProperties[i].limit, GUILayout.Width(50));
                                        if (t.poolObjectsProperties[i].limit < t.poolObjectsProperties[i].poolAmount)
                                        {
                                            t.poolObjectsProperties[i].limit = t.poolObjectsProperties[i].poolAmount;
                                        }
                                    }
                                    EditorGUILayout.EndHorizontal();

                                    EditorGUI.indentLevel--;
                                } EditorTools.EndGroup();
                            }
                        }
                    }
                } EditorTools.EndGroup();
            }

            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.Space();

            #region Properties
            showProperties.boolValue = EditorTools.BeginFoldOut("Properties", showProperties.boolValue);
            if (showProperties.boolValue || showProperties.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(autonomous);
                    EditorGUILayout.PropertyField(autoTarget);
                    EditorGUILayout.PropertyField(autoReTarget, new GUIContent("Auto re-target"));
                    if (autoTarget.boolValue || autoTarget.hasMultipleDifferentValues || autoReTarget.boolValue || autoReTarget.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(maxMissileOnTarget, new GUIContent("Max on target"));
                    }
                    if (autoTarget.boolValue)
                    {
                        EditorGUILayout.HelpBox("Radar component required", MessageType.Info);
                    }
                    //Life time
                    EditorGUILayout.PropertyField(lifeTime);

                    // Layer mash
                    EditorGUILayout.PropertyField(layerMask);

                    //subweapon
                    EditorGUILayout.PropertyField(subWeapon);
                } EditorTools.EndGroup();
            }
            #endregion

            #region Damage
            showDamage.boolValue = EditorTools.BeginFoldOut("Damage", showDamage.boolValue);
            if (showDamage.boolValue || showDamage.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    // Damge
                    EditorGUILayout.PropertyField(projectileDamage, new GUIContent("At"));

                    // Type
                    EditorGUILayout.PropertyField(damageType, new GUIContent("Type"));
                    if (damageType.enumValueIndex == 1)
                    {
                        EditorGUILayout.PropertyField(damageRadius, new GUIContent("Explosion radius"));
                    }

                    // Nature
                    if (!damageNature.hasMultipleDifferentValues)
                    {
                        damageNature.intValue = EditorGUILayout.Popup("Nature", damageNature.intValue, damageLabels);
                    }
                    else
                    {
                        int tmpDamageNature = EditorGUILayout.Popup("Nature", -1, damageLabels);
                        if (tmpDamageNature != damageNature.intValue && tmpDamageNature > -1)
                        {
                            damageNature.intValue = tmpDamageNature;
                        }
                    }
                    EditorGUILayout.Space();

                    EditorGUILayout.PropertyField(randomDamagePoint, new GUIContent("Random damage"));
                    if (!randomDamagePoint.hasMultipleDifferentValues)
                    {
                        if (!randomDamagePoint.boolValue)
                        {
                            EditorGUILayout.PropertyField(damagePoint, new GUIContent("Point"));
                        }
                        else
                        {
                            EditorGUILayout.PropertyField(damagePoint, new GUIContent("Min Point"));
                            EditorGUILayout.PropertyField(damagePointMax, new GUIContent("Max Point"));
                        }
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(damagePoint, new GUIContent("Point"));
                        EditorGUILayout.PropertyField(damagePointMax, new GUIContent("Max Point"));
                    }
                    EditorGUILayout.Space();

                    EditorGUILayout.PropertyField(isPhysic, new GUIContent("Add force at impact"));
                    if (isPhysic.boolValue || isPhysic.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(force);
                        EditorGUILayout.PropertyField(forceMode);
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Projectile physic
            showPhysic.boolValue = EditorTools.BeginFoldOut("Physic", showPhysic.boolValue);
            if (showPhysic.boolValue || showPhysic.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(useAdvance);
                    EditorGUILayout.PropertyField(velocity, new GUIContent("Velocity"));
                    EditorGUILayout.PropertyField(straightTime, new GUIContent("Straight time (s)"));
                    EditorGUILayout.PropertyField(angularSpeed);
                    EditorGUILayout.PropertyField(chaos);
                    EditorGUILayout.PropertyField(chaosFrenquency);

                    EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(rayAdvance, new GUIContent("Ray Advance"));
                    EditorGUILayout.PropertyField(rayRadius, new GUIContent("Ray radius"));
                } EditorTools.EndGroup();
            }
            #endregion

            #region Effect
            showEffect.boolValue = EditorTools.BeginFoldOut("Effects", showEffect.boolValue);
            if (showEffect.boolValue || showEffect.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(impactEffect);
                    EditorGUILayout.PropertyField(deathEffect);
                    EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(timedEffect);
                    EditorGUILayout.PropertyField(time);
                } EditorTools.EndGroup();
            }
            #endregion

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();
            serializedObject.Update();

            GUILayout.Toggle(true, "<b><size=11>" + "Launcher slots" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                slots = serializedObject.FindProperty("slots");
                slots.Next(true);
                slots.Next(true);
                //EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(slots, new GUIContent("Slot count"));
                slots = serializedObject.FindProperty("slots");
                int size = slots.arraySize;
                for (int i = 0; i < size; i++)
                {
                    EditorGUI.indentLevel++;
                    SerializedProperty launcher = slots.GetArrayElementAtIndex(i);
                    EditorGUILayout.PropertyField(launcher, true);
                    EditorGUI.indentLevel--;
                }


                /*
                 * slots.Next(true);
                 * EditorGUI.indentLevel++;
                 * for (int i=0;i<size;i++){
                 *      EditorGUILayout.PropertyField(slots, new GUIContent("Slot " + i.ToString("f0")),false);
                 *
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 *      slots.Next(true);
                 * }
                 * EditorGUI.indentLevel--;*/
            } EditorTools.EndGroup();

            GUILayout.Toggle(true, "<b><size=11>" + "Button trigger" + "</size></b>", "dragtab");
            EditorTools.BeginGroup(); {
                // Fire
                int index    = System.Array.IndexOf(unityAxes, primaryFire.stringValue);
                int tmpIndex = EditorGUILayout.Popup("Fire", index, unityAxes);
                if (tmpIndex != index)
                {
                    primaryFire.stringValue = unityAxes[tmpIndex];
                }

                // Reload
                index    = System.Array.IndexOf(unityAxes, reload.stringValue);
                tmpIndex = EditorGUILayout.Popup("reload", index, unityAxes);
                if (tmpIndex != index)
                {
                    reload.stringValue = unityAxes[tmpIndex];
                }

                // Next
                index    = System.Array.IndexOf(unityAxes, next.stringValue);
                tmpIndex = EditorGUILayout.Popup("Next", index, unityAxes);
                if (tmpIndex != index)
                {
                    next.stringValue = unityAxes[tmpIndex];
                }

                // Previous
                index    = System.Array.IndexOf(unityAxes, previous.stringValue);
                tmpIndex = EditorGUILayout.Popup("Previous", index, unityAxes);
                if (tmpIndex != index)
                {
                    previous.stringValue = unityAxes[tmpIndex];
                }
            } EditorTools.EndGroup();


            serializedObject.ApplyModifiedProperties();
            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }
Exemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Space();

            #region Properties
            //GUILayout.Toggle(true,"<b><size=11>" + "Properties" + "</size></b>","dragtab");
            showProperties.boolValue = EditorTools.BeginFoldOut("Properties", showProperties.boolValue);
            if (showProperties.boolValue || showProperties.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    // Type
                    EditorGUILayout.PropertyField(projectileType, new GUIContent("Type"));

                    // Life
                    if (projectileType.enumValueIndex != 1)
                    {
                        EditorGUILayout.PropertyField(lifeTime);
                    }

                    // Layer mash
                    EditorGUILayout.PropertyField(layerMask);

                    //subweapon
                    if (projectileType.enumValueIndex != 1)
                    {
                        EditorGUILayout.PropertyField(subWeapon);
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Damage
            //GUILayout.Toggle(true,"<b><size=11>" + "Damage" + "</size></b>","dragtab");
            showDamage.boolValue = EditorTools.BeginFoldOut("Damage", showDamage.boolValue);
            if (showDamage.boolValue || showDamage.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    // Damge
                    EditorGUILayout.PropertyField(projectileDamage, new GUIContent("At"));

                    // Type
                    EditorGUILayout.PropertyField(damageType, new GUIContent("Type"));
                    if (damageType.enumValueIndex == 1)
                    {
                        EditorGUILayout.PropertyField(damageRadius, new GUIContent("Explosion radius"));
                    }

                    // Nature
                    if (!damageNature.hasMultipleDifferentValues)
                    {
                        damageNature.intValue = EditorGUILayout.Popup("Nature", damageNature.intValue, damageLabels);
                    }
                    else
                    {
                        int tmpDamageNature = EditorGUILayout.Popup("Nature", -1, damageLabels);
                        if (tmpDamageNature != damageNature.intValue && tmpDamageNature > -1)
                        {
                            damageNature.intValue = tmpDamageNature;
                        }
                    }

                    EditorGUILayout.Space();

                    EditorGUILayout.PropertyField(randomDamagePoint, new GUIContent("Random damage"));
                    if (!randomDamagePoint.hasMultipleDifferentValues)
                    {
                        if (!randomDamagePoint.boolValue)
                        {
                            EditorGUILayout.PropertyField(damagePoint, new GUIContent("Point"));
                        }
                        else
                        {
                            EditorGUILayout.PropertyField(damagePoint, new GUIContent("Min Point"));
                            EditorGUILayout.PropertyField(damagePointMax, new GUIContent("Max Point"));
                        }
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(damagePoint, new GUIContent("Point"));
                        EditorGUILayout.PropertyField(damagePointMax, new GUIContent("Max Point"));
                    }


                    EditorGUILayout.Space();

                    EditorGUILayout.PropertyField(isPhysic, new GUIContent("Add force at impact"));
                    if (isPhysic.boolValue || isPhysic.hasMultipleDifferentValues)
                    {
                        EditorGUILayout.PropertyField(force);
                        EditorGUILayout.PropertyField(forceMode);
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Projectile physic
            //GUILayout.Toggle(true,"<b><size=11>" + "Projectile physic" + "</size></b>","dragtab");
            showPhysic.boolValue = EditorTools.BeginFoldOut("Physic", showPhysic.boolValue);
            if (showPhysic.boolValue || showPhysic.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    //Velocity, Instant, Physic, Guided
                    switch (projectileType.enumValueIndex)
                    {
                    // Velocity
                    case 0:
                        EditorGUILayout.PropertyField(velocity, new GUIContent("Velocity (km/h)"));
                        EditorGUILayout.PropertyField(rayAdvance, new GUIContent("Ray Advance"));
                        EditorGUILayout.PropertyField(rayRadius, new GUIContent("Ray radius"));
                        break;

                    // Instant
                    case 1:
                        EditorGUILayout.PropertyField(rayAdvance, new GUIContent("Distance"));
                        EditorGUILayout.PropertyField(rayRadius, new GUIContent("Ray radius"));
                        break;

                    // Physic
                    case 2:
                        EditorGUILayout.PropertyField(velocity, new GUIContent("shooting Force"));
                        EditorGUILayout.PropertyField(projectileForceMode, new GUIContent("Force mode"));

                        break;
                    }
                } EditorTools.EndGroup();
            }
            #endregion

            #region Effect
            //GUILayout.Toggle(true,"<b><size=11>" + "Effect" + "</size></b>","dragtab");
            showEffect.boolValue = EditorTools.BeginFoldOut("Effects", showEffect.boolValue);
            if (showEffect.boolValue || showEffect.hasMultipleDifferentValues)
            {
                EditorTools.BeginGroup(); {
                    EditorGUILayout.PropertyField(impactEffect);
                    EditorGUILayout.PropertyField(deathEffect);
                    EditorGUILayout.Space();
                    EditorGUILayout.PropertyField(timedEffect);
                    EditorGUILayout.PropertyField(time);
                } EditorTools.EndGroup();
            }
            #endregion

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed && !EditorApplication.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            }
        }