/**
  * Called by other objects in the system, like a {@link Wallet}, when new information about the confidence of a
  * transaction becomes available.
  */
 public synchronized void setConfidenceType(ConfidenceType confidenceType)
 {
     // Don't inform the event listeners if the confidence didn't really change.
     if (confidenceType == this.confidenceType)
     {
         return;
     }
     this.confidenceType = confidenceType;
     runListeners();
 }
Beispiel #2
0
        /// <summary>
        /// Called by a <seealso cref="Peer"/> when a transaction is pending and announced by a peer. The more peers announce the
        /// transaction, the more peers have validated it (assuming your internet connection is not being intercepted).
        /// If confidence is currently unknown, sets it to <seealso cref="ConfidenceLevel#NOT_SEEN_IN_CHAIN"/>. Listeners will be
        /// invoked in this case.
        /// </summary>
        /// <param name="address"> IP address of the peer, used as a proxy for identity. </param>
        public virtual void markBroadcastBy(PeerAddress address)
        {
            lock (this)
            {
                broadcastBy.Add(address);

                if (ConfidenceLevel == ConfidenceType.UNKNOWN)
                {
                    confidenceLevel = ConfidenceType.NOT_SEEN_IN_CHAIN;
                }
            }

            OnConfidenceChanged();
        }
Beispiel #3
0
 public AIData(AggressionType Aggression, ConfidenceType Confidence, Byte EnergyLevel, Byte Responsibility, MoodType Mood, Byte[] Unused, ServicesFlag Services, Skills Teaches, Byte MaxTrainingLevel, AssistanceType Assistance, AggroRadiusBehaviorFlags AggroRadiusBehavior, Int32 AggroRadius)
 {
     this.Aggression          = Aggression;
     this.Confidence          = Confidence;
     this.EnergyLevel         = EnergyLevel;
     this.Responsibility      = Responsibility;
     this.Mood                = Mood;
     this.Unused              = Unused;
     this.Services            = Services;
     this.Teaches             = Teaches;
     this.MaxTrainingLevel    = MaxTrainingLevel;
     this.Assistance          = Assistance;
     this.AggroRadiusBehavior = AggroRadiusBehavior;
     this.AggroRadius         = AggroRadius;
 }
 /**
  * Called by a {@link Peer} when a transaction is pending and announced by a peer. The more peers announce the
  * transaction, the more peers have validated it (assuming your internet connection is not being intercepted).
  * If confidence is currently unknown, sets it to {@link ConfidenceType#NOT_SEEN_IN_CHAIN}. Listeners will be
  * invoked in this case.
  *
  * @param address IP address of the peer, used as a proxy for identity.
  */
 public void markBroadcastBy(PeerAddress address)
 {
     if (!broadcastBy.addIfAbsent(address))
     {
         return;                  // Duplicate.
     }
     synchronized(this)
     {
         if (getConfidenceType() == ConfidenceType.UNKNOWN)
         {
             this.confidenceType = ConfidenceType.NOT_SEEN_IN_CHAIN;
         }
     }
     runListeners();
 }
Beispiel #5
0
 public AIData(string Tag = null)
     : base(Tag)
 {
     Aggression          = new AggressionType();
     Confidence          = new ConfidenceType();
     EnergyLevel         = new Byte();
     Responsibility      = new Byte();
     Mood                = new MoodType();
     Unused              = new byte[3];
     Services            = new ServicesFlag();
     Teaches             = new Skills();
     MaxTrainingLevel    = new Byte();
     Assistance          = new AssistanceType();
     AggroRadiusBehavior = new AggroRadiusBehaviorFlags();
     AggroRadius         = new Int32();
 }
Beispiel #6
0
    void OnGUI()
    {
        GUILayout.Space(15);

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));
        var style = new GUIStyle(EditorStyles.boldLabel)
        {
            alignment = TextAnchor.MiddleCenter
        };

        EditorGUILayout.LabelField(new GUIContent(SettingsIcon), style, GUILayout.ExpandWidth(true), GUILayout.Height(32));
        EditorGUILayout.LabelField("Emerald AI Setup Manager - v1.0", style, GUILayout.ExpandWidth(true));
        EditorGUILayout.HelpBox("With the Emerald AI Setup Manager, you can apply an Emerald AI component to an object. Be aware that closing the Emerald Setup Manager will lose all references you've entered below. Make sure you select 'Setup AI' before closing, if you'd like your changes to be applied.", MessageType.None, true);
        GUILayout.Space(4);
        EditorGUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(15);

        EditorGUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        GUILayout.Space(25);
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

        EditorGUILayout.BeginVertical("Box");

        GUI.backgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.25f);
        EditorGUILayout.BeginVertical("Box");
        EditorGUILayout.LabelField("Setup Settings", EditorStyles.boldLabel);
        GUI.backgroundColor = Color.white;
        EditorGUILayout.EndVertical();
        GUI.backgroundColor = Color.white;

        GUILayout.Space(15);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("The object that the Emerald AI system will be added to.", MessageType.None, true);
        GUI.backgroundColor = Color.white;
        if (ObjectToSetup == null)
        {
            GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
            EditorGUILayout.LabelField("This field cannot be left blank.", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
        }
        ObjectToSetup = (GameObject)EditorGUILayout.ObjectField("AI Object", ObjectToSetup, typeof(GameObject), true);
        GUILayout.Space(10);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("Please select your AI's Behavior.", MessageType.None, true);
        GUI.backgroundColor = Color.white;
        AIBehaviorRef       = (AIBehavior)EditorGUILayout.EnumPopup("AI's Behavior", AIBehaviorRef);
        GUILayout.Space(10);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("Please select your AI's Confidence.", MessageType.None, true);
        GUI.backgroundColor = Color.white;
        ConfidenceRef       = (ConfidenceType)EditorGUILayout.EnumPopup("AI's Confidence", ConfidenceRef);
        GUILayout.Space(10);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("Please select your AI's Wander Type.", MessageType.None, true);
        GUI.backgroundColor = Color.white;
        WanderTypeRef       = (WanderType)EditorGUILayout.EnumPopup("AI's Wander Type", WanderTypeRef);
        GUILayout.Space(10);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("Would you like the Setup Manager to automatically setup Emerald's optimization settings? This allows Emerald to be deactivated when an AI is culled or not visible which will help improve performance.", MessageType.None, true);
        GUI.backgroundColor          = Color.white;
        SetupOptimizationSettingsRef = (SetupOptimizationSettings)EditorGUILayout.EnumPopup("Auto Optimize", SetupOptimizationSettingsRef);
        GUILayout.Space(10);

        GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
        EditorGUILayout.HelpBox("Would you like to setup your animations now or later?", MessageType.None, true);
        GUI.backgroundColor = Color.white;
        SetupAnimationsRef  = (SetupAnimations)EditorGUILayout.EnumPopup("Setup Animations", SetupAnimationsRef);
        if (SetupAnimationsRef == SetupAnimations.Later)
        {
            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("You can setup your animations later via the Emerald Editor.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
        }
        GUILayout.Space(10);

        if (SetupAnimationsRef == SetupAnimations.Now && ObjectToSetup == null)
        {
            GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
            EditorGUILayout.LabelField("You must have an object applied to the AI Object slot before you can create an Animator Controller for it.", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
        }

        if (SetupAnimationsRef == SetupAnimations.Now && ObjectToSetup != null)
        {
            if (ObjectToSetup.GetComponent <Animator>() != null)
            {
                AIAnimator = ObjectToSetup.GetComponent <Animator>();
            }
            else if (ObjectToSetup.GetComponent <Animator>() == null)
            {
                GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
                EditorGUILayout.LabelField("You must have an Animator Component on your AI Object in order to create an Animator Controller.", EditorStyles.helpBox);
                GUI.backgroundColor = Color.white;
            }
        }

        EditorGUI.BeginDisabledGroup(SetupAnimationsRef == SetupAnimations.Now && ObjectToSetup == null || SetupAnimationsRef == SetupAnimations.Now && ObjectToSetup != null && ObjectToSetup.GetComponent <Animator>() == null);
        if (SetupAnimationsRef == SetupAnimations.Now && overrideController == null)
        {
            if (GUILayout.Button("Create Animator Controller"))
            {
                FilePath = EditorUtility.SaveFilePanelInProject("Save as OverrideController", "New OverrideController", "overrideController", "Please enter a file name to save the file to");
                if (FilePath != string.Empty)
                {
                    _T = ObjectToSetup.transform.position;

                    AssetDatabase.CopyAsset("Assets/Emerald AI 2.0/Animator/Emerald Override.overrideController", FilePath);
                    overrideController = AssetDatabase.LoadAssetAtPath(FilePath, typeof(AnimatorOverrideController)) as AnimatorOverrideController;

                    string Temp = FilePath;
                    Temp = Temp.Replace(".overrideController", ".controller");
                    AssetDatabase.CopyAsset("Assets/Emerald AI 2.0/Animator/Temp Emerald Animator (Do Not Edit).controller", Temp);
                    overrideController.runtimeAnimatorController = AssetDatabase.LoadAssetAtPath(Temp, typeof(RuntimeAnimatorController)) as RuntimeAnimatorController;

                    AIAnimator = ObjectToSetup.GetComponent <Animator>();
                    AIAnimator.runtimeAnimatorController = overrideController;

                    ObjectToSetup.transform.position = _T;
                }
            }
        }
        EditorGUI.EndDisabledGroup();

        if (SetupAnimationsRef == SetupAnimations.Now && overrideController != null)
        {
            GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
            EditorGUILayout.LabelField("Note: Closing the Emerald Setup Manager will lose all references you've entered to the animations clips below. Make sure you select 'Setup AI' before closing, if you'd like your changes to be applied.", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.LabelField("Idle Animations", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;

            Idle1       = (AnimationClip)EditorGUILayout.ObjectField("Idle 1 Animation", Idle1, typeof(AnimationClip), true);
            Idle2       = (AnimationClip)EditorGUILayout.ObjectField("Idle 2 Animation", Idle2, typeof(AnimationClip), true);
            Idle3       = (AnimationClip)EditorGUILayout.ObjectField("Idle 3 Animation", Idle3, typeof(AnimationClip), true);
            IdleAlert   = (AnimationClip)EditorGUILayout.ObjectField("Idle Alert Animation", IdleAlert, typeof(AnimationClip), true);
            IdleWarning = (AnimationClip)EditorGUILayout.ObjectField("Idle Warning Animation", IdleWarning, typeof(AnimationClip), true);
            IdleCombat  = (AnimationClip)EditorGUILayout.ObjectField("Idle Combat Animation", IdleCombat, typeof(AnimationClip), true);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.LabelField("Movement Animations", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
            Walk      = (AnimationClip)EditorGUILayout.ObjectField("Walk Animation", Walk, typeof(AnimationClip), true);
            Run       = (AnimationClip)EditorGUILayout.ObjectField("Run Animation", Run, typeof(AnimationClip), true);
            TurnLeft  = (AnimationClip)EditorGUILayout.ObjectField("Turn Left Animation", TurnLeft, typeof(AnimationClip), true);
            TurnRight = (AnimationClip)EditorGUILayout.ObjectField("Turn Right Animation", TurnRight, typeof(AnimationClip), true);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.LabelField("Combat Animations", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
            Attack1             = (AnimationClip)EditorGUILayout.ObjectField("Attack 1 Animation", Attack1, typeof(AnimationClip), true);
            Attack2             = (AnimationClip)EditorGUILayout.ObjectField("Attack 2 Animation", Attack2, typeof(AnimationClip), true);
            Attack3             = (AnimationClip)EditorGUILayout.ObjectField("Attack 3 Animation", Attack3, typeof(AnimationClip), true);
            RunAttack           = (AnimationClip)EditorGUILayout.ObjectField("Run Attack Animation", RunAttack, typeof(AnimationClip), true);
            Hit1     = (AnimationClip)EditorGUILayout.ObjectField("Hit Animation", Hit1, typeof(AnimationClip), true);
            DeadAnim = (AnimationClip)EditorGUILayout.ObjectField("Death Animation", DeadAnim, typeof(AnimationClip), true);
        }

        GUILayout.Space(35);

        if (SetupAnimationsRef == SetupAnimations.Now && overrideController == null)
        {
            GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
            EditorGUILayout.LabelField("You must create an Animator Controller for this AI, when using the Setup Animations Now feature.", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
        }

        if (ObjectToSetup == null)
        {
            GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
            EditorGUILayout.LabelField("You must have an object applied to the AI Object slot before you can complete the setup process.", EditorStyles.helpBox);
            GUI.backgroundColor = Color.white;
        }

        EditorGUI.BeginDisabledGroup(SetupAnimationsRef == SetupAnimations.Now && overrideController == null || ObjectToSetup == null);
        if (GUILayout.Button("Setup AI"))
        {
            if (EditorUtility.DisplayDialog("Emerald AI Setup Manager", "Are you sure you'd like to setup an AI on this object?", "Setup", "Cancel"))
            {
                PrefabUtility.DisconnectPrefabInstance(ObjectToSetup);
                AssignEmeraldAIComponents();
                startVal = EditorApplication.timeSinceStartup;
            }
        }
        GUILayout.Space(25);
        EditorGUI.EndDisabledGroup();

        EditorGUILayout.EndVertical();
        EditorGUILayout.EndScrollView();
        GUILayout.Space(25);
        GUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();


        GUILayout.Space(30);

        if (secs > 0)
        {
            progress = EditorApplication.timeSinceStartup - startVal;

            if (progress < secs)
            {
                EditorUtility.DisplayProgressBar("Emerald AI Setup Manager", "Setting up AI...", (float)(progress / secs));
            }
            else
            {
                EditorUtility.ClearProgressBar();
            }
        }
    }
        /// <summary>
        /// Called by a <seealso cref="Peer"/> when a transaction is pending and announced by a peer. The more peers announce the
        /// transaction, the more peers have validated it (assuming your internet connection is not being intercepted).
        /// If confidence is currently unknown, sets it to <seealso cref="ConfidenceLevel#NOT_SEEN_IN_CHAIN"/>. Listeners will be
        /// invoked in this case.
        /// </summary>
        /// <param name="address"> IP address of the peer, used as a proxy for identity. </param>
        public virtual void markBroadcastBy(PeerAddress address)
        {
            lock (this)
            {
                broadcastBy.Add(address);

                if (ConfidenceLevel == ConfidenceType.UNKNOWN)
                {
                    confidenceLevel = ConfidenceType.NOT_SEEN_IN_CHAIN;
                }
            }

            OnConfidenceChanged();
        }
		/**
		 * Called by a {@link Peer} when a transaction is pending and announced by a peer. The more peers announce the
		 * transaction, the more peers have validated it (assuming your internet connection is not being intercepted).
		 * If confidence is currently unknown, sets it to {@link ConfidenceType#NOT_SEEN_IN_CHAIN}. Listeners will be
		 * invoked in this case.
		 *
		 * @param address IP address of the peer, used as a proxy for identity.
		 */
		public void markBroadcastBy(PeerAddress address) {
			if (!broadcastBy.addIfAbsent(address))
				return;  // Duplicate.
			synchronized (this) {
				if (getConfidenceType() == ConfidenceType.UNKNOWN) {
					this.confidenceType = ConfidenceType.NOT_SEEN_IN_CHAIN;
				}
			}
			runListeners();
		}
		/**
		 * Called by other objects in the system, like a {@link Wallet}, when new information about the confidence of a 
		 * transaction becomes available.
		 */
		public synchronized void setConfidenceType(ConfidenceType confidenceType) {
			// Don't inform the event listeners if the confidence didn't really change.
			if (confidenceType == this.confidenceType)
				return;
			this.confidenceType = confidenceType;
			runListeners();
		}
Beispiel #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ID">
 /// A <see cref="System.Int32"/> to uniquely identify the peptide
 /// </param>
 /// <param name="Seq">
 /// A <see cref="System.String"/> with the peptide sequence
 /// </param>
 public Peptide( int ID, string Seq )
 {
     this.ID = ID;
     this.Sequence = Seq;
     Confidence = Peptide.ConfidenceType.Green;
     Decoy = false;
     Relation = Peptide.RelationType.NonDiscriminating;
     Proteins = new List<Protein>();
     Runs = new List<int>();
     Names = new SortedList<string, string>();
     Variants = new List<List<PTM>>();
     NewVariant();
 }
Beispiel #11
0
        void OnGUI()
        {
            GUILayout.Space(15);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical("Box");
            var style = new GUIStyle(EditorStyles.boldLabel)
            {
                alignment = TextAnchor.MiddleCenter
            };

            EditorGUILayout.LabelField(new GUIContent(SettingsIcon), style, GUILayout.ExpandWidth(true), GUILayout.Height(32));
            EditorGUILayout.LabelField("Emerald AI Setup Manager", style, GUILayout.ExpandWidth(true));
            EditorGUILayout.HelpBox("The Emerald AI Setup Manager applies all needed settings and components to automatically create an AI on the applied object. Be aware that closing the Emerald Setup Manager will lose all references you've entered below. Make sure you select 'Setup AI' before closing, if you'd like your changes to be applied.", MessageType.None, true);
            GUILayout.Space(4);

            var HelpButtonStyle = new GUIStyle(GUI.skin.button);

            HelpButtonStyle.normal.textColor = Color.white;
            HelpButtonStyle.fontStyle        = FontStyle.Bold;

            GUI.backgroundColor = new Color(1f, 1, 0.25f, 0.25f);
            EditorGUILayout.LabelField("For a detailed tutorial on setting up an AI from start to finish, please see the Getting Started Tutorial below.", EditorStyles.helpBox);
            GUI.backgroundColor = new Color(0, 0.65f, 0, 0.8f);
            if (GUILayout.Button("See the Getting Started Tutorial", HelpButtonStyle, GUILayout.Height(20)))
            {
                Application.OpenURL("https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Creating-a-New-AI");
            }
            GUI.backgroundColor = Color.white;
            GUILayout.Space(10);

            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(15);

            EditorGUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Space(25);
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            EditorGUILayout.BeginVertical("Box");

            GUI.backgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.25f);
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Setup Settings", EditorStyles.boldLabel);
            GUI.backgroundColor = Color.white;
            EditorGUILayout.EndVertical();
            GUI.backgroundColor = Color.white;

            GUILayout.Space(15);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The object that the Emerald AI system will be added to.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            if (ObjectToSetup == null)
            {
                GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
                EditorGUILayout.LabelField("This field cannot be left blank.", EditorStyles.helpBox);
                GUI.backgroundColor = Color.white;
            }
            ObjectToSetup = (GameObject)EditorGUILayout.ObjectField("AI Object", ObjectToSetup, typeof(GameObject), true);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Unity Tag that will be applied to your AI. Note: Untagged cannot be used.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            AITag = EditorGUILayout.TagField("Tag for AI", AITag);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Unity Layer that will be applied to your AI. Note: Default cannot be used.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            AILayer             = EditorGUILayout.LayerField("Layer for AI", AILayer);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Behavior that will be applied to this AI.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            AIBehaviorRef       = (AIBehavior)EditorGUILayout.EnumPopup("AI's Behavior", AIBehaviorRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Confidence that will be applied to this AI.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            ConfidenceRef       = (ConfidenceType)EditorGUILayout.EnumPopup("AI's Confidence", ConfidenceRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Wander Type  that will be applied to this AI.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            WanderTypeRef       = (WanderType)EditorGUILayout.EnumPopup("AI's Wander Type", WanderTypeRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("Would you like the Setup Manager to automatically setup Emerald's optimization settings? This allows Emerald to be deactivated when an AI is culled or not visible which will help improve performance.", MessageType.None, true);
            GUI.backgroundColor          = Color.white;
            SetupOptimizationSettingsRef = (SetupOptimizationSettings)EditorGUILayout.EnumPopup("Auto Optimize", SetupOptimizationSettingsRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("The Weapon Type this AI will use.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            WeaponTypeRef       = (WeaponType)EditorGUILayout.EnumPopup("Weapon Type", WeaponTypeRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("Controls whether this AI will play an animation on death or transition to a ragdoll state.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            DeathTypeRef        = (DeathType)EditorGUILayout.EnumPopup("Death Type", DeathTypeRef);
            GUILayout.Space(10);

            GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
            EditorGUILayout.HelpBox("Controls whether this AI will use Root Motion or NavMesh for its movement and speed.", MessageType.None, true);
            GUI.backgroundColor = Color.white;
            AnimatorType        = (AnimatorTypeState)EditorGUILayout.EnumPopup("Animator Type", AnimatorType);
            GUILayout.Space(30);

            if (ObjectToSetup == null)
            {
                GUI.backgroundColor = new Color(10f, 0.0f, 0.0f, 0.25f);
                EditorGUILayout.LabelField("You must have an object applied to the AI Object slot before you can complete the setup process.", EditorStyles.helpBox);
                GUI.backgroundColor = Color.white;
            }

            EditorGUI.BeginDisabledGroup(ObjectToSetup == null);
            if (GUILayout.Button("Setup AI"))
            {
                if (EditorUtility.DisplayDialog("Emerald AI Setup Manager", "Are you sure you'd like to setup an AI on this object?", "Setup", "Cancel"))
                {
                    #if UNITY_2018_3_OR_NEWER
                    PrefabAssetType m_AssetType = PrefabUtility.GetPrefabAssetType(ObjectToSetup);

                    //Only unpack prefab if the ObjectToSetup is a prefab.
                    if (m_AssetType != PrefabAssetType.NotAPrefab)
                    {
                        PrefabUtility.UnpackPrefabInstance(ObjectToSetup, PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
                    }
                    #else
                    PrefabUtility.DisconnectPrefabInstance(ObjectToSetup);
                    #endif
                    AssignEmeraldAIComponents();
                    startVal = EditorApplication.timeSinceStartup;
                }
            }
            GUILayout.Space(25);
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            GUILayout.Space(25);
            GUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();


            GUILayout.Space(30);

            if (secs > 0)
            {
                progress = EditorApplication.timeSinceStartup - startVal;

                if (progress < secs)
                {
                    EditorUtility.DisplayProgressBar("Emerald AI Setup Manager", "Setting up AI...", (float)(progress / secs));
                }
                else
                {
                    EditorUtility.ClearProgressBar();

                    if (DisplayConfirmation && !DontShowDisplayConfirmation)
                    {
                        if (EditorUtility.DisplayDialog("Emerald AI Setup Manager - Success", "Your AI has been successfully created! You will still need to create an Animator Controller, " +
                                                        "apply your AI's Animations, and assign the AI's Head Transform from within the Emerald AI Editor. You may also need to adjust the generated Box Collider's " +
                                                        "position and size to properly fit your AI's model.", "Okay", "Okay, Don't Show Again"))
                        {
                            DisplayConfirmation = false;
                        }
                        else
                        {
                            DisplayConfirmation         = false;
                            DontShowDisplayConfirmation = true;
                        }
                    }
                }
            }
        }