private static void DrawPickableWeaponGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); properties.SetName(EditorGUILayout.TextField(ContentProperties.Name, properties.GetName())); properties.SetProcessingType((PickableItem.PickupType)EditorGUILayout.EnumPopup(ContentProperties.PickupType, properties.GetProcessingType())); properties.SetObjectType((PickableItem.ItemType)EditorGUILayout.EnumPopup(ContentProperties.ObjecftType, properties.GetObjectType())); if (properties.GetProcessingType() == PickableItem.PickupType.ByKey) { properties.SetPickUpKey((KeyCode)EditorGUILayout.EnumPopup(ContentProperties.PickupKey, properties.GetPickUpKey())); } GUILayout.Space(10); GUILayout.Label(ContentProperties.ItemProperties, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); properties.SetClearWeapon(UEditor.ObjectField <GameObject>(ContentProperties.Item, properties.GetClearWeapon(), true)); if (properties.GetClearWeapon() == null) { UEditorHelpBoxMessages.Error("Item cannot be empty!", "Add item game object!"); } switch (properties.GetObjectType()) { case PickableItem.ItemType.Weapon: properties.SetWeaponID(UEditor.ObjectField <WeaponID>(ContentProperties.Weapon, properties.GetWeaponID(), true)); properties.AutoActivate(EditorGUILayout.Toggle(ContentProperties.AutoActivate, properties.AutoActivate())); break; case PickableItem.ItemType.Ammo: properties.SetWeaponID(UEditor.ObjectField <WeaponID>(new GUIContent("Target Weapon", "Target weapon for ammo."), properties.GetWeaponID(), true)); properties.SetValue(EditorGUILayout.IntField(new GUIContent("Bullets", "How many bullet add in weapon ammo."), properties.GetValue())); break; case PickableItem.ItemType.HealthBox: properties.SetValue(EditorGUILayout.IntField(new GUIContent("Health Point", "How many health point add in target."), properties.GetValue())); break; } if (!properties.DestroyAfterUse()) { float refReusableDelay = properties.GetReusableDelay(); bool refIsReusable = properties.IsReusable(); UEditor.HiddenFloatField(ContentProperties.ReusableDelay, ContentProperties.IsReusable, ref refReusableDelay, ref refIsReusable); properties.SetReusableDelay(refReusableDelay); properties.IsReusable(refIsReusable); } else { EditorGUI.BeginDisabledGroup(true); properties.IsReusable(EditorGUILayout.Toggle(ContentProperties.IsReusable, false)); EditorGUI.EndDisabledGroup(); } if (!properties.IsReusable()) { properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, properties.DestroyAfterUse())); } else { EditorGUI.BeginDisabledGroup(true); properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, false)); EditorGUI.EndDisabledGroup(); } GUILayout.Space(10); GUILayout.Label(ContentProperties.UI, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); if (properties.GetWeaponID() != null) { GUILayout.BeginHorizontal(); properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage())); if (UEditor.GenerateButton()) { properties.SetPickUpMessage("HOLD [{0}] TO PICKUP \"{1}\""); } GUILayout.EndHorizontal(); } else { properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage())); } if (properties.GetWeapon() != null) { GUILayout.BeginHorizontal(); properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage())); if (UEditor.GenerateButton()) { properties.SetPickUpMessage("HOLD [{0}] TO CHANGE \"{1}\""); } GUILayout.EndHorizontal(); } else { properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage())); } GUILayout.Space(10); GUILayout.Label(ContentProperties.Effects, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); AudioClip se = properties.GetSoundEffect(); UEditor.ObjectHiddenField <AudioClip>(ContentProperties.P_SoundEffect, ContentProperties.P_SoundEffect, ref se, ref useSoundEffect); properties.SetSoundEffect(useSoundEffect ? se : null); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(!properties.NameIsValid() || properties.GetClearWeapon() == null); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { weapon = CreatePickableWeapon(properties); } EditorGUI.EndDisabledGroup(); if (weapon != null && delay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "Pickable weapon was created on scene!\nSetup weapon components before start play.", "Select", "Ok")) { Selection.activeGameObject = weapon; } weapon = null; } GUILayout.Space(5); GUILayout.EndVertical(); }