private void DrawAoStates(State SourceState, StateBox SourceBox, int OffsetX, int OffsetY) { int endX = 0; int endY = 0; int offsetYModifer = 0; StateBox tempBox = new StateBox(SourceBox.startX + (OffsetX + 8), SourceBox.startY + (OffsetY + 8)); for (int i = 0; i < SourceState.subStates.Count; i++) { DrawAoStates(SourceState.subStates[i], tempBox, 0, offsetYModifer); offsetYModifer = tempBox.childStateBoxes[i].endY; } tempBox.stateName = SourceState.stateName; /* Convoluted math to figure out where the end coordinates are! */ endX = tempBox.startX + 16; endX += (tempBox.childStateBoxes.Count > 0) ? 16 : 0; endY = (tempBox.startY + ((SourceState.transitions.Count % 4) * 16)); endY += tempBox.childStateBoxes.Count * 16; tempBox.endX = endX; tempBox.endY = endY; SourceBox.childStateBoxes.Add(tempBox); }
public Mapper(ActiveObject SourceAO) { StateBox hsmTop = new StateBox(); hsmTop.startX = -8; hsmTop.startY = -8; aoToMap = SourceAO; stateDiagrams = new List <StateBox>(); DrawAoStates(aoToMap.states[0], hsmTop, 0, 0); }