@@ -116,24 +116,26 @@ void OnScenarioChanged(int optionIndex)
116
116
m_PresetsDropdown . interactable = true ;
117
117
break ;
118
118
case k_ConnectionCyclesScenarioName :
119
- scenario = new ConnectionsCycle ( ) ;
120
- ( ( ConnectionsCycle ) scenario ) . Configurations . Clear ( ) ;
119
+ var connectionsCyleScenario = new ConnectionsCycle ( ) ;
120
+ connectionsCyleScenario . Configurations . Clear ( ) ;
121
121
foreach ( var configuration in m_ConnectionsCycleConfigurations )
122
122
{
123
- ( ( ConnectionsCycle ) scenario ) . Configurations . Add ( configuration ) ;
123
+ connectionsCyleScenario . Configurations . Add ( configuration ) ;
124
124
}
125
125
m_PresetsDropdown . captionText . color = m_PresetsDropdown . colors . disabledColor ;
126
126
m_PresetsDropdown . interactable = false ;
127
+ scenario = connectionsCyleScenario ;
127
128
break ;
128
129
case k_RandomConnectionSwapScenarioName :
129
- scenario = new RandomConnectionsSwap ( ) ;
130
- ( ( RandomConnectionsSwap ) scenario ) . Configurations . Clear ( ) ;
130
+ var randomConnectionsSwapScenario = new RandomConnectionsSwap ( ) ;
131
+ randomConnectionsSwapScenario . Configurations . Clear ( ) ;
131
132
foreach ( var configuration in m_RandomConnectionsSwapConfigurations )
132
133
{
133
- ( ( RandomConnectionsSwap ) scenario ) . Configurations . Add ( configuration ) ;
134
+ randomConnectionsSwapScenario . Configurations . Add ( configuration ) ;
134
135
}
135
136
m_PresetsDropdown . captionText . color = m_PresetsDropdown . colors . disabledColor ;
136
137
m_PresetsDropdown . interactable = false ;
138
+ scenario = randomConnectionsSwapScenario ;
137
139
break ;
138
140
default :
139
141
Debug . LogError ( "Invalid Scenario selected." ) ;
0 commit comments