示例#1
0
        private static void PhysicsBulletGUI()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Space(5);
            GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);

            physicsBulletProperties.SetBulletType((PhysicsBullet.BulletType)EditorGUILayout.EnumPopup(ContentProperties.BulletType, physicsBulletProperties.GetBulletType()));
            physicsBulletProperties.SetBullet(UEditor.ObjectField <GameObject>(new GUIContent("Bullet", "Bullet gameobject."), physicsBulletProperties.GetBullet(), true));
            if (physicsBulletProperties.GetBullet() == null)
            {
                UEditorHelpBoxMessages.Error("Bullet object cannot be empty!", "Add bullet gameobject.");
            }
            physicsBulletProperties.SetModel(EditorGUILayout.TextField(ContentProperties.Model, physicsBulletProperties.GetModel()));
            physicsBulletProperties.SetDamage(EditorGUILayout.IntField(ContentProperties.Damage, physicsBulletProperties.GetDamage()));
            physicsBulletProperties.SetDelay(EditorGUILayout.FloatField(ContentProperties.Delay, physicsBulletProperties.GetDelay()));

            if (physicsBulletProperties.GetBulletType() == PhysicsBullet.BulletType.Standard)
            {
                physicsBulletProperties.SetVariance(EditorGUILayout.FloatField(ContentProperties.Variance, physicsBulletProperties.GetVariance()));
                physicsBulletProperties.SetNumberBullet(EditorGUILayout.IntField(ContentProperties.NumberBullet, physicsBulletProperties.GetNumberBullet()));
            }
            else if (physicsBulletProperties.GetBulletType() == PhysicsBullet.BulletType.Rocket)
            {
                physicsBulletProperties.SetExplosionRadius(EditorGUILayout.FloatField(ContentProperties.B_ExplosionRadius, physicsBulletProperties.GetExplosionRadius()));
                physicsBulletProperties.SetExplosionPower(EditorGUILayout.FloatField(ContentProperties.B_ExplosionPower, physicsBulletProperties.GetExplosionPower()));
                physicsBulletProperties.SetExplosionEffect(UEditor.ObjectField <ParticleSystem>(ContentProperties.B_ExplosionEffect, physicsBulletProperties.GetExplosionEffect(), true));
                physicsBulletProperties.SetExplosionSound(UEditor.ObjectField <AudioClip>(ContentProperties.ExplosionSound, physicsBulletProperties.GetExplosionSound(), true));
            }
            physicsBulletProperties.SetDecalProperties(UEditor.ObjectField <DecalProperties>(ContentProperties.DecalProperties, physicsBulletProperties.GetDecalProperties(), false));

            GUILayout.Space(5);
            UEditor.HorizontalLine();
            GUILayout.Space(5);

            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(physicsBulletProperties.GetModel()) || physicsBulletProperties.GetBullet() == null);
            if (UEditor.Button("Create", "Right", GUILayout.Width(70)))
            {
                createdObject = CreatePhysicsBullet(physicsBulletProperties);
            }
            EditorGUI.EndDisabledGroup();

            if (createdObject != null && editorDelay.WaitForSeconds())
            {
                if (UDisplayDialogs.Message("Create Successful", "Physics bullet was created on scene!\nSetup bullet components before start play.", "Select", "Ok"))
                {
                    Selection.activeGameObject = createdObject;
                }
                createdObject = null;
            }
            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
示例#2
0
        private static void DrawProperties()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Space(5);
            GUILayout.Label("Base Options", UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(5);
            if (properties != null)
            {
                properties.SetAIType((AIProperties.AIType)EditorGUILayout.EnumPopup(ContentProperties.Type, properties.GetAIType()));
                properties.SetName(EditorGUILayout.DelayedTextField(ContentProperties.Name, properties.GetName()));
                if (properties.GetName() == "")
                {
                    properties.SetDefaultName();
                }
                properties.SetModel((GameObject)EditorGUILayout.ObjectField(ContentProperties.Model, properties.GetModel(), typeof(GameObject), true));
                if (properties.GetModel() == null)
                {
                    UEditorHelpBoxMessages.Error("AI model cannot be empty!", "Add AI model.");
                }
                properties.SetController((AnimatorController)EditorGUILayout.ObjectField(ContentProperties.Controller, properties.GetController(), typeof(AnimatorController), true));
                properties.DefaultPreset(EditorGUILayout.Toggle(ContentProperties.DefaultPreset, properties.DefaultPreset()));

                if (properties.DefaultPreset())
                {
                    properties.SetDefaultPreset();
                }

                EditorGUI.BeginDisabledGroup(properties.DefaultPreset());
                LayerMask targetMask = EditorGUILayout.MaskField(ContentProperties.Tagrets, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(properties.GetTargets()), InternalEditorUtility.layers);
                properties.SetTargets(InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(targetMask));
                LayerMask obstacleMask = EditorGUILayout.MaskField(ContentProperties.Obstacles, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(properties.GetObstacles()), InternalEditorUtility.layers);
                properties.SetObstacles(InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(obstacleMask));
                EditorGUI.EndDisabledGroup();

                GUILayout.Space(5);
                UEditor.HorizontalLine();
                GUILayout.Space(5);
                EditorGUI.BeginDisabledGroup(!properties.GetModel());
                if (UEditor.Button("Create", "Right", GUILayout.Width(70)))
                {
                    _AI = CreateAI(properties);
                }
                if (_AI != null && delay.WaitForSeconds())
                {
                    if (UDisplayDialogs.Message("Create Successful", "AI was created on scene!\nSetup AI components before start play.", "Select", "Ok"))
                    {
                        Selection.activeGameObject = _AI;
                    }
                    _AI = null;
                }
                EditorGUI.EndDisabledGroup();
            }
            else
            {
                UEditorHelpBoxMessages.Error("Properties not loaded...", "Try to reload UProject Manager window.", true);
            }
            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
        private static void DrawFPWeaponGUI()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Space(5);
            GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel);
            GUILayout.Space(7);
            properties.SetName(EditorGUILayout.TextField(ContentProperties.WeaponName, properties.GetName()));
            properties.SetWeaponType((WeaponProperties.Type)EditorGUILayout.EnumPopup(ContentProperties.WeaponType, properties.GetWeaponType()));
            properties.SetWeapon(UEditor.ObjectField <GameObject>(ContentProperties.WeaponObject, properties.GetWeapon(), true));
            if (properties.GetWeapon() == null)
            {
                UEditorHelpBoxMessages.Error("Weapon model cannot be empty!", "Add weapon model.");
            }

            properties.SetWeaponID(UEditor.ObjectField <WeaponID>(ContentProperties.WeaponID, properties.GetWeaponID(), true));

            properties.SetController(UEditor.ObjectField <RuntimeAnimatorController>(ContentProperties.WeaponAnimator, properties.GetController(), false));
            GUILayout.Space(10);
            additionalComponentsRL.DoLayoutList();

            GUILayout.Space(5);
            UEditor.HorizontalLine();
            GUILayout.Space(5);

            EditorGUI.BeginDisabledGroup(!properties.NameIsValid() || properties.GetWeapon() == null);
            if (UEditor.Button("Create", "Right", GUILayout.Width(70)))
            {
                weapon = CreateFPWeapon(properties);
            }
            EditorGUI.EndDisabledGroup();

            if (weapon != null && delay.WaitForSeconds())
            {
                if (UDisplayDialogs.Message("Create Successful", "Weapon was created on scene!\nSetup weapon components before start play.", "Select", "Ok"))
                {
                    Selection.activeGameObject = weapon;
                }
                weapon = null;
            }

            GUILayout.Space(5);
            GUILayout.EndVertical();
        }