Skip to content

Commit

Permalink
feat: Added function MarkForStateChange.
Browse files Browse the repository at this point in the history
  • Loading branch information
christides11 committed Apr 24, 2022
1 parent 2e7316a commit d69ac71
Show file tree
Hide file tree
Showing 27 changed files with 260 additions and 148 deletions.
3 changes: 0 additions & 3 deletions Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,6 @@
<Reference Include="Unity.TextMeshPro.Editor">
<HintPath>C:\Projects\Unity\hack-and-slash-framework\Library\ScriptAssemblies\Unity.TextMeshPro.Editor.dll</HintPath>
</Reference>
<Reference Include="Unity.VisualStudio.Editor">
<HintPath>C:\Projects\Unity\hack-and-slash-framework\Library\ScriptAssemblies\Unity.VisualStudio.Editor.dll</HintPath>
</Reference>
<Reference Include="medvedya.select_implementation_property_drawer">
<HintPath>C:\Projects\Unity\hack-and-slash-framework\Library\ScriptAssemblies\medvedya.select_implementation_property_drawer.dll</HintPath>
</Reference>
Expand Down
1 change: 1 addition & 0 deletions Assets/HnSF/Fighter/IFighterStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface IFighterStateManager


Combat.MovesetDefinition GetMoveset(int index);
void MarkForStateChange(int state);
bool ChangeState(int state, int stateFrame = 0, bool callOnInterrupt = true);
StateTimeline GetState(int state);
StateTimeline GetState(int moveset, int state);
Expand Down
57 changes: 5 additions & 52 deletions Assets/HnSF/Samples/TDAction/Fighters/ADV/ADV.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ GameObject:
- component: {fileID: 6164416680294650169}
- component: {fileID: 3204139750782918213}
- component: {fileID: 7070423521996889968}
- component: {fileID: 2446682337119611762}
- component: {fileID: -473810435442433682}
- component: {fileID: 1199271652}
- component: {fileID: 1199271654}
Expand Down Expand Up @@ -173,23 +172,6 @@ BoxCollider2D:
serializedVersion: 2
m_Size: {x: 0.8, y: 1.75}
m_EdgeRadius: 0
--- !u!320 &2446682337119611762
PlayableDirector:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3890948787661181835}
m_Enabled: 1
serializedVersion: 3
m_PlayableAsset: {fileID: 0}
m_InitialState: 0
m_WrapMode: 0
m_DirectorUpdateMode: 3
m_InitialTime: 0
m_SceneBindings: []
m_ExposedReferences:
m_References: []
--- !u!114 &-473810435442433682
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -206,8 +188,8 @@ MonoBehaviour:
_combatManager: {fileID: 1199271654}
_physicsManager: {fileID: 1199271653}
_inputManager: {fileID: 7836252275299144723}
visual: {fileID: 2309637557716152273}
definition: {fileID: 11400000, guid: c380ee3a80157994caef3895f8ca8dde, type: 2}
visual: {fileID: 2309637557716152273}
--- !u!114 &1199271652
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -220,40 +202,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: da649541cf321194e8b82f361c458e60, type: 3}
m_Name:
m_EditorClassIdentifier:
baseHitInfo:
ID: 0
coreHitInfo:
ID: 0
airOnly: 0
groundOnly: 0
causesTumble: 0
knockdown: 0
groundBounces: 0
groundBounceForce: 0
wallBounces: 0
wallBounceForce: 0
damageOnHit: 0
opponentForce: {x: 0, y: 1, z: 0}
forceIncludeYForce: 0
opponentForceMultiplier: 1
opponentMaxMagnitude: 1
opponentMinMagnitude: 1
pushPullCenterOffset: {x: 0, y: 0, z: 0}
hitKills: 1
continuousHit: 0
spaceBetweenHits: 0
opponentResetXForce: 1
opponentResetYForce: 1
autoLink: 0
autoLinkPercentage: 1
forceType: 0
forceRelation: 0
attackerHitstop: 0
hitstop: 0
hitstun: 0
<CurrentStateMoveset>k__BackingField: 0
<CurrentState>k__BackingField: 0
<CurrentStateFrame>k__BackingField: 0
fighterManager: {fileID: -473810435442433682}
currentState: 0
currentStateFrame: 0
--- !u!114 &1199271654
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -266,6 +218,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 27ad487a7dc3f04419ddca98540bb42a, type: 3}
m_Name:
m_EditorClassIdentifier:
team: 0
--- !u!114 &1199271653
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/HnSF/Samples/TDAction/Fighters/ADV/ADVMoveset.asset
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MonoBehaviour:
states:
- state:
rid: 1423070975590137858
stateTimeline: {fileID: 0}
stateTimeline: {fileID: 11400000, guid: 0ce685a764a7b84468d9883fa0fbe4c0, type: 2}
references:
version: 2
RefIds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ namespace HnSF.Sample.TDAction
{
public class FighterCombatManager : MonoBehaviour, IFighterCombatManager
{
public int HitStop { get; } = 0;
public int HitStun { get; } = 0;
public int CurrentChargeLevel { get; } = 0;
public int CurrentChargeLevelCharge { get; } = 0;
public int HitStop { get; protected set; } = 0;
public int HitStun { get; protected set; } = 0;
public int CurrentChargeLevel { get; protected set; } = 0;
public int CurrentChargeLevelCharge { get; protected set; } = 0;

public int team = 0;

public void Cleanup()
{
throw new System.NotImplementedException();
CurrentChargeLevel = 0;
CurrentChargeLevelCharge = 0;
}

public bool CheckForInputSequence(InputSequence sequence, uint baseOffset = 0, bool processSequenceButtons = false,
Expand All @@ -27,42 +30,42 @@ public bool CheckForInputSequence(InputSequence sequence, uint baseOffset = 0, b

public void SetHitStop(int value)
{
throw new System.NotImplementedException();
HitStop = value;
}

public void AddHitStop(int value)
{
throw new System.NotImplementedException();
HitStop += value;
}

public void SetHitStun(int value)
{
throw new System.NotImplementedException();
HitStun = value;
}

public void AddHitStun(int value)
{
throw new System.NotImplementedException();
HitStun += value;
}

public void SetChargeLevel(int value)
{
throw new System.NotImplementedException();
CurrentChargeLevel = value;
}

public void SetChargeLevelCharge(int value)
{
throw new System.NotImplementedException();
CurrentChargeLevelCharge = value;
}

public void IncrementChargeLevelCharge(int maxCharge)
{
throw new System.NotImplementedException();
CurrentChargeLevelCharge = Mathf.Clamp(CurrentChargeLevelCharge+1, 0, maxCharge);
}

public int GetTeam()
{
throw new System.NotImplementedException();
return team;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


namespace HnSF.Sample.TDAction
{
public class FighterInputManager : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,11 @@ public void SetGrounded(bool value)
{
IsGrounded = value;
}

public virtual void ApplyGravity()
{
/*
FighterManager m = ((FighterManager)manager);
float maxFallSpeed = m.CombatManager.HitStun > 0 ? m.statManager.CurrentStats.hitstunMaxFallSpeed.GetCurrentValue()
: m.statManager.CurrentStats.maxFallSpeed.GetCurrentValue();
float gravity = m.CombatManager.HitStun > 0 ? m.statManager.CurrentStats.hitstunGravity.GetCurrentValue()
: m.statManager.CurrentStats.gravity.GetCurrentValue();
HandleGravity(maxFallSpeed, gravity, GravityScale);*/
}

public virtual void ApplyGravity(float maxFallSpeed, float gravity, float gravityScale)

public virtual void ApplyGravity(float maxFallSpeed, float gravity)
{
Vector2 tempMovement = this.forceMovement;
if (tempMovement.y > -(maxFallSpeed))
{
tempMovement.y -= gravity * gravityScale;
if (tempMovement.y < -(maxFallSpeed))
{
tempMovement.y = -maxFallSpeed;
}
}
else if (tempMovement.y < -(maxFallSpeed))
{
tempMovement.y *= decelerationFactor;
}

tempMovement.y = Mathf.MoveTowards(tempMovement.y, maxFallSpeed, gravity * Time.fixedDeltaTime);
this.forceMovement = tempMovement;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,23 @@ namespace HnSF.Sample.TDAction
{
public class FighterStateManager : MonoBehaviour, IFighterStateManager
{
public int MovesetCount { get; }
public int CurrentStateMoveset { get; }

public HitInfoBase baseHitInfo;

public HitInfo coreHitInfo;

public int CurrentState
public int MovesetCount
{
get { return currentState; }
}
public int CurrentStateFrame
{
get { return currentStateFrame; }
get { return fighterManager.definition.movesets.Length; }
}
[field: SerializeField]
public int CurrentStateMoveset { get; protected set; } = 0;
[field: SerializeField]
public int CurrentState { get; protected set; } = 0;
[field: SerializeField]
public int CurrentStateFrame { get; protected set; } = 0;

protected Dictionary<int, StateTimeline> states = new Dictionary<int, StateTimeline>();

private bool markedForStateChange = false;
private int nextState = 0;
public FighterManager fighterManager;

public int currentState = 0;
public int currentStateFrame = 0;

private void Awake()
{

Expand Down Expand Up @@ -71,8 +63,8 @@ public bool ChangeState(int state, int stateFrame = 0, bool callOnInterrupt = tr
SetFrame(states[CurrentState].totalFrames);
}

currentStateFrame = stateFrame;
currentState = state;
CurrentStateFrame = stateFrame;
CurrentState = state;
if(CurrentStateFrame == 0)
{
InitState();
Expand Down Expand Up @@ -105,12 +97,12 @@ public void SetMoveset(int movesetIndex)

public void SetFrame(int frame)
{
currentStateFrame = frame;
CurrentStateFrame = frame;
}

public void IncrementFrame()
{
currentStateFrame++;
CurrentStateFrame++;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace HnSF.Sample.TDAction.State
{
public enum ConditionFunctionEnum : int
{
NONE = 0
}
}

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using HnSF.Fighters;

namespace HnSF.Sample.TDAction
{
public class BaseConditionFunctions
{
public static bool NoCondition(IFighterBase fighter, IConditionVariables variables)
{
return true;
}
}
}

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace HnSF.Sample.TDAction.State
{
[System.Serializable]
public enum StateFunctionEnum : int
{
NULL = 0,
CHANGE_STATE,
APPLY_GRAVITY
}
}

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

Loading

0 comments on commit d69ac71

Please sign in to comment.