/// <summary> /// Draws the content of the target. /// </summary> /// <param name="_attribute">Attribute.</param> public void DrawTargetContent(ICECreatureTargetAttribute _attribute) { TargetType _type = TargetType.UNDEFINED; if (_attribute.GetComponentInChildren <ICECreaturePlayer>() != null) { _type = TargetType.PLAYER; } else if (_attribute.GetComponentInChildren <ICECreatureItem>() != null) { _type = TargetType.ITEM; } else if (_attribute.GetComponentInChildren <ICECreatureLocation>() != null) { _type = TargetType.WAYPOINT; } else if (_attribute.GetComponentInChildren <ICECreatureWaypoint>() != null) { _type = TargetType.WAYPOINT; } else if (_attribute.GetComponentInChildren <ICECreatureMarker>() != null) { _type = TargetType.WAYPOINT; } else if (_attribute.GetComponentInChildren <ICECreatureControl>() != null) { _type = TargetType.CREATURE; } ICEEditorLayout.Label("Default Target Settings", true); EditorGUI.indentLevel++; CreatureObjectEditor.DrawTargetSelectorsObject(null, _attribute.Target, _attribute.Target.Selectors, _type, 0, 250); TargetEditor.DrawTargetMoveSpecification(null, _attribute.Target); EditorGUI.indentLevel--; }
/// <summary> /// Draws the target influence settings. /// </summary> /// <param name="_control">Control.</param> /// <param name="_target">Target.</param> public static void DrawTargetInfluenceSettings(ICECreatureControl _control, TargetObject _target) { ICEEditorLayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(_target.Influences.Enabled == false); _target.Influences.Foldout = ICEEditorLayout.Foldout(_target.Influences.Foldout, "Creature Influences", "", false); EditorGUI.EndDisabledGroup(); GUILayout.FlexibleSpace(); InteractorRuleObject _rule = _target as InteractorRuleObject; if (_rule != null) { _rule.OverrideInfluences = ICEEditorLayout.CheckButtonMiddle("OVERRIDE", "Overrides initial target influences", _rule.OverrideInfluences); _rule.Influences.Enabled = _rule.OverrideInfluences; if (!_rule.OverrideInfluences) { _rule.Influences.Foldout = false; } } else { _target.Influences.Enabled = ICEEditorLayout.EnableButton("Enables/disables the influences", _target.Influences.Enabled); } ICEEditorLayout.EndHorizontal(Info.TARGET_INFLUENCES); EditorGUI.BeginDisabledGroup(_target.Influences.Enabled == false); CreatureObjectEditor.DrawInfluenceObject(_target.Influences, EditorHeaderType.FOLDOUT_CUSTOM, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_COLLISION_INFLUENCES); EditorGUI.EndDisabledGroup(); }
public virtual void DrawWaypointContent(ICECreatureWaypoint _target) { if (_target == null) { return; } CreatureObjectEditor.DrawWaypointLinksObject(_target, _target.Links, m_HeaderType); }
public virtual void DrawPlantContent(ICECreaturePlant _target) { if (_target == null) { return; } CreatureObjectEditor.DrawInventoryObject(_target.gameObject, _target.Inventory, m_HeaderType); }
/// <summary> /// Draws the content of the zone entity. /// </summary> /// <param name="_target">Zone Entity.</param> public virtual void DrawLinkContent(ICECreatureLink _target) { if (_target == null) { return; } CreatureObjectEditor.DrawInfluenceDataObject(_target.Influences, m_HeaderType); }
protected virtual void DrawEntityContent(ICECreatureEntity _entity) { if (_entity == null) { return; } CreatureObjectEditor.DrawEntityStatusObject(_entity, _entity.Status, m_HeaderType); }
public virtual void DrawItemContent(ICECreatureItem _target) { if (_target == null) { return; } CreatureObjectEditor.DrawImpactObject(_target, _target.Impact, m_HeaderType); CreatureObjectEditor.DrawInventoryObject(_target.gameObject, _target.Inventory, m_HeaderType); }
public virtual void DrawExplosiveContent(ICECreatureExplosive _target) { if (_target == null) { return; } CreatureObjectEditor.DrawExplosiveObject(_target, _target.Explosive, m_HeaderType); DrawWeaponContent(_target); }
public virtual void DrawBodyPartContent(ICECreatureBodyPart _target) { if (_target == null) { return; } CreatureObjectEditor.DrawImpactObject(_target, _target.Impact, m_HeaderType); CreatureObjectEditor.DrawBodyPartMotionObject(_target, _target.Motion, m_HeaderType); }
public virtual void DrawTorchContent(ICECreatureTorch _target) { if (_target == null) { return; } CreatureObjectEditor.DrawFireObject(_target, _target.Fire, EditorHeaderType.FOLDOUT_ENABLED_BOLD); DrawItemContent(_target); }
public virtual void DrawFireplaceContent(ICECreatureFireplace _target) { if (_target == null) { return; } CreatureObjectEditor.DrawFireObject(_target, _target.Fire, EditorHeaderType.FOLDOUT_ENABLED_BOLD); DrawZoneContent(_target); }
public virtual void DrawToolContent(ICECreatureTool _target) { if (_target == null) { return; } CreatureObjectEditor.DrawToolObject(_target, _target.Tool, m_HeaderType); DrawItemContent(_target); }
public virtual void DrawPlayerContent(ICECreaturePlayer _target) { if (_target == null) { return; } CreatureObjectEditor.DrawPlayerObject(_target.gameObject, _target.Player, m_HeaderType); CreatureObjectEditor.DrawPlayerInventoryObject(_target.gameObject, _target.Inventory, m_HeaderType); CreatureObjectEditor.DrawPlayerInputEventsObject(_target, _target.Events, m_HeaderType); }
public virtual void DrawTurretContent(ICECreatureTurret _target) { if (_target == null) { return; } CreatureObjectEditor.DrawTurretObject(_target.Turret, m_HeaderType, Info.TURRET); DrawRangedWeaponContent(_target); }
public virtual void DrawFlashlightContent(ICECreatureFlashlight _target) { if (_target == null) { return; } DrawItemContent(_target); CreatureObjectEditor.DrawFlashlightObject(_target, _target.Flashlight, m_HeaderType); }
/// <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(); }
/// <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(); } }
public static void DrawTargetEvents(ICECreatureControl _control, TargetObject _target) { if (_target == null) { return; } ICEWorldBehaviour _behaviour = null; if (_target.TargetGameObject != null) { _behaviour = _target.TargetGameObject.GetComponent <ICEWorldBehaviour>(); } CreatureObjectEditor.DrawEventsObject(_behaviour, _target.Events, EditorHeaderType.FOLDOUT_ENABLED, EditorHeaderType.FOLDOUT_ENABLED, Info.TARGET_EVENT, "Target Events"); }
/// <summary> /// Draws the content of the target. /// </summary> /// <param name="_control">Control.</param> /// <param name="_target">Target.</param> public static void DrawTargetContent(ICECreatureControl _control, TargetObject _target, bool _behaviour = true, string _default_key = "") { //EditorGUI.BeginDisabledGroup( _target.TargetGameObject == null ); EditorGUI.indentLevel++; CreatureObjectEditor.DrawTargetSelectorsObject(_control, _target, _target.Selectors, _target.Type, Init.SELECTION_RANGE_MIN, Init.SELECTION_RANGE_MAX); DrawTargetMoveSpecification(_control.gameObject, _target); DrawTargetEvents(_control, _target); DrawTargetInfluenceSettings(_control, _target); DrawTargetGroupMessage(_control, _target); if (_behaviour) { DrawTargetBehaviour(_control, _target, _default_key); } EditorGUI.indentLevel--; //EditorGUI.EndDisabledGroup(); }
public virtual void DrawRangedWeaponContent(ICECreatureRangedWeapon _target) { if (_target == null) { return; } CreatureObjectEditor.DrawRangedWeaponObject(_target, _target.Weapon, m_HeaderType, Info.PRIMARY_WEAPON, "Primary Weapon"); CreatureObjectEditor.DrawRangedWeaponObject(_target, _target.SecondaryWeapon, m_HeaderType, Info.SECONDARY_WEAPON, "Secondary Weapon"); // WEAPON LASER BEAM CreatureObjectEditor.DrawLaserObject(_target, _target.Laser, m_HeaderType, Info.LASER); // WEAPON FLASHLIGHT CreatureObjectEditor.DrawFlashlightObject(_target, _target.Flashlight, m_HeaderType); // WEAPON SPECIFIC DrawWeaponContent(_target); }
protected override void DrawEntityContent(ICECreatureEntity _entity) { if (_entity == null) { return; } if (_entity.IsRootEntity || _entity.Status.IsDestructible || _entity.Status.UseLifespan) { string _text = "Please note, basically a body part should be a child within the transform hierarchy of an higher entity " + "and you should enable the damage transfer multiplier to forward incomming damages to the parent according to the" + "specified value, so you could disable and ignore Lifespan and Durability. But in some cases it could be also useful " + "to use Lifespan and Durability for body parts to force specific effects but please consider that destroying a body " + "part within a given transform hierarchy could result uncomely and unwanted effects, so please be careful what you do!"; EditorGUILayout.HelpBox(_text, MessageType.None); } CreatureObjectEditor.DrawEntityStatusObject(_entity, _entity.Status, m_HeaderType); }
/// <summary> /// Draws the footer. /// </summary> /// <param name="_target">Target.</param> public virtual void DrawFooter(ICECreatureEntity _entity) { if (_entity == null) { return; } EditorGUILayout.Separator(); CreatureObjectEditor.DrawEntityRuntimeBehaviourObject(_entity, _entity.RuntimeBehaviour, m_HeaderType); if (_entity as ICECreatureItem != null) { if (_entity.ObjectRigidbody == null || _entity.ObjectColliders == null) { EditorGUILayout.HelpBox(Info.RIGIDBODY_AND_COLLIDER, MessageType.Info); } ICEEditorLayout.DrawAddRigidbody(_entity.gameObject); ICEEditorLayout.DrawAddCollider(_entity.gameObject); EditorGUILayout.Separator(); } else if (_entity as ICECreatureBodyPart != null || _entity as ICECreatureZone != null) { if (_entity.ObjectColliders == null) { EditorGUILayout.HelpBox(Info.TRIGGER_COLLIDER, MessageType.Info); } ICEEditorLayout.DrawAddTrigger(_entity.gameObject); } ICECreatureEntityEditor.DrawTargetAttribute(_entity.gameObject); EditorGUILayout.Separator(); // indentLevel was increased in the header, so we have to decrease the level here EditorGUI.indentLevel--; // Version Info EditorGUILayout.LabelField(" - " + _entity.GetType().ToString() + " v" + Info.Version + " - ", EditorStyles.centeredGreyMiniLabel); MarkSceneDirty(_entity); }
public static void Print(ICECreatureRegister _register) { EditorGUILayout.Separator(); m_foldout = ICEEditorLayout.Foldout(m_foldout, "Options", Info.REGISTER_OPTIONS); if (!m_foldout) { return; } EditorGUILayout.Separator(); EditorGUI.indentLevel++; _register.Options.Enabled = true; CreatureObjectEditor.DrawRegisterDefaultSettings(_register, _register.Options, EditorHeaderType.FOLDOUT_BOLD); CreatureObjectEditor.DrawHierarchyManagementObject(_register, _register.HierarchyManagement, EditorHeaderType.FOLDOUT_ENABLED_BOLD); CreatureObjectEditor.DrawRegisterDebugObject(_register, _register.RegisterDebug, EditorHeaderType.FOLDOUT_ENABLED_BOLD); EditorGUILayout.Separator(); _register.UseDontDestroyOnLoad = ICEEditorLayout.Toggle("Don't Destroy On Load", "", _register.UseDontDestroyOnLoad, Info.REGISTER_OPTIONS_DONTDESTROYONLOAD); _register.UsePoolManagementCoroutine = ICEEditorLayout.Toggle("Use Pool Management Coroutine", "Use coroutine for pool management", _register.UsePoolManagementCoroutine, Info.REGISTER_OPTIONS_POOL_MANAGEMENT_COROUTINE); _register.UseGarbageCollection = ICEEditorLayout.Toggle("Custom Garbage Collection", "", _register.UseGarbageCollection, Info.REGISTER_OPTIONS_CUSTOM_GARBAGE_COLLECTION); if (_register.UseGarbageCollection) { EditorGUI.indentLevel++; _register.GarbageCollectionInterval = ICEEditorLayout.DefaultSlider("Interval", "", _register.GarbageCollectionInterval, Init.DECIMAL_PRECISION_TIMER, 0, 10, 3, ""); EditorGUI.indentLevel--; } _register.RandomSeed = (RandomSeedType)ICEEditorLayout.EnumPopup("Random Seed", "Sets the seed for the random number generator.", _register.RandomSeed, Info.REGISTER_OPTIONS_RANDOMSEED); if (_register.RandomSeed == RandomSeedType.CUSTOM) { EditorGUI.indentLevel++; _register.CustomRandomSeed = ICEEditorLayout.IntField("Seed Value", "Custom RandomSeed Integer Value", _register.CustomRandomSeed, Info.REGISTER_OPTIONS_RANDOMSEED_CUSTOM); EditorGUI.indentLevel--; EditorGUILayout.Separator(); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); ICEEditorStyle.SplitterByIndent(0); }
private static void DrawReferenceGroup(ICECreatureRegister _register, ReferenceGroupObject _obj) { if (_obj == null || _obj.Foldout == false) { return; } EditorGUI.BeginDisabledGroup(_obj.Enabled == false); // BEGIN OBJECT ICEEditorLayout.BeginHorizontal(); _obj.ReferenceGameObject = (GameObject)EditorGUILayout.ObjectField("Reference Object", _obj.ReferenceGameObject, typeof(GameObject), true); EditorGUI.BeginDisabledGroup(_obj.ReferenceGameObject == null); if (_obj.ReferenceGameObject != null) { ICEEditorLayout.ButtonDisplayObject(_obj.ReferenceGameObject.transform.position); } else { ICEEditorLayout.ButtonDisplayObject(Vector3.zero); } ICEEditorLayout.ButtonSelectObject(_obj.ReferenceGameObject, ICEEditorStyle.CMDButtonDouble); //_obj.GroupByTag = ICEEditorLayout.ButtonCheck( "TAG", "Allows to find a group in addition to its name also by its tag.", _obj.GroupByTag, ICEEditorStyle.CMDButtonDouble ); _obj.GroupByTag = false; _obj.UseGroupParent = ICEEditorLayout.CheckButtonMiddle("GROUP", "Assorts instances to the defined Hierarchy Group", _obj.UseGroupParent); EditorGUI.EndDisabledGroup(); ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT); // END OBJECT //_obj.UseHierarchyGroupObject = ICEEditorLayout.Toggle( "Use Hierarchy Group", "", _obj.UseHierarchyGroupObject, Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_USE ); if (_obj.UseGroupParent) { EditorGUI.indentLevel++; ICEEditorLayout.BeginHorizontal(); _obj.CustomGroupParent = (GameObject)EditorGUILayout.ObjectField("Custom Hierarchy Group", _obj.CustomGroupParent, typeof(GameObject), true); ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_CUSTOM); if (_obj.CustomGroupParent == null) { EditorGUILayout.HelpBox(Info.REGISTER_REFERENCE_OBJECT_POOL_GROUP_INFO, MessageType.Info); } EditorGUI.indentLevel--; } // BEGIN POOL MANAGEMENT if (_obj.PoolManagementEnabled == true && _register.UsePoolManagement == true) { // PLAYER if (_obj.EntityType == EntityClassType.Player) { _obj.MaxCoexistingObjects = 1; _obj.UseInitialSpawn = true; _obj.InitialSpawnPriority = 0; _obj.UseRandomization = false; _obj.SpawnWaveMin = 1; _obj.SpawnWaveMax = 1; _obj.UseSoftRespawn = true; ICEEditorLayout.MinMaxRandomDefaultSlider("Spawn Interval (min/max)", "", ref _obj.MinSpawnInterval, ref _obj.MaxSpawnInterval, 0, ref _obj.RespawnIntervalMax, 0, 0, 0.25f, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_INTERVAL); if (_obj.MinSpawnInterval > 0 && _obj.ReferenceGameObject != null && _obj.ReferenceGameObject.GetComponentsInChildren <Camera>() != null) { //Debug.Log( "test" ); } } // CREATURES AND OTHER OBJECTS else { ICEEditorLayout.BeginHorizontal(); float _maximum = _obj.MaxCoexistingObjectsMaximum; _obj.MaxCoexistingObjects = (int)ICEEditorLayout.MaxDefaultSlider("Max. Coexistent Objects (" + _obj.ActiveObjectsCount + ")", "Specifies the limit of coexistent objects", _obj.MaxCoexistingObjects, 1, 0, ref _maximum, 25, ""); _obj.MaxCoexistingObjectsMaximum = (int)_maximum; _obj.UseMaxSpawnCycles = ICEEditorLayout.CheckButtonSmall("MAX", "Specifies the total number of objects", _obj.UseMaxSpawnCycles); _obj.UseInitialSpawn = ICEEditorLayout.CheckButtonMiddle("INITIAL", "Spawns all instances on start according to the given priority", _obj.UseInitialSpawn); ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_MAX); if (_obj.UseMaxSpawnCycles) { if (_obj.MaxSpawnCycles < _obj.MaxCoexistingObjects) { _obj.MaxSpawnCycles = _obj.MaxCoexistingObjects; } if (_obj.MaxSpawnCyclesMaximum < _obj.MaxCoexistingObjectsMaximum) { _obj.MaxSpawnCyclesMaximum = _obj.MaxCoexistingObjectsMaximum; } float _max_spawn_cycles = _obj.MaxSpawnCyclesMaximum; _obj.MaxSpawnCycles = (int)ICEEditorLayout.MaxDefaultSlider("Max. Spawn Cycles (" + _obj.TotalSpawnCycles + ")", "", _obj.MaxSpawnCycles, 1, _obj.MaxCoexistingObjects, ref _max_spawn_cycles, 25, ""); _obj.MaxSpawnCyclesMaximum = (int)_max_spawn_cycles; } if (_obj.UseInitialSpawn) { EditorGUI.indentLevel++; _obj.InitialSpawnPriority = (int)ICEEditorLayout.DefaultSlider("Initial Spawn Priority", "", _obj.InitialSpawnPriority, 1, 0, 100, 0, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_PRIORITY); EditorGUI.indentLevel--; } ICEEditorLayout.BeginHorizontal(); ICEEditorLayout.MinMaxRandomDefaultSlider("Spawn Interval (min/max)", "", ref _obj.MinSpawnInterval, ref _obj.MaxSpawnInterval, 0, ref _obj.RespawnIntervalMax, 0, 0, 0.25f, 30); _obj.UseSpawnWave = ICEEditorLayout.CheckButton("WAVE", "", _obj.UseSpawnWave, ICEEditorStyle.ButtonMiddle); ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_INTERVAL); if (_obj.UseSpawnWave) { EditorGUI.indentLevel++; ICEEditorLayout.MinMaxRandomDefaultSlider("Wave Size (min/max)", "Amount per Wave", ref _obj.SpawnWaveMin, ref _obj.SpawnWaveMax, 1, ref _obj.SpawnWaveMaximum, 1, 5, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_WAVE); EditorGUI.indentLevel--; } EditorGUILayout.Separator(); _obj.UseRandomization = ICEEditorLayout.Toggle("Spawn Randomization", "", _obj.UseRandomization, Info.REGISTER_REFERENCE_OBJECT_POOL_RANDOM_SIZE); if (_obj.UseRandomization) { EditorGUI.indentLevel++; ICEEditorLayout.MinMaxRandomDefaultSlider("Random Size Variance (min/max)", "", ref _obj.RandomSizeMin, ref _obj.RandomSizeMax, -1, 1, 0, 0, 0.025f, 30, Info.REGISTER_REFERENCE_OBJECT_POOL_RANDOM_SIZE_VARIANCE); EditorGUI.indentLevel--; EditorGUILayout.Separator(); } WorldObjectEditor.DrawCullingOptionsObject(_register, _obj.CullingOptions, EditorHeaderType.TOGGLE, Info.REGISTER_REFERENCE_OBJECT_POOL_SPAWN_CONDITIONS, "Spawn Conditions"); } ICEEditorLayout.BeginHorizontal(); ICEEditorLayout.Label("Spawn Areas", false); if (ICEEditorLayout.AddButton("Adds a new spawn point entry")) { _obj.SpawnPoints.Add(new SpawnPointObject()); } ICEEditorLayout.EndHorizontal(Info.REGISTER_REFERENCE_OBJECT_SPAWN_POINTS); EditorGUI.indentLevel++; if (_obj.SpawnPoints.Count == 0) { if (_obj.EntityCreature != null) { _obj.SpawnPoints.Add(new SpawnPointObject(_obj.EntityCreature.Creature.Essentials.Target)); } else if (_obj.ReferenceGameObject != null) { ICECreatureTargetAttribute _target = _obj.ReferenceGameObject.GetComponent <ICECreatureTargetAttribute>(); if (_target != null) { _obj.SpawnPoints.Add(new SpawnPointObject(_target.Target)); } else { _obj.SpawnPoints.Add(new SpawnPointObject(_obj.ReferenceGameObject)); } } } foreach (SpawnPointObject _point in _obj.SpawnPoints) { if (CreatureObjectEditor.DrawSpawnPointObject(_point, _obj.SpawnPoints, EditorHeaderType.FOLDOUT_ENABLED)) { return; } } EditorGUI.indentLevel--; } // END POOL MANAGEMENT EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); }
/// <summary> /// Draws the status sensoria. /// </summary> /// <param name="_control">Control.</param> private static void DrawStatusSensoria(ICECreatureControl _control) { EditorGUI.indentLevel++; CreatureObjectEditor.DrawSensoriaObject(_control, _control.Creature.Status.Sensoria, EditorHeaderType.FOLDOUT_ENABLED_BOLD); EditorGUI.indentLevel--; }
/// <summary> /// Draws the status inventory. /// </summary> /// <param name="_control">Control.</param> private static void DrawStatusInventory(ICECreatureControl _control) { EditorGUI.indentLevel++; CreatureObjectEditor.DrawInventoryObject(_control.gameObject, _control.Creature.Status.Inventory, EditorHeaderType.FOLDOUT_ENABLED_BOLD); EditorGUI.indentLevel--; }
private static void DrawStatusBasics(ICECreatureControl _control) { _control.Creature.Status.Enabled = true; if (!_control.Display.ShowStatus) { return; } EditorGUI.indentLevel++; ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutStatusBasics = ICEEditorLayout.Foldout(_control.Display.FoldoutStatusBasics, "Basics"); ICEEditorLayout.EndHorizontal(Info.STATUS_BASICS); if (_control.Display.FoldoutStatusBasics) { EditorGUI.indentLevel++; EditorGUILayout.Separator(); CreatureObjectEditor.DrawInitialDurability(_control.Creature.Status); //EditorGUI.BeginDisabledGroup( _control.Creature.Status.UseAdvanced == true ); // CreatureObjectEditor.DrawDurabilitySlider( _control.Creature.Status ); //EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(_control.Creature.Status.IsDestructible == false); EditorGUI.indentLevel++; if (_control.Creature.Status.UseAdvanced) { _control.Creature.Status.DamageInPercent = ICEEditorLayout.DefaultSlider("Damage", "", _control.Creature.Status.DamageInPercent, 0.025f, 0, 100, 0, Info.STATUS_DAMAGE_IN_PERCENT); _control.Creature.Status.StressInPercent = ICEEditorLayout.DefaultSlider("Stress", "", _control.Creature.Status.StressInPercent, 0.025f, 0, 100, 0, Info.STATUS_STRESS_IN_PERCENT); _control.Creature.Status.DebilityInPercent = ICEEditorLayout.DefaultSlider("Debility", "", _control.Creature.Status.DebilityInPercent, 0.025f, 0, 100, 0, Info.STATUS_DEBILITY_IN_PERCENT); _control.Creature.Status.HungerInPercent = ICEEditorLayout.DefaultSlider("Hunger", "", _control.Creature.Status.HungerInPercent, 0.025f, 0, 100, 0, Info.STATUS_HUNGER_IN_PERCENT); _control.Creature.Status.ThirstInPercent = ICEEditorLayout.DefaultSlider("Thirst", "", _control.Creature.Status.ThirstInPercent, 0.025f, 0, 100, 0, Info.STATUS_THIRST_IN_PERCENT); EditorGUILayout.Separator(); _control.Creature.Status.Aggressivity = ICEEditorLayout.DefaultSlider("Aggressivity", "", _control.Creature.Status.Aggressivity, 0.025f, 0, 100, _control.Creature.Status.DefaultAggressivity, Info.STATUS_INFLUENCES_AGGRESSIVITY); _control.Creature.Status.Experience = ICEEditorLayout.DefaultSlider("Experience", "", _control.Creature.Status.Experience, 0.025f, 0, 100, _control.Creature.Status.DefaultExperience, Info.STATUS_INFLUENCES_EXPERIENCE); _control.Creature.Status.Nosiness = ICEEditorLayout.DefaultSlider("Nosiness", "", _control.Creature.Status.Nosiness, 0.025f, 0, 100, _control.Creature.Status.DefaultNosiness, Info.STATUS_INFLUENCES_NOSINESS); _control.Creature.Status.Anxiety = ICEEditorLayout.DefaultSlider("Anxiety", "", _control.Creature.Status.Anxiety, 0.025f, 0, 100, _control.Creature.Status.DefaultAnxiety, Info.STATUS_INFLUENCES_ANXIETY); } else { _control.Creature.Status.DamageInPercent = ICEEditorLayout.Slider("Damage", "", _control.Creature.Status.DamageInPercent, Init.DECIMAL_PRECISION, 0, 100, Info.STATUS_DAMAGE_IN_PERCENT); } EditorGUILayout.Separator(); CreatureObjectEditor.DrawDamageTransfer(_control.Creature.Status, Info.STATUS_DAMAGE_TRANSFER_MULTIPLIER); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); CreatureObjectEditor.DrawStatusMass(_control.Creature.Status); ICEEditorLayout.MinMaxDefaultSlider("Perception Time (secs.)", "", ref _control.Creature.Status.PerceptionTimeMin, ref _control.Creature.Status.PerceptionTimeMax, 0, 10, 0.4f, 0.6f, Init.DECIMAL_PRECISION_TIMER, 40, Info.STATUS_PERCEPTION_TIME); if (_control.Creature.Status.UseAdvanced) { EditorGUI.indentLevel++; _control.Creature.Status.PerceptionTimeFitnessMultiplier = ICEEditorLayout.DefaultSlider("Fitness Multiplier (inv. +)", "", _control.Creature.Status.PerceptionTimeFitnessMultiplier, 0.025f, 0, 1, 0.3f, Info.STATUS_REACTION_TIME_MULTIPLIER); EditorGUI.indentLevel--; } ICEEditorLayout.MinMaxDefaultSlider("Reaction Time (secs.)", "", ref _control.Creature.Status.ReactionTimeMin, ref _control.Creature.Status.ReactionTimeMax, 0, 2, 0.1f, 0.2f, Init.DECIMAL_PRECISION_TIMER, 40, Info.STATUS_REACTION_TIME); EditorGUILayout.Separator(); ICEEditorLayout.MinMaxRandomDefaultSlider("Recovery Phase (secs.)", "Defines how long the creature will be defenceless after spawning.", ref _control.Creature.Status.RecoveryPhaseMin, ref _control.Creature.Status.RecoveryPhaseMax, 0, ref _control.Creature.Status.RecoveryPhaseMaximum, 0.01f, 0.1f, Init.DECIMAL_PRECISION_TIMER, 30, Info.STATUS_RECOVERY_PHASE); ICEEditorLayout.MinMaxRandomDefaultSlider("Removing Delay (secs.)", "Defines how long the creature will be visible after dying and before respawning.", ref _control.Creature.Status.RemovingDelayMin, ref _control.Creature.Status.RemovingDelayMax, 0, ref _control.Creature.Status.RemovingDelayMaximum, 0, 0, Init.DECIMAL_PRECISION_TIMER, 30, Info.STATUS_REMOVING_DELAY); EditorGUILayout.Separator(); _control.Creature.Status.FitnessRecreationLimit = ICEEditorLayout.DefaultSlider("Recreation Limit (%)", "If the fitness value reached this limit your creature will go home to recreate.", _control.Creature.Status.FitnessRecreationLimit, 0.5f, 0, 100, 0, Info.STATUS_FITNESS_RECREATION_LIMIT); _control.Creature.Status.FitnessVitalityLimit = ICEEditorLayout.DefaultSlider("Vitality Limit (%)", "If the fitness value reached this limit your creature will be to weak for further activities.", _control.Creature.Status.FitnessVitalityLimit, 0.5f, 0, 100, 0, Info.STATUS_FITNESS_VITALITY_LIMIT); EditorGUILayout.Separator(); // ODOUR BEGIN CreatureObjectEditor.DrawOdourObject(_control.Creature.Status.Odour); // ODOUR END // GENDER BEGIN _control.Creature.Status.GenderType = (CreatureGenderType)ICEEditorLayout.EnumPopup("Gender", "", _control.Creature.Status.GenderType, Info.STATUS_GENDER); // GENDER END // TROPHIC LEVEL BEGIN ICEEditorLayout.BeginHorizontal(); _control.Creature.Status.TrophicLevel = (TrophicLevelType)ICEEditorLayout.EnumPopup("Trophic Level", "", _control.Creature.Status.TrophicLevel); if (ICEEditorLayout.RandomButton("")) { _control.Creature.Status.CalculateRandomStatusValues(_control.Creature.Status.TrophicLevel); } _control.Creature.Status.UseDynamicInitialisation = ICEEditorLayout.CheckButtonSmall("DYN", "", _control.Creature.Status.UseDynamicInitialisation); ICEEditorLayout.EndHorizontal(Info.STATUS_FEEDTYPE); EditorGUI.indentLevel++; if (_control.Creature.Status.TrophicLevel == TrophicLevelType.OMNIVORES || _control.Creature.Status.TrophicLevel == TrophicLevelType.CARNIVORE) { _control.Creature.Status.IsCannibal = ICEEditorLayout.Toggle("Is Cannibal", "", _control.Creature.Status.IsCannibal, Info.STATUS_FEEDTYPE_CANNIBAL); } else { _control.Creature.Status.IsCannibal = false; } EditorGUI.indentLevel--; // TROPHIC LEVEL END EditorGUILayout.Separator(); WorldObjectEditor.DrawStatusAging(_control.Creature.Status); _control.Creature.Status.UseEnvironmentTemperature = ICEEditorLayout.Toggle("Use Environment Temperature", "", _control.Creature.Status.UseEnvironmentTemperature, Info.STATUS_TEMPERATURE); if (_control.Creature.Status.UseEnvironmentTemperature) { EditorGUI.indentLevel++; _control.Creature.Status.ComfortEnvironmentTemperature = ICEEditorLayout.Slider("Comfort Environment Temperature", "", _control.Creature.Status.ComfortEnvironmentTemperature, 1, _control.Creature.Status.MinEnvironmentTemperature, _control.Creature.Status.MaxEnvironmentTemperature, Info.STATUS_TEMPERATURE_BEST); EditorGUI.indentLevel++; ICEEditorLayout.MinMaxSlider("Temperature Scope", "Minimal and maximal Temperatures", ref _control.Creature.Status.MinEnvironmentTemperature, ref _control.Creature.Status.MaxEnvironmentTemperature, _control.Creature.Status.EnvironmentMinTemperature, _control.Creature.Status.EnvironmentMaxTemperature, 1, 40, Info.STATUS_TEMPERATURE_SCOPE); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Separator(); } _control.Creature.Status.UseArmor = ICEEditorLayout.Toggle("Use Armor", "", _control.Creature.Status.UseArmor, Info.STATUS_ARMOR); if (_control.Creature.Status.UseArmor) { EditorGUI.indentLevel++; _control.Creature.Status.ArmorInPercent = ICEEditorLayout.DefaultSlider("Armor", "", _control.Creature.Status.ArmorInPercent, 1, 0, 100, 100, Info.STATUS_ARMOR_IN_PERCENT); EditorGUI.indentLevel--; } _control.Creature.Status.UseShelter = ICEEditorLayout.Toggle("Use Shelter", "", _control.Creature.Status.UseShelter, Info.STATUS_SHELTER); if (_control.Creature.Status.UseShelter) { EditorGUI.indentLevel++; if (_control.Creature.Status.IsSheltered) { GUI.backgroundColor = Color.green; } _control.Creature.Status.ShelterTag = ICEEditorLayout.Tag("Shelter Tag", "", _control.Creature.Status.ShelterTag, Info.STATUS_SHELTER_TAG); GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor; EditorGUI.indentLevel--; EditorGUILayout.Separator(); } _control.Creature.Status.UseIndoor = ICEEditorLayout.Toggle("Use Indoor", "", _control.Creature.Status.UseIndoor, Info.STATUS_INDOOR); if (_control.Creature.Status.UseIndoor) { EditorGUI.indentLevel++; if (_control.Creature.Status.IsIndoor) { GUI.backgroundColor = Color.green; } _control.Creature.Status.IndoorTag = ICEEditorLayout.Tag("Indoor Tag", "", _control.Creature.Status.IndoorTag, Info.STATUS_INDOOR_TAG); GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor; EditorGUI.indentLevel--; EditorGUILayout.Separator(); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); } EditorGUI.indentLevel--; }
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 }
//private vp_DamageInfo.DamageType _damage_type; public override void OnInspectorGUI() { ICECreatureTPCAdapter _adapter = (ICECreatureTPCAdapter)target; ICECreatureControl _control = _adapter.GetComponent <ICECreatureControl>(); EditorGUILayout.Separator(); _adapter.UseCreatureDamage = ICEEditorLayout.ToggleLeft("Creature Damage", "", _adapter.UseCreatureDamage, true); if (_adapter.UseCreatureDamage) { EditorGUI.indentLevel++; _adapter.UseAdvanced = ICEEditorLayout.ToggleLeft("Use Advanced", "", _adapter.UseAdvanced, true); if (_adapter.UseAdvanced) { CreatureObjectEditor.DrawInfluenceDataObject(_adapter.Influences, EditorHeaderType.FOLDOUT_ENABLED_BOLD, _control.Creature.Status.UseAdvanced); } EditorGUI.indentLevel--; EditorGUILayout.Separator(); } _adapter.UsePlayerDamage = ICEEditorLayout.ToggleLeft("Player Damage", "", _adapter.UsePlayerDamage, true); if (_adapter.UsePlayerDamage) { EditorGUI.indentLevel++; _adapter.UseMultiplePlayerDamageHandler = ICEEditorLayout.Toggle("Use Multiple Damage Handler", "", _adapter.UseMultiplePlayerDamageHandler, ""); if (_adapter.UseMultiplePlayerDamageHandler) { foreach (ICECreaturePlayerDamageObject _damage in _adapter.PlayerDamages) { ICEEditorLayout.BeginHorizontal(); ICEEditorLayout.Label(_damage.DamageBehaviourModeKey, true); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("X", "Delete"), ICEEditorStyle.CMDButton)) { _adapter.PlayerDamages.Remove(_damage); return; } ICEEditorLayout.EndHorizontal(); DrawPlayerDamage(_control, _damage); } ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1); ICEEditorLayout.BeginHorizontal(); _damage_behaviour = Popups.BehaviourPopup(_control, _damage_behaviour); EditorGUI.BeginDisabledGroup(_damage_behaviour.Trim() == ""); if (GUILayout.Button(new GUIContent("ADD", "Adds a new damage handler"), ICEEditorStyle.CMDButtonDouble)) { _adapter.AddPlayerDamage(_damage_behaviour); } EditorGUI.EndDisabledGroup(); ICEEditorLayout.EndHorizontal(); } else { DrawPlayerDamage(_control, _adapter.SimpleDamage); } EditorGUI.indentLevel--; } 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 }