lol ironically enough, even without the randomizer my player was not going into impact state for some reasonā¦
Anyway, here is my tuned attempt with the randomizer, for both the player and the enemy state machine:
PlayerStateMachine:
private void HandleForceApplied(Vector3 force)
{
if (Health.IsDead()) return;
float forceAmount = Random.Range(0f, force.sqrMagnitude);
if (forceAmount > Random.Range(0f, SkillStore.GetSkillLevel(Skill.Attack))) // I created a getter for the SkillStore...
{
SwitchState(new PlayerImpactState(this));
}
}
EnemyStateMachine:
private void HandleForceApplied(Vector3 force)
{
if (Health.IsDead()) return;
float forceAmount = Random.Range(0f, force.sqrMagnitude);
if (forceAmount > Random.Range(0f, BaseStats.GetLevel())) {
SwitchState(new EnemyImpactState(this));
}
}
Whatās concerning me though, is that the impact state never gets entered for the player even without a randomizer, albeit the code is asking it to do soā¦
Edit: Through code debugging, the player enters the Impact state, but the animation is not playing for the player for some reasonā¦ I checked the hash, all seems wellā¦
Edit 2: Entering and Exiting the Impact state work perfectly fineā¦ now Iām going nuts about why in the world is the animation not playing!
Edit 3: LOOOOOOOOOOOOOOOOL I had ZERO Hit force applied to my first attack with the 1H-Sword, NO WONDER IT WASNāT WORKING!