Skip to content

Commit

Permalink
feat: Added method to get hit list.
Browse files Browse the repository at this point in the history
List of hit hurtables per group can now be accessed via GetHitList.
  • Loading branch information
christides11 committed Aug 18, 2020
1 parent 59676c7 commit 77d6a90
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 18 deletions.
9 changes: 9 additions & 0 deletions Assets/CAF/Entities/Managers/EntityHitboxManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public EntityHitboxManager(EntityCombatManager combatManager, EntityManager mana
this.manager = manager;
}

public virtual List<IHurtable> GetHitList(int group)
{
if (!hurtablesHit.ContainsKey(group))
{
return null;
}
return hurtablesHit[group];
}

/// <summary>
/// Destroys all boxes and clears variables.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ MonoBehaviour:
m_Name: Ground_AA
m_EditorClassIdentifier:
graph: {fileID: 11400000}
position: {x: -8, y: -88}
position: {x: -56, y: -104}
ports:
keys:
- lastNode
- nextNode
- nextNode 0
values:
- _fieldName: lastNode
_node: {fileID: -5309879101736589152}
Expand All @@ -41,6 +42,18 @@ MonoBehaviour:
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: nextNode 0
_node: {fileID: -5309879101736589152}
_typeQualifiedName: CAF.Combat.MovesetAttackNode+nextNodeDefinition, CAF, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
connections:
- fieldName: lastNode
node: {fileID: 7783888192108734346}
reroutePoints: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
_dynamic: 1
lastNode: {fileID: 4997239229425092478}
executeInputs:
- inputType: 0
Expand All @@ -49,7 +62,9 @@ MonoBehaviour:
directionDeviation: 0
inputSequence: []
attackDefinition: {fileID: 11400000, guid: 2e0abd68fbe37d246b9fe3a7446475be, type: 2}
nextNode: []
nextNode:
- cancelWindow: {x: 9, y: 60}
node: {fileID: 7783888192108734346}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -65,6 +80,7 @@ MonoBehaviour:
nodes:
- {fileID: 4997239229425092478}
- {fileID: -5309879101736589152}
- {fileID: 7783888192108734346}
groundAttackCommandNormals: []
groundAttackStartNodes:
- {fileID: 4997239229425092478}
Expand Down Expand Up @@ -132,3 +148,53 @@ MonoBehaviour:
nextNode:
- cancelWindow: {x: 9, y: 60}
node: {fileID: -5309879101736589152}
--- !u!114 &7783888192108734346
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5cf4d5189da6b334e93745642899b7ca, type: 3}
m_Name: Ground_AAA
m_EditorClassIdentifier:
graph: {fileID: 11400000}
position: {x: 184, y: -104}
ports:
keys:
- lastNode
- nextNode
values:
- _fieldName: lastNode
_node: {fileID: 7783888192108734346}
_typeQualifiedName: CAF.Combat.MovesetAttackNode, CAF, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
connections:
- fieldName: nextNode 0
node: {fileID: -5309879101736589152}
reroutePoints: []
_direction: 0
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
- _fieldName: nextNode
_node: {fileID: 7783888192108734346}
_typeQualifiedName: System.Collections.Generic.List`1[[CAF.Combat.MovesetAttackNode+nextNodeDefinition,
CAF, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089
connections: []
_direction: 1
_connectionType: 0
_typeConstraint: 0
_dynamic: 0
lastNode: {fileID: -5309879101736589152}
executeInputs:
- inputType: 0
buttonID: 3
stickDirection: {x: 0, y: 0}
directionDeviation: 0
inputSequence: []
attackDefinition: {fileID: 11400000, guid: 70e3e4c4a9abb8a4fac77a6ca3d3dc29, type: 2}
nextNode: []
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ MonoBehaviour:
chargeWindows: []
boxGroups:
- id: 0
events: []
events:
- id: 1
references:
version: 1
00000000:
Expand All @@ -51,8 +52,25 @@ MonoBehaviour:
chargeLevelNeeded: -1
chargeLevelMax: 4
hitboxHitInfo:
id: 1
id: 2
00000001:
type: {class: AttackEventDefinition, ns: CAF.Combat, asm: CAF}
data:
nickname: X Friction
active: 1
onHit: 0
onHitHitboxGroup: 0
startFrame: 3
endFrame: 30
attackEvent:
id: 3
variables:
intVars:
floatVars:
- 0.01
objectVars: []
curveVars: []
00000002:
type: {class: HitInfo, ns: CAF.Combat, asm: CAF}
data:
airOnly: 0
Expand Down Expand Up @@ -83,3 +101,8 @@ MonoBehaviour:
opponentMaxMagnitude: 1
opponentMinMagnitude: 1
throwConfirm: {fileID: 0}
00000003:
type: {class: ApplyFriction, ns: TDAction.Combat.Events, asm: TDAction_CSharp}
data:
xFriction: 1
yFriction: 0
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ MonoBehaviour:
animationGround: {fileID: 0}
animationAir: {fileID: 0}
wrapMode: 0
jumpCancelWindows: []
jumpCancelWindows:
- {x: 9, y: 60}
enemyStepWindows: []
landCancelWindows: []
commandAttackCancelWindows: []
chargeWindows: []
boxGroups:
- id: 0
events: []
events:
- id: 1
references:
version: 1
00000000:
Expand All @@ -50,8 +52,25 @@ MonoBehaviour:
chargeLevelNeeded: -1
chargeLevelMax: 1
hitboxHitInfo:
id: 1
id: 2
00000001:
type: {class: AttackEventDefinition, ns: CAF.Combat, asm: CAF}
data:
nickname: X Friction
active: 1
onHit: 0
onHitHitboxGroup: 0
startFrame: 1
endFrame: 1
attackEvent:
id: 3
variables:
intVars:
floatVars:
- 0.01
objectVars: []
curveVars: []
00000002:
type: {class: HitInfo, ns: CAF.Combat, asm: CAF}
data:
airOnly: 0
Expand Down Expand Up @@ -82,3 +101,8 @@ MonoBehaviour:
opponentMaxMagnitude: 1
opponentMinMagnitude: 1
throwConfirm: {fileID: 0}
00000003:
type: {class: ApplyFriction, ns: TDAction.Combat.Events, asm: TDAction_CSharp}
data:
xFriction: 1
yFriction: 0
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,37 @@ MonoBehaviour:
attackName: Ground AAA
description:
stateOverride: -1
length: 30
length: 35
heightRestriction: 0
gravityScaleAdded: 0
animationGround: {fileID: 0}
animationAir: {fileID: 0}
wrapMode: 0
jumpCancelWindows: []
jumpCancelWindows:
- {x: 11, y: 60}
enemyStepWindows: []
landCancelWindows: []
commandAttackCancelWindows: []
chargeWindows: []
boxGroups:
chargeWindows:
- id: 0
boxGroups:
- id: 1
events: []
references:
version: 1
00000000:
type: {class: ChargeDefinition, ns: CAF.Combat, asm: CAF}
data:
frame: 6
releaseOnCompletion: 1
chargeLevels:
- maxChargeFrames: 15
00000001:
type: {class: BoxGroup, ns: CAF.Combat, asm: CAF}
data:
ID: 0
activeFramesStart: 5
activeFramesEnd: 8
activeFramesStart: 7
activeFramesEnd: 10
hitGroupType: 0
boxes:
- shape: 0
Expand All @@ -50,8 +59,8 @@ MonoBehaviour:
chargeLevelNeeded: -1
chargeLevelMax: 1
hitboxHitInfo:
id: 1
00000001:
id: 2
00000002:
type: {class: HitInfo, ns: CAF.Combat, asm: CAF}
data:
airOnly: 0
Expand All @@ -61,8 +70,8 @@ MonoBehaviour:
spaceBetweenHits: 0
opponentResetXForce: 1
opponentResetYForce: 1
attackerHitstop: 4
hitstop: 4
attackerHitstop: 6
hitstop: 6
hitstun: 30
forceType: 0
forceRelation: 1
Expand Down
18 changes: 18 additions & 0 deletions Assets/CAF/Samples/TDAction/Scenes/PlayScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ GameObject:
- component: {fileID: 597232825}
- component: {fileID: 597232827}
- component: {fileID: 597232826}
- component: {fileID: 597232828}
m_Layer: 0
m_Name: cm
m_TagString: Untagged
Expand Down Expand Up @@ -1072,6 +1073,23 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &597232828
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 597232824}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68bb026fafb42b14791938953eaace77, type: 3}
m_Name:
m_EditorClassIdentifier:
m_NoiseProfile: {fileID: 11400000, guid: 69ce8388f6785dd4c8c39915efece2f4, type: 2}
m_PivotOffset: {x: 0, y: 0, z: 0}
m_AmplitudeGain: 1
m_FrequencyGain: 0
mNoiseOffsets: {x: 0, y: 0, z: 0}
--- !u!1 &599076303
GameObject:
m_ObjectHideFlags: 0
Expand Down
8 changes: 8 additions & 0 deletions Assets/CAF/Samples/TDAction/Scripts/Combat/Events.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions Assets/CAF/Samples/TDAction/Scripts/Combat/Events/ApplyFriction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Collections.Generic;
using UnityEngine;
using CAF.Combat;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace TDAction.Combat.Events
{
public class ApplyFriction : AttackEvent
{
public bool xFriction;
public bool yFriction;

public override string GetName()
{
return "Friction";
}

public override bool Evaluate(uint frame, uint endFrame,
CAF.Entities.EntityManager controller, AttackEventVariables variables)
{
if (xFriction)
{
controller.PhysicsManager.ApplyMovementFriction(variables.floatVars[0]);
}
if (yFriction)
{
controller.PhysicsManager.ApplyGravityFriction(variables.floatVars[0]);
}
return false;
}

#if UNITY_EDITOR
public override void DrawEventVariables(CAF.Combat.AttackEventDefinition eventDefinition)
{
if (eventDefinition.variables.floatVars == null
|| eventDefinition.variables.floatVars.Count != 1)
{
eventDefinition.variables.floatVars = new List<float>(1);
eventDefinition.variables.floatVars.Add(0);
}

xFriction = EditorGUILayout.Toggle("X-Axis", xFriction);
yFriction = EditorGUILayout.Toggle("Y-Axis", yFriction);

eventDefinition.variables.floatVars[0] = EditorGUILayout.FloatField("Friction",
eventDefinition.variables.floatVars[0]);
}
#endif
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 77d6a90

Please sign in to comment.