public void setColliders(animationsRonin animation) { if (animation == animationsRonin.clear) { clearColliders(); } else { checkHitCondition(animation); if (prevAnimation != animation) { frameCounter = 0; prevAnimation = animation; } if (frameCounter < colliders [(int)animation].Length) { boxes = colliders [(int)animation] [frameCounter]; } else { Debug.Log("mismatched hitbox: " + animation); } if (boxes != null) { enableColliders(boxes, true); } if (prevBoxes != null) { enableColliders(prevBoxes, false); } prevBoxes = boxes; frameCounter++; } }
public void clearColliders() { if (prevBoxes != null) { enableColliders(prevBoxes, false); } frameCounter = 0; prevAnimation = animationsRonin.clear; boxes = null; }
void checkHitCondition(animationsRonin animation) { if (animation == animationsRonin.light02LeftHit || animation == animationsRonin.light02LeftMiss || animation == animationsRonin.light02LeftStart || animation == animationsRonin.light02RightHit || animation == animationsRonin.light02RightMiss || animation == animationsRonin.light02RightStart) { timeMaintaining = 0f; } else { timeMaintaining = 0.1f; } }