/****** * ANGLES *****/ //gets the proper direction based on the given angle and returns the direction group DirectionGroup frameGroupFromAngle(float angle) { FaceDirection.Direction direction; if (angle < 0) { direction = FaceDirection.Direction.None; } else { direction = FaceDirection.GetDirectionFromAngle(angle, use8wayDir); } DirectionGroup groupToPlay = null; foreach (DirectionGroup frameGroup in frameGroups) { if (frameGroup.direction == direction) { groupToPlay = frameGroup; break; } } return(groupToPlay); }
//feed this an angle and the current animation group (or direction) will switch to the appropriate group. void SetCurrentGroupFromAngle(float angle) { DirectionGroup newGroup = frameGroupFromAngle(angle); if (newGroup == null) { newGroup = frameGroupFromAngle(-1); } if (currentGroup != newGroup) { if (currentGroup != null) { interruptCurrentFrame = true; } onePassIndex = 0; currentGroup = newGroup; } }