public void OnRotationVisualized(Rotator rotator, Vector3 rotation) { // Check if rotation within range. for (int i = 0; i < TargetRotations.Count; i++) { RotationTarget rt = TargetRotations[i]; if (rt.targetX && !(rotation.x >= rt.xMin && rotation.x <= rt.xMax)) { continue; } if (rt.targetY && !(rotation.y >= rt.yMin && rotation.y <= rt.yMax)) { continue; } if (rt.targetZ && !(rotation.z >= rt.zMin && rotation.z <= rt.zMax)) { continue; } // Record target hits. if (targetRotationHits.ContainsKey(i)) { targetRotationHits[i] += 1; } else { targetRotationHits.Add(i, 1); } rotator.FreezeFrame(); OnTargetHit.Invoke(this, i, rotation); } }