public Layer AddLayer(string iD, InListLocation LocationToAdd) { Layer layer = CheckExistanceAndCreateLayer(iD); if (LocationToAdd == InListLocation.First) { layers.Insert(0, layer); } else if (LocationToAdd == InListLocation.Last) { layers.Add(layer); } return(layer); }
public Transition GetTransition(string iD, InListLocation transitionSelection = InListLocation.First) { List <Transition> gotTransitions = new List <Transition>(); foreach (Layer layer in layers) { if (HasTransition(iD, layer)) { gotTransitions.Add(GetTransition(iD, layer)); } } if (gotTransitions.Count == 0) { return(null); } return(gotTransitions[GetListLocationIndex(transitionSelection, gotTransitions)]); }
public State GetState(string iD, InListLocation stateSelection = InListLocation.First) { List <State> gotStates = new List <State>(); foreach (Layer layer in layers) { State found = GetState(iD, layer); if (found != null) { gotStates.Add(found); } } if (gotStates.Count == 0) { return(null); } return(gotStates[GetListLocationIndex(stateSelection, gotStates)]); }
public void RemoveLayer(InListLocation layerTargetLocation) { RemoveLayer(GetLayerListLocationIndex(layerTargetLocation)); }
private int GetListLocationIndex <T>(InListLocation location, List <T> list) { return(location == InListLocation.First ? 0 : Math.Max(list.Count - 1, 0)); }
private int GetLayerListLocationIndex(InListLocation location) { return(GetListLocationIndex(location, layers)); }
public void MoveLayer(InListLocation layerSourceLocation, InListLocation layerTargetLocation) { MoveLayer(GetLayerListLocationIndex(layerSourceLocation), layerTargetLocation); }
public bool HasTransition(string iD, InListLocation layerLocation = InListLocation.First) { return(HasTransition(iD, GetLayer(GetLayerListLocationIndex(layerLocation)))); }
public void RemoveSubStateMachine(SubStateMachineSelection selectionWay, string text, InListLocation stateSelection = InListLocation.First) { RemoveSubStateMachine(GetSubStateMachine(selectionWay, text, stateSelection)); }
public void MoveLayer(string iD, InListLocation layerTargetLocation) { MoveLayer(GetLayer(iD), layerTargetLocation); }
public void MoveLayer(Layer layerToMove, InListLocation layerTargetLocation) { MoveLayer(layerToMove, GetLayerListLocationIndex(layerTargetLocation)); }
public bool HasState(string iD, InListLocation layerLocation = InListLocation.First) { return(HasState(iD, GetLayerListLocationIndex(layerLocation))); }
public void RemoveState(string iD, InListLocation stateSelection = InListLocation.First) { RemoveState(GetStates(state => state.stateInfo.iD == iD)[GetLayerListLocationIndex(stateSelection)]); }
public Transition AddTransition(string iD, string sourceStateID, State targetState, InListLocation layerLocation = InListLocation.First, params Condition[] conditions) { return(AddTransition(iD, GetState(sourceStateID, layerLocation), targetState, GetLayer(layerLocation), conditions)); }
public void RemoveTransition(string iD, InListLocation transitionSelection = InListLocation.First) { List <Transition> transitions = new List <Transition>(GetTransitions(transition => transition.iD == iD)); RemoveTransition(transitions[GetListLocationIndex(transitionSelection, transitions)]); }
public Layer GetLayer(InListLocation layerLocation) { return(GetLayer(GetLayerListLocationIndex(layerLocation))); }
public bool HasSubStateMachine(SubStateMachineSelection selectionWay, string text, InListLocation layerLocation = InListLocation.First) { return(HasSubStateMachine(selectionWay, text, GetLayer(layerLocation))); }
public void MoveLayer(int sourceIndex, InListLocation layerTargetLocation) { MoveLayer(GetLayer(sourceIndex), layerTargetLocation); }
public SubStateMachine GetSubStateMachine(SubStateMachineSelection selectionWay, string text, InListLocation stateSelection = InListLocation.First) { List <Layer> foundLayers = new List <Layer>(GetLayers(layer => layer.HasSubStateMachine(selectionWay, text))); return(GetSubStateMachine(selectionWay, text, GetLayer(GetListLocationIndex(stateSelection, foundLayers)))); }
public void MoveLayer(InListLocation layerSourceLocation, int targetIndex) { MoveLayer(GetLayerListLocationIndex(layerSourceLocation), targetIndex); }