> For the complete documentation index, see [llms.txt](https://swonh.gitbook.io/sdmp-user-manual-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swonh.gitbook.io/sdmp-user-manual-eng/general-module/user-controls/statetransitioncontrol.md).

# StateTransitionControl

Control for functions related to state transition

### GetStateTransitions

```csharp
public override List<StateTransition> GetStateTransitions(StateActionMap stateActionMap)
```

#### Definition

Returns the state transitions that will be transitioned to the next stage based on the defined `StateActionMap`.

#### Parameters

<table><thead><tr><th width="217">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>StateActionMap</code></td><td>The state to define the transitions.</td></tr></tbody></table>

#### Return

<table><thead><tr><th width="249">Type</th><th width="309">Description</th><th>Default</th></tr></thead><tbody><tr><td>List&#x3C;<code>StateTransition</code>></td><td>The state transition list.</td><td><a href="#statetransion">Default Logic</a></td></tr></tbody></table>

#### Example (Default Logic) <a href="#statetransion" id="statetransion"></a>

```csharp
public List<StateTransition> GetStateTransitions(StateActionMap stateActionMap) 
{
    List<StateTransition> trans = new List<StateTransition>();

    StateTransition tran = new StateTransition();

    tran.FromState = stateActionMap.PostActionState;
    tran.ToState = stateActionMap.PostActionState.Clone();
    tran.Cost = stateActionMap.Cost;

    trans.Add(tran);

    return trans;
}
```

### GetFinalStateTransition

```csharp
public override StateTransition GetFinalStateTransition(State state)
```

#### Definition

Defines a `StateTransition` from a given State to a final state.

#### Parameters

<table><thead><tr><th width="301">Type</th><th>Description</th></tr></thead><tbody><tr><td>State</td><td>The state to transition to the final state.</td></tr></tbody></table>

#### Return

<table><thead><tr><th width="205.33333333333331">Type</th><th width="323">Description</th><th>Default</th></tr></thead><tbody><tr><td><code>StateTransition</code></td><td>State transition to the final state.</td><td><a href="#default-logic">Default Logic</a></td></tr></tbody></table>

#### Example (Default Logic)

```csharp
public virtual StateTransition GetFinalStateTransition(State state)
{
    DataModel.StateTransition tran = new DataModel.StateTransition();

    State finalState = new State();
    finalState.IsFinal = true;

    tran.FromState = state;
    tran.ToState = finalState;

    return tran;
}
```
