예제 #1
0
        public static void DrawEnabledButton <T>(ICEDataObject _object, EditorHeaderType _type, List <T> _list) where T : new()
        {
            if (_object == null || _list == null)
            {
                return;
            }

            if (IsEnabledType(_type))
            {
                bool _enabled = ICEEditorLayout.EnableButton(_object.Enabled);

                // if enabled was canged to true we will prepare some thinks to optimize the handling for the user
                if (_enabled && _enabled != _object.Enabled)
                {
                    // if the list is empty we will insert a first item
                    if (_list.Count == 0)
                    {
                        _list.Add(ICEObjectFactory.Create <T>());
                    }

                    // we foldout the parent object
                    _object.Foldout = true;
                }

                // update the enabled status of the parent object
                _object.Enabled = _enabled;
            }
        }
예제 #2
0
        /// <summary>
        /// Draws the object header line.
        /// </summary>
        /// <param name="_object">Object.</param>
        /// <param name="_type">Type.</param>
        /// <param name="_bold">If set to <c>true</c> bold.</param>
        /// <param name="_title">Title.</param>
        /// <param name="_hint">Hint.</param>
        /// <param name="_help">Help.</param>
        public static void DrawObjectHeaderLine(ICEDataObject _object, EditorHeaderType _type, string _title, string _hint, string _help = "")
        {
            if (_object == null)
            {
                return;
            }

            DrawObjectHeaderLine(ref _object.Enabled, ref _object.Foldout, _type, _title, _hint, _help);
        }
예제 #3
0
        /// <summary>
        /// Begins the object content or return.
        /// </summary>
        /// <returns><c>true</c>, if object content or return was begun, <c>false</c> otherwise.</returns>
        /// <param name="_type">Type.</param>
        /// <param name="_object">Object.</param>
        public static bool BeginObjectContentOrReturn(EditorHeaderType _type, ICEDataObject _object)
        {
            if (_object == null)
            {
                return(true);
            }

            return(BeginObjectContentOrReturn(_type, _object.Enabled, _object.Foldout));
        }
예제 #4
0
        /// <summary>
        /// Begins the object content or return.
        /// </summary>
        /// <returns><c>true</c>, if object content or return was begun, <c>false</c> otherwise.</returns>
        /// <param name="_type">Type.</param>
        /// <param name="_object">Object.</param>
        public static bool BeginObjectContentOrReturn(EditorHeaderType _type, bool _enabled, bool _foldout)
        {
            if ((IsFoldoutType(_type) && _foldout == false) || (!IsFoldoutType(_type) && _foldout == false))
            {
                return(true);
            }

            EditorGUI.BeginDisabledGroup(_enabled == false);
            EditorGUI.indentLevel++;
            return(false);
        }
예제 #5
0
        /// <summary>
        /// Determines if is enabled foldout type the specified _type.
        /// </summary>
        /// <returns><c>true</c> if is enabled foldout type the specified _type; otherwise, <c>false</c>.</returns>
        /// <param name="_type">Type.</param>
        public static bool IsEnabledFoldoutType(EditorHeaderType _type)
        {
            switch (_type)
            {
            case EditorHeaderType.FOLDOUT_ENABLED:
            case EditorHeaderType.FOLDOUT_ENABLED_BOLD:
                return(true);

            default:
                return(false);
            }
        }
        /// <summary>
        /// Draws the content of the behaviour mode.
        /// </summary>
        /// <param name="_control">Control.</param>
        /// <param name="_mode">Mode.</param>
        public static void DrawBehaviourModeContent(ICECreatureControl _control, BehaviourModeObject _mode)
        {
            if (_mode == null)
            {
                return;
            }

            EditorHeaderType _header = EditorHeaderType.FOLDOUT_ENABLED_BOLD;

            EditorGUI.indentLevel++;
            CreatureObjectEditor.DrawBehaviourModeFavouredObject(_control, _mode.Favoured, _header, Info.BEHAVIOUR_MODE_FAVOURED);
            EditorGUI.indentLevel--;

            if (_mode.Rules.Count > 1)
            {
                ICEEditorLayout.Label("Rules", true, Info.BEHAVIOUR_MODE_RULE);
                EditorGUI.indentLevel++;
                ICEEditorLayout.BeginHorizontal();
                _mode.RulesOrderType = (SequenceOrderType)ICEEditorLayout.EnumPopup("Order Type", "", _mode.RulesOrderType);
                EditorGUI.BeginDisabledGroup(_mode.RulesOrderType != SequenceOrderType.CYCLE);
                _mode.RulesOrderInverse = ICEEditorLayout.CheckButtonMiddle("INVERSE", "", _mode.RulesOrderInverse);
                EditorGUI.EndDisabledGroup();
                ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR_MODE_RULES_ORDER);
                EditorGUI.indentLevel--;
            }

            for (int i = 0; i < _mode.Rules.Count; i++)
            {
                DrawBehaviourModeRule(_control, _mode, i, _mode.Rules, _mode.Key);
            }

            if (_mode.Rules.Count == 1)
            {
                ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                ICEEditorLayout.BeginHorizontal();
                EditorGUILayout.LabelField("Add or Copy Behaviour Rule", EditorStyles.miniLabel);
                if (ICEEditorLayout.AddButton("Add Behaviour Rule"))
                {
                    _mode.Rules.Add(new BehaviourModeRuleObject());
                }
                if (ICEEditorLayout.CopyButtonMiddle("Copy Behaviour Rule"))
                {
                    _mode.Rules.Add(new BehaviourModeRuleObject(_mode.Rules[0]));
                }
                ICEEditorLayout.EndHorizontal("Add or Copy Behaviour Rule");
            }
            else
            {
                ICEEditorLayout.DrawListAddLine <BehaviourModeRuleObject>(_mode.Rules, new BehaviourModeRuleObject(), true, "Add Behaviour Rule", Info.BEHAVIOUR_MODE_RULE_ADD);
            }

            //EditorGUILayout.Separator();
        }
예제 #7
0
        public static void DrawEnabledButton(ICEDataObject _object, EditorHeaderType _type)
        {
            if (IsEnabledType(_type))
            {
                bool _enabled = ICEEditorLayout.EnableButton(_object.Enabled);

                if (_enabled && _enabled != _object.Enabled)
                {
                    _object.Foldout = true;
                }

                _object.Enabled = _enabled;
            }
        }
예제 #8
0
        /// <summary>
        /// Determines if is header required the specified _type.
        /// </summary>
        /// <returns><c>true</c> if is header required the specified _type; otherwise, <c>false</c>.</returns>
        /// <param name="_type">Type.</param>
        public static bool IsHeaderRequired(EditorHeaderType _type)
        {
            switch (_type)
            {
            case EditorHeaderType.NONE:
            case EditorHeaderType.FOLDOUT_CUSTOM:
            case EditorHeaderType.TOGGLE_CUSTOM:
            case EditorHeaderType.LABEL_CUSTOM:
                return(false);

            default:
                return(true);
            }
        }
예제 #9
0
        /// <summary>
        /// Gets the simple foldout.
        /// </summary>
        /// <returns>The simple foldout.</returns>
        /// <param name="_type">Type.</param>
        public static EditorHeaderType GetSimpleFoldout(EditorHeaderType _type)
        {
            switch (_type)
            {
            case EditorHeaderType.FOLDOUT_ENABLED_BOLD:
                return(EditorHeaderType.FOLDOUT_BOLD);

            case EditorHeaderType.FOLDOUT_ENABLED:
                return(EditorHeaderType.FOLDOUT);

            default:
                return(_type);
            }
        }
예제 #10
0
        /// <summary>
        /// Draws the object header.
        /// </summary>
        /// <param name="_object">Object.</param>
        /// <param name="_type">Type.</param>
        /// <param name="_bold">If set to <c>true</c> bold.</param>
        /// <param name="_title">Title.</param>
        /// <param name="_hint">Hint.</param>
        /// <param name="_help">Help.</param>
        public static void DrawObjectHeader(ICEDataObject _object, EditorHeaderType _type, string _title, string _hint = "", string _help = "")
        {
            if (_object == null || IsHeaderRequired(_type) == false)
            {
                return;
            }

            if (!IsEnabledType(_type))
            {
                _object.Enabled = true;
            }

            ICEEditorLayout.BeginHorizontal();
            DrawObjectHeaderLine(_object, _type, _title, _hint);
            ICEEditorLayout.EndHorizontal(_help);
        }
예제 #11
0
        public static bool DrawAddButton <T>(ICEDataObject _object, EditorHeaderType _type, List <T> _list) where T : new()
        {
            if (_object == null || _list == null)
            {
                return(false);
            }

            if (ICEEditorLayout.AddButtonSmall(""))
            {
                _list.Add(ICEObjectFactory.Create <T>());

                _object.Enabled = true;
                _object.Foldout = true;
                return(true);
            }
            return(false);
        }
예제 #12
0
        /// <summary>
        /// Determines if the specified type requires a enabled button.
        /// </summary>
        /// <returns><c>true</c> if is enabled type the specified _type; otherwise, <c>false</c>.</returns>
        /// <param name="_type">Type.</param>
        public static bool IsEnabledType(EditorHeaderType _type)
        {
            switch (_type)
            {
            case EditorHeaderType.TOGGLE:
            case EditorHeaderType.TOGGLE_CUSTOM:
            case EditorHeaderType.TOGGLE_LEFT:
            case EditorHeaderType.TOGGLE_LEFT_BOLD:
            case EditorHeaderType.FOLDOUT_ENABLED:
            case EditorHeaderType.FOLDOUT_ENABLED_BOLD:
            case EditorHeaderType.LABEL_ENABLED:
            case EditorHeaderType.LABEL_ENABLED_BOLD:
                return(true);

            default:
                return(false);
            }
        }
예제 #13
0
        public static void DrawAnimationEventData(ICEWorldBehaviour _component, AnimationEventsObject _events, AnimationClip _clip, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "")
        {
            if (_events == null || _clip == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Animation Events";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.ANIMATION_EVENTS;
            }

            ICEEditorLayout.BeginHorizontal();

            if (IsEnabledFoldoutType(_type))
            {
                EditorGUI.BeginDisabledGroup(_events.Enabled == false);
            }

            DrawObjectHeaderLine(_events, GetSimpleFoldout(_type), _title, _hint);

            EditorGUI.BeginDisabledGroup(_events.Enabled == false);
            if (ICEEditorLayout.AddButtonSmall(""))
            {
                _events.Events.Add(new AnimationEventObject());
            }

            EditorGUI.BeginDisabledGroup(_events.Events.Count == 0);
            if (ICEEditorLayout.ClearButtonSmall <AnimationEventObject>(_events, _events.Events, ""))
            {
                AnimationUtility.SetAnimationEvents(_clip, _events.GetAnimationEvents());
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();

            if (IsEnabledFoldoutType(_type))
            {
                EditorGUI.EndDisabledGroup();
                bool _enabled = ICEEditorLayout.EnableButton(_events.Enabled);

                if (_enabled != _events.Enabled)
                {
                    _events.Enabled = _enabled;
                    if (_events.Enabled == false)
                    {
                        AnimationUtility.SetAnimationEvents(_clip, new AnimationEvent[0]);
                    }
                }
            }
            ICEEditorLayout.EndHorizontal(_help);

            // CONTENT BEGIN
            if (BeginObjectContentOrReturn(_type, _events))
            {
                return;
            }

            AnimationEvent[] _clip_events = AnimationUtility.GetAnimationEvents(_clip);

            _events.UpdateAnimationEvents(_clip_events);

            for (int i = 0; i < _events.Events.Count; i++)
            {
                AnimationEventObject _animation_event = _events.Events[i];
                ICEEditorLayout.BeginHorizontal();


                _animation_event = WorldPopups.AnimationEventPopupLine(_component, _animation_event, _component.BehaviourEvents, ref _animation_event.UseCustomFunction, "", "Event #" + i, "");

                bool _active = ICEEditorLayout.CheckButtonMiddle("ACTIVE", "", _animation_event.IsActive);

                if (_active != _animation_event.IsActive)
                {
                    _animation_event.IsActive = _active;
                    AnimationUtility.SetAnimationEvents(_clip, _events.GetAnimationEvents());
                }

                if (ICEEditorLayout.ListDeleteButtonMini <AnimationEventObject>(_events.Events, _animation_event, "Removes this animation event."))
                {
                    AnimationUtility.SetAnimationEvents(_clip, _events.GetAnimationEvents());
                    return;
                }

                ICEEditorLayout.EndHorizontal(Info.ANIMATION_EVENTS_METHOD_POPUP);

                EditorGUI.indentLevel++;

                if (_animation_event.ParameterType == AnimationEventParameterType.Integer)
                {
                    _animation_event.ParameterInteger = ICEEditorLayout.Integer("Parameter Integer", "", _animation_event.ParameterInteger, Info.EVENT_PARAMETER_INTEGER);
                }
                else if (_animation_event.ParameterType == AnimationEventParameterType.Float)
                {
                    _animation_event.ParameterFloat = ICEEditorLayout.Float("Parameter Float", "", _animation_event.ParameterFloat, Info.EVENT_PARAMETER_FLOAT);
                }
                else if (_animation_event.ParameterType == AnimationEventParameterType.String)
                {
                    _animation_event.ParameterString = ICEEditorLayout.Text("Parameter String", "", _animation_event.ParameterString, Info.EVENT_PARAMETER_STRING);
                }

                _animation_event.Time = ICEEditorLayout.Slider("Time", "The time at which the event will be fired off.", _animation_event.Time, 0.0001f, 0, _clip.length, Info.ANIMATION_EVENTS_METHOD_TIME);

                EditorGUI.indentLevel--;
            }

            if (_events.UpdateRequired(_clip_events))
            {
                AnimationUtility.SetAnimationEvents(_clip, _events.GetAnimationEvents());
            }

            EndObjectContent();
            // CONTENT END
        }
예제 #14
0
        public static void DrawAnimationDataObject(ICEWorldBehaviour _component, AnimationDataObject _anim, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "", List <AnimationDataObject> _list = null)
        {
            if (_anim == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Animation";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.ANIMATION;
            }

            //--------------------------------------------------
            // ANIMATION
            //--------------------------------------------------

            bool _enabled = _anim.Enabled;

            //_anim.Enabled = (_anim.InterfaceType != AnimationInterfaceType.NONE?true:false);

            ICEEditorLayout.BeginHorizontal();

            if (WorldObjectEditor.IsEnabledFoldoutType(_type))
            {
                EditorGUI.BeginDisabledGroup(_anim.Enabled == false);
            }

            WorldObjectEditor.DrawObjectHeaderLine(_anim, WorldObjectEditor.GetSimpleFoldout(_type), _title, _hint);
            GUILayout.FlexibleSpace();
            //EditorGUI.BeginDisabledGroup( _anim.Enabled == false );
            _anim.AllowInterfaceSelector = !ICEEditorLayout.CheckButtonMiddle("AUTO", "Automatic Interface Selection", !_anim.AllowInterfaceSelector);
            //EditorGUI.EndDisabledGroup();

            if (_list != null && _list.Count > 1)
            {
                if (ICEEditorLayout.Button("SHARE", "Use this move settings for all associated rules"))
                {
                    foreach (AnimationDataObject _data in _list)
                    {
                        _data.Copy(_anim);
                    }
                }
            }

            if (WorldObjectEditor.IsEnabledFoldoutType(_type))
            {
                EditorGUI.EndDisabledGroup();
                _anim.Enabled = ICEEditorLayout.EnableButton(_anim.Enabled);
            }

            ICEEditorLayout.EndHorizontal(_help);

            if (_enabled != _anim.Enabled && _anim.Enabled == true)
            {
                _anim.Foldout = true;
            }



            // CONTENT BEGIN
            if (WorldObjectEditor.BeginObjectContentOrReturn(_type, _anim))
            {
                return;
            }

            if ((_component.GetComponentInChildren <Animator>() != null && _component.GetComponentInChildren <Animation>() != null) || _anim.AllowInterfaceSelector)
            {
                if (_anim.InterfaceType == AnimationInterfaceType.NONE && _component.GetComponentInChildren <Animator>() != null && _component.GetComponentInChildren <Animator>().runtimeAnimatorController != null)
                {
                    _anim.InterfaceType = AnimationInterfaceType.MECANIM;
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.NONE)
                {
                    _anim.InterfaceType = AnimationInterfaceType.LEGACY;
                }

                _help = Info.ANIMATION_NONE;
                if (_anim.InterfaceType == AnimationInterfaceType.MECANIM)
                {
                    _help = Info.ANIMATION_ANIMATOR;
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY)
                {
                    _help = Info.ANIMATION_ANIMATION;
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.CLIP)
                {
                    _help = Info.ANIMATION_CLIP;
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.CUSTOM)
                {
                    _help = Info.ANIMATION_CUSTOM;
                }

                _anim.InterfaceType = (AnimationInterfaceType)ICEEditorLayout.EnumPopup("Interface", "", _anim.InterfaceType, _help);
            }
            else if (_component.GetComponentInChildren <Animator>())
            {
                _anim.InterfaceType = AnimationInterfaceType.MECANIM;
            }
            else
            {
                _anim.InterfaceType = AnimationInterfaceType.LEGACY;
            }

            if (_anim.InterfaceType != AnimationInterfaceType.NONE)
            {
                if (_anim.InterfaceType == AnimationInterfaceType.MECANIM)
                {
                    _anim.Animator = DrawBehaviourAnimationAnimatorData(_component, _anim.Animator);
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY)
                {
                    _anim.Animation = DrawBehaviourAnimationAnimationData(_component, _anim.Animation);
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.CLIP)
                {
                    _anim.Clip = DrawBehaviourAnimationAnimationClipData(_component, _anim.Clip);
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.CUSTOM)
                {
                    Info.Help(_help);
                }

                if (_anim.InterfaceType == AnimationInterfaceType.MECANIM && _anim.Animator.Type == AnimatorControlType.DIRECT)
                {
                    DrawAnimationEventData(_component, _anim.Events, AnimationTools.GetAnimationClipByAnimatorAndName(AnimationTools.TryGetAnimatorComponent(_component.gameObject), _anim.GetAnimationName()), EditorHeaderType.FOLDOUT_ENABLED);
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY)
                {
                    DrawAnimationEventData(_component, _anim.Events, AnimationTools.GetAnimationClipByName(AnimationTools.TryGetAnimationComponent(_component.gameObject), _anim.GetAnimationName()), EditorHeaderType.FOLDOUT_ENABLED);
                }
                else if (_anim.InterfaceType == AnimationInterfaceType.CLIP)
                {
                    DrawAnimationEventData(_component, _anim.Events, _anim.Clip.Clip, EditorHeaderType.FOLDOUT_ENABLED);
                }
            }
            else
            {
                Info.Help(Info.ANIMATION_NONE);
            }

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }
        /// <summary>
        /// Draws the length of the behaviour custom.
        /// </summary>
        /// <returns>The behaviour custom length.</returns>
        /// <param name="_rule">Rule.</param>
        private static void DrawBehaviourCustomLength(ICECreatureControl _control, BehaviourModeRuleObject _rule, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "")
        {
            if (_rule == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Rule Length";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.BEHAVIOUR_LENGTH;
            }

            ICEEditorLayout.BeginHorizontal();
            CreatureObjectEditor.DrawObjectHeaderLine(ref _rule.UseCustomLength, ref _rule.FoldoutCustomLength, _type, _title, _hint);
            ICEEditorLayout.EndHorizontal(_help);

            if (_rule.UseCustomLength && _rule.FoldoutCustomLength)
            {
                EditorGUI.indentLevel++;

                ICEEditorLayout.BeginHorizontal();
                ICEEditorLayout.MinMaxSlider("Min/Max Length (secs.)", "Enter the desired Play-Length or press 'RND' to set randomized values.", ref _rule.LengthMin, ref _rule.LengthMax, 0, ref _rule.LengthMaximum, 0.25f, 35);
                if (ICEEditorLayout.RandomButton(""))
                {
                    _rule.LengthMax = Random.Range(_rule.LengthMin, _rule.LengthMaximum);
                    _rule.LengthMin = Random.Range(0, _rule.LengthMax);
                }

                if (ICEEditorLayout.ButtonSmall("ANIM", ""))
                {
                    _rule.LengthMin = _rule.Animation.GetAnimationLength();
                    _rule.LengthMax = _rule.LengthMin;
                }

                if (ICEEditorLayout.ResetButtonSmall(""))
                {
                    _rule.LengthMin = 0;
                    _rule.LengthMax = 0;
                }
                ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR_LENGTH);

                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();
            }
        }
        private static void DrawEnvironmentCollisionSettings(ICECreatureControl _control)
        {
            // IMPACT HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();

            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.CollisionHandler.Enabled == false);
            WorldObjectEditor.DrawObjectHeaderLine(ref _control.Creature.Environment.CollisionHandler.Enabled, ref _control.Creature.Environment.CollisionHandler.Foldout, EditorHeaderType.FOLDOUT_BOLD, "Collisions", "");

            _control.Creature.Environment.CollisionHandler.AllowChildCollisions = ICEEditorLayout.CheckButtonSmall("ACC", "Allow Child Collisions", _control.Creature.Environment.CollisionHandler.AllowChildCollisions);
            _control.Creature.Environment.CollisionHandler.UseCollider          = ICEEditorLayout.CheckButtonSmall("COL", "Use Collider events", _control.Creature.Environment.CollisionHandler.UseCollider);
            _control.Creature.Environment.CollisionHandler.UseTrigger           = ICEEditorLayout.CheckButtonSmall("TRI", "Use Trigger events", _control.Creature.Environment.CollisionHandler.UseTrigger);
            EditorGUI.BeginDisabledGroup(_control.GetComponent <CharacterController>() == null);
            _control.Creature.Environment.CollisionHandler.UseCharacterController = ICEEditorLayout.CheckButtonSmall("CON", "Use CharacterController events", _control.Creature.Environment.CollisionHandler.UseCharacterController);
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(5);
            EditorGUI.EndDisabledGroup();

            if (ICEEditorLayout.AddButton("Adds a new collision rule"))
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Enabled = true;
            }

            if (ICEEditorLayout.SaveButton("Saves collision data to file"))
            {
                CreatureEditorIO.SaveEnvironmentCollisionToFile(_control.Creature.Environment.CollisionHandler, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads collision data  to file"))
            {
                _control.Creature.Environment.CollisionHandler = CreatureEditorIO.LoadEnvironmentCollisionFromFile(_control.Creature.Environment.CollisionHandler);
            }
            if (ICEEditorLayout.ResetButton("Resets the collision data"))
            {
                _control.Creature.Environment.CollisionHandler.Reset();
            }

            _control.Creature.Environment.CollisionHandler.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Environment.CollisionHandler.Enabled);
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION);
            // IMPACT HEADER END

            if (_control.Creature.Environment.CollisionHandler.Enabled == true && _control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Foldout = true;
            }

            // CONTENT BEGIN
            if (WorldObjectEditor.BeginObjectContentOrReturn(EditorHeaderType.FOLDOUT_BOLD, _control.Creature.Environment.CollisionHandler))
            {
                return;
            }

            for (int i = 0; i < _control.Creature.Environment.CollisionHandler.Collisions.Count; i++)
            {
                CollisionDataObject _collision = _control.Creature.Environment.CollisionHandler.Collisions[i];

                if (_collision != null)
                {
                    if (_collision.Name.Trim() == "")
                    {
                        _collision.Name = "Collision Rule #" + (i + 1);
                    }

                    // IMPACT RULE HEADER BEGIN
                    ICEEditorLayout.BeginHorizontal();
                    EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                    _collision.Foldout = ICEEditorLayout.Foldout(_collision.Foldout, _collision.Name);
                    EditorGUI.EndDisabledGroup();

                    if (ICEEditorLayout.ListDeleteButton <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, _collision, "Removes the selected collision rule"))
                    {
                        if (_control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
                        {
                            _control.Creature.Environment.CollisionHandler.Enabled = false;
                        }
                        return;
                    }

                    GUILayout.Space(5);
                    if (ICEEditorLayout.ListUpDownButtons <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, i))
                    {
                        return;
                    }

                    _collision.Enabled = ICEEditorLayout.EnableButton("Activates/deactivates the selected collision rule", _collision.Enabled);

                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE);
                    // IMPACT RULE HEADER END

                    // IMPACT RULE CONTENT BEGIN
                    if (_collision.Foldout)
                    {
                        EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                        ICEEditorLayout.BeginHorizontal();
                        _collision.Name = ICEEditorLayout.Text("Name", "", _collision.Name);
                        if (ICEEditorLayout.ResetButtonSmall())
                        {
                            _collision.Name = "";
                        }
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_NAME);

                        EditorGUILayout.Separator();
                        ICEEditorLayout.BeginHorizontal();
                        ICEEditorLayout.Label("Conditions", true);

                        _collision.UseTag      = ICEEditorLayout.CheckButtonMiddle("TAG", "", _collision.UseTag);
                        _collision.UseLayer    = ICEEditorLayout.CheckButtonMiddle("LAYER", "", _collision.UseLayer);
                        _collision.UseBodyPart = ICEEditorLayout.CheckButtonMiddle("COLLIDER", "", _collision.UseBodyPart);
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_CONDITIONS);
                        EditorGUI.indentLevel++;

                        if (_collision.UseLayer)
                        {
                            _collision.Layer = ICEEditorLayout.Layer("Layer", "Desired collision layer", _collision.Layer, Info.ENVIROMENT_COLLISION_RULE_LAYER);
                        }

                        if (_collision.UseTag)
                        {
                            _collision.Tag = ICEEditorLayout.Tag("Tag", "Desired collision tag", _collision.Tag, Info.ENVIROMENT_COLLISION_RULE_TAG);
                        }

                        if (_collision.UseBodyPart)
                        {
                            _collision.BodyPart = ICEEditorLayout.ColliderPopup(_control.gameObject, "Body Part", "Desired body part", _collision.BodyPart, Info.ENVIROMENT_COLLISION_RULE_BODYPART);
                        }

                        EditorGUI.indentLevel--;

                        EditorGUILayout.Separator();
                        ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_COLLISION_RULE_PROCEDURES);
                        EditorGUI.indentLevel++;
                        _collision.UseBehaviourModeKey = ICEEditorLayout.Toggle("Behaviour", "", _collision.UseBehaviourModeKey, Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                        if (_collision.UseBehaviourModeKey)
                        {
                            EditorGUI.indentLevel++;
                            _collision.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _collision.BehaviourModeKey, "COLLISION_" + _collision.Name.ToUpper(), Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                            EditorGUI.indentLevel--;
                        }

                        EditorHeaderType _header = EditorHeaderType.TOGGLE;
                        CreatureObjectEditor.DrawInfluenceObject(_collision.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_COLLISION_INFLUENCES);
                        //CreatureObjectEditor.DrawAudioObject( _collision.Audio, _header, Info.ENVIROMENT_COLLISION_AUDIO );
                        //CreatureObjectEditor.DrawEffectObject( _control, _collision.Effect, _header, Info.ENVIROMENT_COLLISION_EFFECT );


                        //_impact.ForceInteraction = EditorGUILayout.Toggle("Force Interaction", _impact.ForceInteraction );
                        EditorGUI.indentLevel--;
                        EditorGUILayout.Separator();


                        EditorGUI.EndDisabledGroup();
                        ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                    }
                    // IMPACT RULE CONTENT END
                }
            }

            ICEEditorLayout.DrawListAddLine <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, new CollisionDataObject(), false, "Add Collision Rule");

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }
        private static void DrawEnvironmentSurfaceSettings(ICECreatureControl _control)
        {
            ICEEditorLayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.SurfaceHandler.Enabled == false);
            WorldObjectEditor.DrawObjectHeaderLine(ref _control.Creature.Environment.SurfaceHandler.Enabled, ref _control.Creature.Environment.SurfaceHandler.Foldout, EditorHeaderType.FOLDOUT_BOLD, "Surfaces", "");

            EditorGUI.EndDisabledGroup();

            if (ICEEditorLayout.AddButton("Adds a new surface rule"))
            {
                _control.Creature.Environment.SurfaceHandler.Surfaces.Add(new SurfaceDataObject());
                _control.Creature.Environment.SurfaceHandler.Enabled = true;
            }


            if (ICEEditorLayout.SaveButton("Saves surface data to file"))
            {
                CreatureEditorIO.SaveEnvironmentSurfaceToFile(_control.Creature.Environment.SurfaceHandler, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads surface data  to file"))
            {
                _control.Creature.Environment.SurfaceHandler = CreatureEditorIO.LoadEnvironmentSurfaceFromFile(_control.Creature.Environment.SurfaceHandler);
            }
            if (ICEEditorLayout.ResetButton("Resets the surface data"))
            {
                _control.Creature.Environment.SurfaceHandler.Reset();
            }

            _control.Creature.Environment.SurfaceHandler.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Environment.SurfaceHandler.Enabled);
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE);

            if (_control.Creature.Environment.SurfaceHandler.Enabled == true && _control.Creature.Environment.SurfaceHandler.Surfaces.Count == 0)
            {
                _control.Creature.Environment.SurfaceHandler.Surfaces.Add(new SurfaceDataObject());
                _control.Creature.Environment.SurfaceHandler.Foldout = true;
            }

            // CONTENT BEGIN
            if (WorldObjectEditor.BeginObjectContentOrReturn(EditorHeaderType.FOLDOUT_BOLD, _control.Creature.Environment.SurfaceHandler))
            {
                return;
            }

            _control.Creature.Environment.SurfaceHandler.GroundScanInterval = ICEEditorLayout.MaxDefaultSlider("Ground Scan Interval (secs.)", "Defines the interval for the ground check", _control.Creature.Environment.SurfaceHandler.GroundScanInterval, 0.25f, 0, ref _control.Creature.Environment.SurfaceHandler.GroundScanIntervalMaximum, 1, Info.ENVIROMENT_SURFACE_SCAN_INTERVAL);

            for (int i = 0; i < _control.Creature.Environment.SurfaceHandler.Surfaces.Count; ++i)
            {
                // HEADER BEGIN
                SurfaceDataObject _surface = _control.Creature.Environment.SurfaceHandler.Surfaces[i];

                if (_surface.Name == "")
                {
                    _surface.Name = "Surface Rule #" + (i + 1);
                }

                ICEEditorLayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(_surface.Enabled == false);
                _surface.Foldout = ICEEditorLayout.Foldout(_surface.Foldout, _surface.Name);
                EditorGUI.EndDisabledGroup();


                if (ICEEditorLayout.ListDeleteButton <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, _surface, "Removes the selected surface rule"))
                {
                    if (_control.Creature.Environment.SurfaceHandler.Surfaces.Count == 0)
                    {
                        _control.Creature.Environment.SurfaceHandler.Enabled = false;
                    }

                    return;
                }

                GUILayout.Space(5);
                if (ICEEditorLayout.ListUpDownButtons <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, i))
                {
                    return;
                }

                _surface.Enabled = ICEEditorLayout.EnableButton("Activates/deactivates the  the selected surfaces rule", _surface.Enabled);

                ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE_RULE);
                // HEADER END

                if (_surface.Foldout)
                {
                    EditorGUI.BeginDisabledGroup(_surface.Enabled == false);
                    ICEEditorLayout.BeginHorizontal();
                    _surface.Name = ICEEditorLayout.Text("Name", "", _surface.Name);
                    if (ICEEditorLayout.ResetButtonSmall())
                    {
                        _surface.Name = "";
                    }
                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE_RULE_NAME);
                    //_surface.Interval = ICEEditorLayout.DefaultSlider( "Interval", "", _surface.Interval, 0.005f, 0, 30, 1, Info.ENVIROMENT_SURFACE_RULE_INTERVAL );

                    //ICEEditorStyle.SplitterByIndent( EditorGUI.indentLevel + 1 );

                    DrawEnvironmentTextures(_surface);

                    ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_SURFACE_RULE_PROCEDURES);
                    EditorGUI.indentLevel++;
                    EditorGUI.BeginDisabledGroup(_surface.Textures.Count == 0);
                    _surface.UseBehaviourModeKey = ICEEditorLayout.Toggle("Behaviour", "", _surface.UseBehaviourModeKey, Info.ENVIROMENT_SURFACE_BEHAVIOUR);
                    if (_surface.UseBehaviourModeKey)
                    {
                        EditorGUI.indentLevel++;
                        _surface.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _surface.BehaviourModeKey, "SURFACE_" + _surface.Name.ToUpper(), Info.ENVIROMENT_SURFACE_BEHAVIOUR);
                        EditorGUI.indentLevel--;
                    }
                    EditorHeaderType _header = EditorHeaderType.TOGGLE;
                    CreatureObjectEditor.DrawInfluenceObject(_surface.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_SURFACE_INFLUENCES);
                    CreatureObjectEditor.DrawFootstepAudioObject(_surface.Footsteps, _header, Info.ENVIROMENT_SURFACE_AUDIO);
                    CreatureObjectEditor.DrawAudioObject(_surface.Audio, _header, Info.ENVIROMENT_SURFACE_AUDIO);
                    CreatureObjectEditor.DrawEffectObject(_control, _surface.Effect, _header, Info.ENVIROMENT_SURFACE_EFFECT);
                    EditorGUI.EndDisabledGroup();
                    EditorGUI.indentLevel--;
                    EditorGUILayout.Separator();
                    EditorGUI.EndDisabledGroup();
                    ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                }
            }

            ICEEditorLayout.DrawListAddLine <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, new SurfaceDataObject(), false, "Add Surface Rule");

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }
예제 #18
0
        public static void DrawObjectHeaderLine(ref bool _enabled, ref bool _foldout, EditorHeaderType _type, string _title, string _hint, string _help = "")
        {
            if (IsHeaderRequired(_type) == false)
            {
                return;
            }

            // TOOGLE
            if (_type == EditorHeaderType.TOGGLE)
            {
                _enabled = ICEEditorLayout.Toggle(_title, _hint, _enabled, _help);
                _foldout = _enabled;
            }
            else if (_type == EditorHeaderType.TOGGLE_LEFT)
            {
                _enabled = ICEEditorLayout.ToggleLeft(_title, _hint, _enabled, false, _help);
                _foldout = _enabled;
            }
            else if (_type == EditorHeaderType.TOGGLE_LEFT_BOLD)
            {
                _enabled = ICEEditorLayout.ToggleLeft(_title, _hint, _enabled, true, _help);
                _foldout = _enabled;
            }

            // LABEL
            else if (_type == EditorHeaderType.LABEL)
            {
                ICEEditorLayout.Label(_title, false, _help);
                _foldout = true;
                _enabled = true;
            }
            else if (_type == EditorHeaderType.LABEL_BOLD)
            {
                ICEEditorLayout.Label(_title, true, _help);
                _foldout = true;
                _enabled = true;
            }
            else if (_type == EditorHeaderType.LABEL_ENABLED || _type == EditorHeaderType.LABEL_ENABLED_BOLD)
            {
                EditorGUI.BeginDisabledGroup(_enabled == false);
                if (_type == EditorHeaderType.LABEL_ENABLED_BOLD)
                {
                    ICEEditorLayout.Label(_title, true, _help);
                }
                else
                {
                    ICEEditorLayout.Label(_title, false, _help);
                }
                _foldout = true;
                EditorGUI.EndDisabledGroup();

                _enabled = ICEEditorLayout.EnableButton("Enables/disables this feature", _enabled);
            }

            // FOLDOUT
            else if (_type == EditorHeaderType.FOLDOUT)
            {
                //EditorGUI.BeginDisabledGroup( _object.Enabled == false );
                _foldout = ICEEditorLayout.Foldout(_foldout, _title, _help, false);
                //EditorGUI.EndDisabledGroup();
            }
            else if (_type == EditorHeaderType.FOLDOUT_BOLD)
            {
                //EditorGUI.BeginDisabledGroup( _object.Enabled == false );
                _foldout = ICEEditorLayout.Foldout(_foldout, _title, _help, true);
                //EditorGUI.EndDisabledGroup();
            }
            else
            {
                bool _enabled_in = _enabled;

                EditorGUI.BeginDisabledGroup(_enabled == false);
                if (_type == EditorHeaderType.FOLDOUT_ENABLED_BOLD)
                {
                    _foldout = ICEEditorLayout.Foldout(_foldout, _title, _help, true);
                }
                else
                {
                    _foldout = ICEEditorLayout.Foldout(_foldout, _title, _help, false);
                }
                EditorGUI.EndDisabledGroup();

                _enabled = ICEEditorLayout.EnableButton(_enabled);

                // Auto foldout if the feature was enabled by the user
                if (_enabled_in != _enabled && _enabled == true)
                {
                    _foldout = true;
                }
            }
        }
예제 #19
0
        public static void DrawAstronomyObjectSettings(ICEEnvironment _environment, AstronomyObject _astronomy, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "")
        {
            if (_environment == null || _astronomy == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Astronomical Settings";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.ASTRONOMY;
            }

            DrawObjectHeader(_astronomy, _type, _title, _hint, _help);

            // CONTENT BEGIN
            if (BeginObjectContentOrReturn(_type, _astronomy))
            {
                return;
            }

            ICEEditorLayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Start Date (d.m.y)"));

            int _indent = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;
            _astronomy.StartDay   = ICEEditorLayout.DayPopup(_astronomy.StartDay, _astronomy.StartYear, _astronomy.StartMonth, GUILayout.Width(50));
            _astronomy.StartMonth = EditorGUILayout.IntPopup(_astronomy.StartMonth, new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }, new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 });
            _astronomy.StartYear  = EditorGUILayout.IntField(_astronomy.StartYear, GUILayout.Width(50));
            EditorGUI.indentLevel = _indent;

            Vector3 _date = ICEEditorLayout.ButtonDefault(new Vector3(_astronomy.StartYear, _astronomy.StartMonth, _astronomy.StartDay), new Vector3(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day));

            _astronomy.StartYear  = (int)_date.x;
            _astronomy.StartMonth = (int)_date.y;
            _astronomy.StartDay   = (int)_date.z;

            ICEEditorLayout.EndHorizontal();
            _astronomy.StartTimeInHours = ICEEditorLayout.DefaultSlider("Start Time (hour)", "", _astronomy.StartTimeInHours, 0.025f, 0, 24, 6, "");
            EditorGUILayout.Separator();

            ICEEditorLayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(_astronomy.UseRealTime == true);
            _astronomy.DayLengthInMinutes = ICEEditorLayout.MaxDefaultSlider("Length Of Day (minutes)", "Length of a day (24h) in minutes", _astronomy.DayLengthInMinutes, 0.01f, 0.1f, ref _astronomy.DayLengthInMinutesMaximum, 60, "");
            EditorGUI.EndDisabledGroup();
            _astronomy.UseRealTime = ICEEditorLayout.CheckButtonSmall("REAL", "Use Real Time", _astronomy.UseRealTime);
            ICEEditorLayout.EndHorizontal();
            EditorGUILayout.Separator();

            ICEEditorLayout.BeginHorizontal();
            _astronomy.SunLight = (Light)EditorGUILayout.ObjectField("Sun", _astronomy.SunLight, typeof(Light), true);
            EditorGUI.BeginDisabledGroup(_astronomy.SunLight != null);
            if (ICEEditorLayout.AutoButton(""))
            {
                GameObject _sun = new GameObject("Sun");
                if (_sun != null)
                {
                    _astronomy.SunLight = _sun.AddComponent <Light>();
                    if (_astronomy.SunLight != null)
                    {
                        _astronomy.SunLight.type      = LightType.Directional;
                        _astronomy.SunLight.intensity = _astronomy.SunInitialIntensity;
                        _astronomy.SunLight.color     = _astronomy.SunLightColor;
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            ICEEditorLayout.EndHorizontal();

            EditorGUI.indentLevel++;
            _astronomy.Azimut = (int)ICEEditorLayout.DefaultSlider("Azimut", "", _astronomy.Azimut, 1, 0, 360, 0, "");
            _astronomy.Radius = (int)ICEEditorLayout.MaxDefaultSlider("Distance", "", _astronomy.Radius, 1, 0, ref _astronomy.RadiusMax, 60, "");
            ICEEditorLayout.MinMaxDefaultSlider("Zenit Angle (min/max)", "", ref _astronomy.ZenitMin, ref _astronomy.ZenitMax, 0, 90, 45, 75, Init.DECIMAL_PRECISION_DISTANCES, 30, "");

            _astronomy.SunInitialIntensity = ICEEditorLayout.DefaultSlider("Intensity", "", _astronomy.SunInitialIntensity, Init.DECIMAL_PRECISION, 0, 8, 1, "");
            ICEEditorLayout.MinMaxDefaultSlider("Light Intensity (min/max)", "", ref _astronomy.SunLightIntensityMin, ref _astronomy.SunLightIntensityMax, 0, 8, 0.25f, 1.5f, Init.DECIMAL_PRECISION_DISTANCES, 40, "");
            EditorGUI.indentLevel++;
            _astronomy.SunLightDayColor     = ICEEditorLayout.DefaultColor("Day", "", _astronomy.SunLightDayColor, new HSBColor(0.15f, 0.25f, 1f).ToColor(), "");
            _astronomy.SunLightSunriseColor = ICEEditorLayout.DefaultColor("Sunrise", "", _astronomy.SunLightSunriseColor, new HSBColor(0.10f, 1f, 1f).ToColor(), "");
            _astronomy.SunLightNightColor   = ICEEditorLayout.DefaultColor("Night", "", _astronomy.SunLightNightColor, new HSBColor(0.65f, 0.55f, 1f).ToColor(), "");
            EditorGUI.indentLevel--;
            EditorGUI.indentLevel--;

            EditorGUILayout.Separator();



            //m_environment_master.SunriseHour = ICEEditorLayout.DefaultSlider( "Sunrise (hour)", "", m_environment_master.SunriseHour, 0.25f, 1, 12, 6, "");
            //m_environment_master.SunsetHour = ICEEditorLayout.DefaultSlider( "Sunset (hour)", "", m_environment_master.SunsetHour, 0.25f, 12, 24, 18, "");



            EndObjectContent();
            // CONTENT END
        }
예제 #20
0
        public static void DrawDisplayObjectSettings(ICEEnvironment _environment, DisplayObject _display, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "")
        {
            if (_environment == null || _display == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Display";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.DISPLAY;
            }

            DrawObjectHeader(_display, _type, _title, _hint, _help);

            // CONTENT BEGIN
            if (BeginObjectContentOrReturn(_type, _display))
            {
                return;
            }

            _display.UITextDateTime = (Text)EditorGUILayout.ObjectField("DateTime", _display.UITextDateTime, typeof(Text), true);
            EditorGUILayout.BeginHorizontal();
            _display.UITextDateTimeFormat = ICEEditorLayout.Text("Format", "", _display.UITextDateTimeFormat, "");
            _display.UITextDateTimeFormat = ICEEditorLayout.ButtonDefault(_display.UITextDateTimeFormat, "dd.MM.yyyy HH:mm:ss");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            _display.UITextDay   = (Text)EditorGUILayout.ObjectField("Days", _display.UITextDay, typeof(Text), true);
            _display.UseFirstDay = ICEEditorLayout.CheckButtonSmall("+1", "", _display.UseFirstDay);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            _display.UITextDayFormat = ICEEditorLayout.Text("Format", "", _display.UITextDayFormat, "");
            _display.UITextDayFormat = ICEEditorLayout.ButtonDefault(_display.UITextDayFormat, "Day #{0}");
            EditorGUILayout.EndHorizontal();

            _display.UITemperatur = (Text)EditorGUILayout.ObjectField("Temperatur", _display.UITemperatur, typeof(Text), true);
            EditorGUILayout.BeginHorizontal();
            _display.UITemperaturFormat = ICEEditorLayout.Text("Format", "", _display.UITemperaturFormat, "");
            _display.UITemperaturFormat = ICEEditorLayout.ButtonDefault(_display.UITemperaturFormat, "{0}°C");
            EditorGUILayout.EndHorizontal();

            EndObjectContent();
            // CONTENT END
        }
예제 #21
0
        public static void DrawWeatherObjectSettings(ICEEnvironment _environment, WeatherObject _weather, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "")
        {
            if (_environment == null || _weather == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_title))
            {
                _title = "Meteorological Settings";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.WEATHER;
            }

            DrawObjectHeader(_weather, _type, _title, _hint, _help);

            // CONTENT BEGIN
            if (BeginObjectContentOrReturn(_type, _weather))
            {
                return;
            }

            ICEEditorLayout.BeginHorizontal();
            ICEEditorLayout.Label("Temperature");
            _weather.UseTemperature = ICEEditorLayout.EnableButton(_weather.UseTemperature);
            ICEEditorLayout.EndHorizontal();
            if (_weather.UseTemperature)
            {
                EditorGUI.indentLevel++;

                _weather.TemperatureScale = (TemperatureScaleType)ICEEditorLayout.EnumPopup("Temperature Scale", "", _weather.TemperatureScale, "");
                ICEEditorLayout.MinMaxDefaultSlider("Temperature (min/max)", "", ref _weather.MinTemperature, ref _weather.MaxTemperature, -_weather.TemperatureMaximum, ref _weather.TemperatureMaximum, -25, 50, Init.DECIMAL_PRECISION_DISTANCES, 40, "");

                Keyframe[] _keys_1 = new Keyframe[5] {
                    new Keyframe(0, 10.0f),
                    new Keyframe(5, 15.05f),
                    new Keyframe(12, 35.0f),
                    new Keyframe(20, 25.01f),
                    new Keyframe(24, 10.0f)
                };

                _weather.DaytimeTemperature = ICEEditorLayout.DefaultCurve("Daytime Temperature", "", _weather.DaytimeTemperature, new AnimationCurve(_keys_1));

                Keyframe[] _keys_2 = new Keyframe[7] {
                    new Keyframe(1, -15),
                    new Keyframe(3, -10),
                    new Keyframe(5, 15),
                    new Keyframe(7, 30),
                    new Keyframe(9, 35),
                    new Keyframe(11, 20),
                    new Keyframe(13, -15)
                };

                _weather.AnnualAverageTemperature = ICEEditorLayout.DefaultCurve("Annual Temperatures (average)", "Average annual temperatures", _weather.AnnualAverageTemperature, new AnimationCurve(_keys_2));


                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();
            }
            // FOG BEGIN
            ICEEditorLayout.BeginHorizontal();
            ICEEditorLayout.Label("Fog");
            _weather.UseFog = ICEEditorLayout.EnableButton(_weather.UseFog);
            ICEEditorLayout.EndHorizontal();
            if (_weather.UseFog)
            {
                EditorGUI.indentLevel++;

                Keyframe[] _keys_1 = new Keyframe[5] {
                    new Keyframe(0, 0.0f),
                    new Keyframe(5, 0.05f),
                    new Keyframe(12, 0.0f),
                    new Keyframe(20, 0.01f),
                    new Keyframe(24, 0.0f)
                };

                _weather.FogDensity = ICEEditorLayout.DefaultCurve("Density", "", _weather.FogDensity, new AnimationCurve(_keys_1));


                Keyframe[] _keys_2 = new Keyframe[7] {
                    new Keyframe(1, 0),
                    new Keyframe(3, 1),
                    new Keyframe(5, 0.5f),
                    new Keyframe(7, 0),
                    new Keyframe(9, 0.25f),
                    new Keyframe(11, 1),
                    new Keyframe(13, 0)
                };

                _weather.FogProbability = ICEEditorLayout.DefaultCurve("Annual Probability", "", _weather.FogProbability, new AnimationCurve(_keys_2));


                _weather.FogInitialDensity = ICEEditorLayout.DefaultSlider("Fog Initial Density", "", _weather.FogInitialDensity, Init.DECIMAL_PRECISION, 0, 8, 1, "");
                ICEEditorLayout.MinMaxDefaultSlider("Density (min/max)", "", ref _weather.FogDensityMin, ref _weather.FogDensityMax, 0, 1, 0.01f, 0.025f, Init.DECIMAL_PRECISION_DISTANCES, 40, "");
                EditorGUI.indentLevel++;
                _weather.FogDayColor     = ICEEditorLayout.DefaultColor("Day", "", _weather.FogDayColor, new HSBColor(0.0f, 0.0f, 1f).ToColor(), "");
                _weather.FogSunriseColor = ICEEditorLayout.DefaultColor("Sunrise", "", _weather.FogSunriseColor, new HSBColor(0.14f, 0.22f, 0.64f).ToColor(), "");
                _weather.FogNightColor   = ICEEditorLayout.DefaultColor("Night", "", _weather.FogNightColor, new HSBColor(0.91f, 0.04f, 0.30f).ToColor(), "");
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EditorGUILayout.Separator();
            }
            // FOG END

            EndObjectContent();
            // CONTENT END
        }
        /// <summary>
        /// Draws the behaviour mode rule.
        /// </summary>
        /// <param name="_index">_index.</param>
        /// <param name="_list">_list.</param>
        public static void DrawBehaviourModeRule(ICECreatureControl _control, BehaviourModeObject _mode, int _index, List <BehaviourModeRuleObject> _list, string _key)
        {
            BehaviourModeRuleObject _rule = _list[_index];

            if (_rule == null)
            {
                return;
            }

            if (_list.Count > 1)
            {
                EditorGUI.indentLevel++;

                ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

                ICEEditorLayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(_rule.Enabled == false);
                _rule.Foldout = EditorGUILayout.Foldout(_rule.Foldout, _key + " Rule #" + (_index + 1), ICEEditorStyle.Foldout);
                EditorGUI.EndDisabledGroup();

                GUILayout.FlexibleSpace();

                ICEEditorLayout.StatusButton("ACTIVE", _rule.Active == false, Color.green);

                if (ICEEditorLayout.CopyButtonMiddle())
                {
                    _list.Add(new BehaviourModeRuleObject(_rule));
                }

                GUILayout.Space(5);
                if (ICEEditorLayout.ListDeleteButton <BehaviourModeRuleObject>(_list, _rule, "Removes this rule."))
                {
                    return;
                }

                if (ICEEditorLayout.ListUpDownButtons <BehaviourModeRuleObject>(_list, _list.IndexOf(_rule)))
                {
                    return;
                }



                _rule.Enabled = ICEEditorLayout.EnableButton("Enables/disables this rule", _rule.Enabled);

                ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR_MODE_RULE);
            }
            else
            {
                _rule.Foldout = true;
                _rule.Enabled = true;
            }

            if (_rule.Foldout)
            {
                EditorHeaderType _header     = EditorHeaderType.FOLDOUT_ENABLED_BOLD;
                EditorHeaderType _sub_header = EditorHeaderType.FOLDOUT_ENABLED_BOLD;

                EditorGUI.BeginDisabledGroup(_rule.Enabled == false);

                // WEIGHTEDRANDOM BEGIN
                if (_list.Count > 1 && _mode.RulesOrderType == SequenceOrderType.WEIGHTEDRANDOM)
                {
                    _rule.Weight = ICEEditorLayout.DefaultSlider("Weight", "Weight Value for WEIGHTEDRANDOM Sequence Type, relative to other rules weight value", _rule.Weight, Init.DECIMAL_PRECISION, 0, 100, 1, Info.BEHAVIOUR_MODE_RULE_WEIGHT);
                }
                // WEIGHTEDRANDOM END

                EditorGUI.indentLevel++;

                // CUSTOM LENGTH BEGIN
                if (_list.Count > 1 || _rule.Link.Enabled)
                {
                    DrawBehaviourCustomLength(_control, _rule, _header);
                }
                // CUSTOM LENGTH END

                CreatureBehaviourEditor.DrawBehaviourAnimation(_control, _mode, _rule, _header);
                CreatureBehaviourEditor.DrawBehaviourMove(_control, _mode, _rule, _header);
                CreatureObjectEditor.DrawInfluenceObject(_mode, _rule.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.BEHAVIOUR_INFLUENCES);
                CreatureObjectEditor.DrawInventoryActionObject(_control, _rule.Inventory, _header, Info.BEHAVIOUR_INVENTORY);
                CreatureObjectEditor.DrawAudioObject(_rule.Audio, _header, Info.BEHAVIOUR_AUDIO);
                CreatureObjectEditor.DrawEventsObject(_control, _rule.Events, _header, _sub_header, Info.BEHAVIOUR_EVENTS);
                CreatureObjectEditor.DrawLookDataObject(_rule.Look, _header, Info.BEHAVIOUR_LOOK);
                CreatureObjectEditor.DrawEffectObject(_control, _rule.Effect, _header, Info.BEHAVIOUR_EFFECT);
                CreatureBehaviourEditor.DrawBehaviourModeRuleLinkObject(_control, _list, _rule.Link, _header, Info.BEHAVIOUR_LINK, "", "", _key + "_" + _index);

                EditorGUILayout.Separator();
                EditorGUI.EndDisabledGroup();
                EditorGUI.indentLevel--;
            }

            if (_list.Count > 1)
            {
                EditorGUI.indentLevel--;
            }
        }