protected virtual void DrawHitboxOptions(BoxGroup currentGroup, int index) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("X", GUILayout.Width(20))) { currentGroup.boxes.RemoveAt(index); return; } GUILayout.Label($"Group {index}"); EditorGUILayout.EndHorizontal(); currentGroup.boxes[index].shape = (BoxShapes)EditorGUILayout.EnumPopup("Shape", currentGroup.boxes[index].shape); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Offset", GUILayout.Width(135)); currentGroup.boxes[index].offset.x = EditorGUILayout.FloatField(currentGroup.boxes[index].offset.x, GUILayout.Width(40)); currentGroup.boxes[index].offset.y = EditorGUILayout.FloatField(currentGroup.boxes[index].offset.y, GUILayout.Width(40)); currentGroup.boxes[index].offset.z = EditorGUILayout.FloatField(currentGroup.boxes[index].offset.z, GUILayout.Width(40)); EditorGUILayout.EndHorizontal(); switch (currentGroup.boxes[index].shape) { case BoxShapes.Rectangle: EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Size", GUILayout.Width(135)); currentGroup.boxes[index].size.x = EditorGUILayout.FloatField(currentGroup.boxes[index].size.x, GUILayout.Width(40)); currentGroup.boxes[index].size.y = EditorGUILayout.FloatField(currentGroup.boxes[index].size.y, GUILayout.Width(40)); currentGroup.boxes[index].size.z = EditorGUILayout.FloatField(currentGroup.boxes[index].size.z, GUILayout.Width(40)); EditorGUILayout.EndHorizontal(); break; case BoxShapes.Circle: currentGroup.boxes[index].radius = EditorGUILayout.FloatField("Radius", currentGroup.boxes[index].radius); break; } }
protected virtual void DrawHitStunOptions(BoxGroup currentGroup) { currentGroup.hitboxHitInfo.attackerHitstop = (ushort)EditorGUILayout.IntField("Hitstop (Attacker)", currentGroup.hitboxHitInfo.attackerHitstop); currentGroup.hitboxHitInfo.hitstop = (ushort)EditorGUILayout.IntField("Hitstop", currentGroup.hitboxHitInfo.hitstop); currentGroup.hitboxHitInfo.hitstun = (ushort)EditorGUILayout.IntField("Hitstun", currentGroup.hitboxHitInfo.hitstun); }
public BoxGroup(BoxGroup other) { ID = other.ID; activeFramesStart = other.activeFramesStart; activeFramesEnd = other.activeFramesEnd; hitGroupType = other.hitGroupType; boxes = new List <BoxDefinition>(other.boxes); attachToEntity = other.attachToEntity; hitboxHitInfo = new HitInfo(other.hitboxHitInfo); }
protected virtual void DrawHitboxOptions(BoxGroup currentGroup, int index) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("X", GUILayout.Width(20))) { currentGroup.boxes.RemoveAt(index); return; } GUILayout.Label($"Group {index}"); EditorGUILayout.EndHorizontal(); currentGroup.boxes[index].DrawInspector(); }
public BoxGroup(BoxGroup other) { ID = other.ID; activeFramesStart = other.activeFramesStart; activeFramesEnd = other.activeFramesEnd; hitGroupType = other.hitGroupType; attachToEntity = other.attachToEntity; if (other.hitboxHitInfo.GetType() == typeof(HitInfo)) { hitboxHitInfo = new HitInfo((HitInfo)other.hitboxHitInfo); } boxes = new List <BoxDefinitionBase>(); }
protected virtual void DrawBoxGroup(BoxGroup currentGroup) { EditorGUILayout.LabelField("GENERAL", EditorStyles.boldLabel); currentGroup.ID = EditorGUILayout.IntField("Group ID", currentGroup.ID); float activeFramesStart = currentGroup.activeFramesStart; float activeFramesEnd = currentGroup.activeFramesEnd; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(currentGroup.activeFramesStart.ToString(), GUILayout.Width(30)); EditorGUILayout.MinMaxSlider(ref activeFramesStart, ref activeFramesEnd, 1, (float)attack.length); EditorGUILayout.LabelField(currentGroup.activeFramesEnd.ToString(), GUILayout.Width(30)); EditorGUILayout.EndHorizontal(); currentGroup.activeFramesStart = (int)activeFramesStart; currentGroup.activeFramesEnd = (int)activeFramesEnd; currentGroup.hitGroupType = (BoxGroupType)EditorGUILayout.EnumPopup("Hit Type", currentGroup.hitGroupType); currentGroup.attachToEntity = EditorGUILayout.Toggle("Attach to Entity", currentGroup.attachToEntity); EditorGUILayout.BeginHorizontal(GUILayout.Width(300)); boxesFoldout = EditorGUILayout.Foldout(boxesFoldout, "Boxes", true); if (GUILayout.Button("Add")) { BoxGroupAddBoxDefinition(currentGroup); } EditorGUILayout.EndHorizontal(); if (boxesFoldout) { EditorGUI.indentLevel++; for (int i = 0; i < currentGroup.boxes.Count; i++) { DrawHitboxOptions(currentGroup, i); GUILayout.Space(5); } EditorGUI.indentLevel--; } EditorGUILayout.Space(10); switch (currentGroup.hitGroupType) { case BoxGroupType.HIT: DrawBoxGroupHitOptions(currentGroup); break; case BoxGroupType.GRAB: DrawBoxGroupGrabOptions(currentGroup); break; } }
protected virtual void DrawHitEffectsOptions(BoxGroup currentGroup) { currentGroup.hitboxHitInfo.groundOnly = EditorGUILayout.Toggle("Hit Ground Only?", currentGroup.hitboxHitInfo.groundOnly); currentGroup.hitboxHitInfo.airOnly = EditorGUILayout.Toggle("Hit Air Only?", currentGroup.hitboxHitInfo.airOnly); currentGroup.hitboxHitInfo.unblockable = EditorGUILayout.Toggle("Unblockable?", currentGroup.hitboxHitInfo.unblockable); currentGroup.hitboxHitInfo.breakArmor = EditorGUILayout.Toggle("Breaks Armor?", currentGroup.hitboxHitInfo.breakArmor); currentGroup.hitboxHitInfo.groundBounces = EditorGUILayout.Toggle("Ground Bounces?", currentGroup.hitboxHitInfo.groundBounces); currentGroup.hitboxHitInfo.wallBounces = EditorGUILayout.Toggle("Wall Bounces?", currentGroup.hitboxHitInfo.wallBounces); currentGroup.hitboxHitInfo.causesTumble = EditorGUILayout.Toggle("Causes Tumble?", currentGroup.hitboxHitInfo.causesTumble); currentGroup.hitboxHitInfo.knockdown = EditorGUILayout.Toggle("Causes Knockdown?", currentGroup.hitboxHitInfo.knockdown); currentGroup.hitboxHitInfo.continuousHit = EditorGUILayout.Toggle("Continuous Hit?", currentGroup.hitboxHitInfo.continuousHit); if (currentGroup.hitboxHitInfo.continuousHit) { currentGroup.hitboxHitInfo.spaceBetweenHits = EditorGUILayout.IntField("Space between hits", currentGroup.hitboxHitInfo.spaceBetweenHits); } }
protected virtual void DrawBoxesMenu() { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("<", GUILayout.Width(40))) { currentHitboxGroupIndex--; if (currentHitboxGroupIndex < 0) { currentHitboxGroupIndex = Mathf.Clamp(attack.boxGroups.Count - 1, 0, attack.boxGroups.Count); } } EditorGUILayout.LabelField($"{currentHitboxGroupIndex + 1}/{attack.boxGroups.Count}", GUILayout.Width(50)); GUILayout.Width(50); if (GUILayout.Button(">", GUILayout.Width(40))) { currentHitboxGroupIndex++; if (currentHitboxGroupIndex >= attack.boxGroups.Count) { currentHitboxGroupIndex = 0; } } if (GUILayout.Button("Add", GUILayout.Width(50))) { AddBoxGroup(); } if (GUILayout.Button("Remove", GUILayout.Width(60))) { attack.boxGroups.RemoveAt(currentHitboxGroupIndex); currentHitboxGroupIndex--; } EditorGUILayout.EndHorizontal(); GUILayout.Space(30); if (attack.boxGroups.Count == 0) { return; } BoxGroup currentGroup = attack.boxGroups[currentHitboxGroupIndex]; scrollPos = EditorGUILayout.BeginScrollView(scrollPos); DrawBoxGroup(currentGroup); EditorGUILayout.EndScrollView(); }
protected virtual void DrawBoxesMenu() { EditorGUILayout.BeginHorizontal(); BoxesMenuNavigationBar(); EditorGUILayout.EndHorizontal(); GUILayout.Space(30); if (attack.boxGroups.Count == 0) { return; } BoxGroup currentGroup = attack.boxGroups[currentHitboxGroupIndex]; scrollPos = EditorGUILayout.BeginScrollView(scrollPos); DrawBoxGroup(currentGroup); EditorGUILayout.EndScrollView(); }
protected virtual void DrawBoxGroupHitOptions(BoxGroup currentGroup) { EditorGUILayout.LabelField("EFFECT", EditorStyles.boldLabel); DrawHitEffectsOptions(currentGroup); EditorGUILayout.Space(10); EditorGUILayout.LabelField("DAMAGE", EditorStyles.boldLabel); DrawHitDamageOptions(currentGroup); EditorGUILayout.Space(10); EditorGUILayout.LabelField("FORCES", EditorStyles.boldLabel); DrawHitForcesOptions(currentGroup); EditorGUILayout.Space(10); EditorGUILayout.LabelField("STUN", EditorStyles.boldLabel); DrawHitStunOptions(currentGroup); EditorGUILayout.Space(10); }
protected virtual void DrawHitForcesOptions(BoxGroup currentGroup) { currentGroup.hitboxHitInfo.opponentResetXForce = EditorGUILayout.Toggle("Reset X Force", currentGroup.hitboxHitInfo.opponentResetXForce); currentGroup.hitboxHitInfo.opponentResetYForce = EditorGUILayout.Toggle("Reset Y Force", currentGroup.hitboxHitInfo.opponentResetYForce); currentGroup.hitboxHitInfo.forceRelation = (HitboxForceRelation)EditorGUILayout.EnumPopup("Force Relation", currentGroup.hitboxHitInfo.forceRelation); currentGroup.hitboxHitInfo.forceType = (HitboxForceType)EditorGUILayout.EnumPopup("Force Type", currentGroup.hitboxHitInfo.forceType); switch (currentGroup.hitboxHitInfo.forceType) { case HitboxForceType.SET: currentGroup.hitboxHitInfo.opponentForceDir = EditorGUILayout.Vector3Field("Force Direction", currentGroup.hitboxHitInfo.opponentForceDir); if (GUILayout.Button("Normalize")) { currentGroup.hitboxHitInfo.opponentForceDir.Normalize(); } currentGroup.hitboxHitInfo.opponentForceMagnitude = EditorGUILayout.FloatField("Force Magnitude", currentGroup.hitboxHitInfo.opponentForceMagnitude); break; case HitboxForceType.PUSH: currentGroup.hitboxHitInfo.forceIncludeYForce = EditorGUILayout.Toggle("Include Y Force", currentGroup.hitboxHitInfo.forceIncludeYForce); currentGroup.hitboxHitInfo.opponentForceMagnitude = EditorGUILayout.FloatField("Force Multiplier", currentGroup.hitboxHitInfo.opponentForceMagnitude); break; case HitboxForceType.PULL: currentGroup.hitboxHitInfo.forceIncludeYForce = EditorGUILayout.Toggle("Include Y Force", currentGroup.hitboxHitInfo.forceIncludeYForce); currentGroup.hitboxHitInfo.opponentForceMagnitude = EditorGUILayout.FloatField("Force Multiplier", currentGroup.hitboxHitInfo.opponentForceMagnitude); currentGroup.hitboxHitInfo.opponentMaxMagnitude = EditorGUILayout.FloatField("Max Magnitude", currentGroup.hitboxHitInfo.opponentMaxMagnitude); break; } if (currentGroup.hitboxHitInfo.wallBounces) { currentGroup.hitboxHitInfo.wallBounceForce = EditorGUILayout.FloatField("Wall Bounce Magnitude", currentGroup.hitboxHitInfo.wallBounceForce); } }
protected virtual void DrawBoxGroup(BoxGroup currentGroup) { EditorGUILayout.LabelField("GENERAL", EditorStyles.boldLabel); EditorGUI.indentLevel++; currentGroup.ID = EditorGUILayout.IntField("Group ID", currentGroup.ID); float activeFramesStart = currentGroup.activeFramesStart; float activeFramesEnd = currentGroup.activeFramesEnd; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(currentGroup.activeFramesStart.ToString(), GUILayout.Width(30)); EditorGUILayout.MinMaxSlider(ref activeFramesStart, ref activeFramesEnd, 1, (float)attack.length); EditorGUILayout.LabelField(currentGroup.activeFramesEnd.ToString(), GUILayout.Width(30)); EditorGUILayout.EndHorizontal(); currentGroup.activeFramesStart = (int)activeFramesStart; currentGroup.activeFramesEnd = (int)activeFramesEnd; currentGroup.chargeLevelNeeded = EditorGUILayout.IntField("Charge Level Needed", currentGroup.chargeLevelNeeded); if (currentGroup.chargeLevelNeeded >= 0) { currentGroup.chargeLevelMax = EditorGUILayout.IntField("Charge Level Max", currentGroup.chargeLevelMax); } currentGroup.hitGroupType = (BoxGroupType)EditorGUILayout.EnumPopup("Hit Type", currentGroup.hitGroupType); currentGroup.attachToEntity = EditorGUILayout.Toggle("Attach to Entity", currentGroup.attachToEntity); EditorGUILayout.BeginHorizontal(GUILayout.Width(300)); boxesFoldout = EditorGUILayout.Foldout(boxesFoldout, "Boxes", true); if (GUILayout.Button("Add")) { GenericMenu menu = new GenericMenu(); foreach (string t in boxDefinitionTypes.Keys) { string destination = t.Replace('.', '/'); menu.AddItem(new GUIContent(destination), true, OnBoxDefinitionSelected, t); } menu.ShowAsContext(); } EditorGUILayout.EndHorizontal(); if (boxesFoldout) { EditorGUI.indentLevel++; for (int i = 0; i < currentGroup.boxes.Count; i++) { DrawHitboxOptions(currentGroup, i); GUILayout.Space(5); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; EditorGUILayout.Space(10); if (GUILayout.Button("Set HitInfo Type")) { GenericMenu menu = new GenericMenu(); foreach (string t in hitInfoTypes.Keys) { string destination = t.Replace('.', '/'); menu.AddItem(new GUIContent(destination), true, OnHitInfoSelected, t); } menu.ShowAsContext(); } if (currentGroup.hitboxHitInfo == null) { return; } switch (currentGroup.hitGroupType) { case BoxGroupType.HIT: currentGroup.hitboxHitInfo.DrawInspectorHitInfo(); break; case BoxGroupType.GRAB: currentGroup.hitboxHitInfo.DrawInspectorGrabInfo(); break; } }
protected virtual void DrawBoxGroupGrabOptions(BoxGroup currentGroup) { currentGroup.throwConfirm = (AttackDefinition)EditorGUILayout.ObjectField("Throw Confirm Attack", currentGroup.throwConfirm, typeof(AttackDefinition), false); }
protected virtual void DrawHitDamageOptions(BoxGroup currentGroup) { currentGroup.hitboxHitInfo.damageOnBlock = EditorGUILayout.FloatField("Damage (Block)", currentGroup.hitboxHitInfo.damageOnBlock); currentGroup.hitboxHitInfo.damageOnHit = EditorGUILayout.FloatField("Damage (Hit)", currentGroup.hitboxHitInfo.damageOnHit); currentGroup.hitboxHitInfo.hitKills = EditorGUILayout.Toggle("Hit Kills", currentGroup.hitboxHitInfo.hitKills); }
protected virtual void BoxGroupAddBoxDefinition(BoxGroup currentGroup) { currentGroup.boxes.Add(new BoxDefinition()); }