public void AttackPerFrame(Vector2 inputVector, Vector2 movement, IsometricCharacterRenderer isoRenderer) { if (currentAttackState == IsometricCharacterRenderer.States.none) { isoRenderer.SetDirection(movement); } if (currentAttackState > animatedAttackState) { animatedAttackState += 1; isoRenderer.AttackDirection(inputVector, animatedAttackState); attackCounter = 0; playerAttackHitbox.HitboxDealDamage((int)animatedAttackState - 1); } else if (currentAttackState > 0) { if (attackCounter > attackFrames[(int)currentAttackState - 1]) { currentAttackState = IsometricCharacterRenderer.States.none; animatedAttackState = IsometricCharacterRenderer.States.none; attackCounter = 0; } else { attackCounter++; } } }
public void AttackPerFrame2(Vector2 inputVector, Vector2 movement, IsometricCharacterRenderer isoRenderer) { int curL = currentAttackString.Length; int aniL = animatedAttackString.Length; int id; if (animatedAttackString == "") { isoRenderer.SetDirection(movement); } if (curL > aniL) { animatedAttackString = currentAttackString.Substring(0, aniL + 1); id = attackHash.getKeyIndex(animatedAttackString); if (id != -1) { isoRenderer.AttackDirection(inputVector, stateHash[id]); PlaySound(animatedAttackString.Length); DoSpecial(inputVector, isoRenderer, animatedAttackString); } else { resetAttackString(); } attackCounter = 0; if (id != -1) { playerAttackHitbox.HitboxDealDamage(id); } } if (curL > 0) { id = attackHash.getKeyIndex(animatedAttackString); if (id != -1) { if (attackCounter > attackFrames[id]) { resetAttackString(); } else { attackCounter++; } } else { resetAttackString(); } } }