Change StateManager interface

This commit is contained in:
Chikashi Miyama 2019-11-01 12:06:54 +01:00
parent e4d1a9c81f
commit a69f121053
4 changed files with 59 additions and 24 deletions

View file

@ -212,6 +212,54 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &337815214
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 337815216}
- component: {fileID: 337815215}
m_Layer: 0
m_Name: StateManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &337815215
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 337815214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e6be1ae37d9581545a6d213046b19b8c, type: 3}
m_Name:
m_EditorClassIdentifier:
csvFileName: qlist
onStateChanged:
m_PersistentCalls:
m_Calls: []
sceneSelection: 0
--- !u!4 &337815216
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 337815214}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &517164549 --- !u!1 &517164549
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1044,7 +1092,6 @@ GameObject:
- component: {fileID: 1843145351} - component: {fileID: 1843145351}
- component: {fileID: 1843145350} - component: {fileID: 1843145350}
- component: {fileID: 1843145349} - component: {fileID: 1843145349}
- component: {fileID: 1843145348}
- component: {fileID: 1843145352} - component: {fileID: 1843145352}
- component: {fileID: 1843145347} - component: {fileID: 1843145347}
m_Layer: 0 m_Layer: 0
@ -1073,19 +1120,6 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!65 &1843145348
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1843145346}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1843145349 --- !u!23 &1843145349
MeshRenderer: MeshRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -11,5 +11,7 @@ namespace cylvester
{ {
anim.SetTrigger(AnimTrigger); anim.SetTrigger(AnimTrigger);
} }
} }
} }

View file

@ -86,7 +86,6 @@ namespace cylvester
samplePlaybackObserver_.ValueChanged -= onSamplePlaybackChanged_; samplePlaybackObserver_.ValueChanged -= onSamplePlaybackChanged_;
midiParser_.MidiMessageReceived -= onMidiMessageReceived_; midiParser_.MidiMessageReceived -= onMidiMessageReceived_;
midiParser_.MidiSyncReceived -= onMidiSyncReceived_; midiParser_.MidiSyncReceived -= onMidiSyncReceived_;
} }
public void Update() public void Update()
@ -100,9 +99,9 @@ namespace cylvester
public void SendState(IStateManager stateManager) public void SendState(IStateManager stateManager)
{ {
pdSender_.Send("state previous " + stateManager.PreviousState); pdSender_.Send("state previous " + (stateManager.PreviousState.HasValue ? stateManager.PreviousState.Value.Title : "---"));
pdSender_.Send("state current " + stateManager.CurrentState); pdSender_.Send("state current " + stateManager.CurrentState.Title);
pdSender_.Send("state next " + stateManager.NextState); pdSender_.Send("state next " + (stateManager.NextState.HasValue ? stateManager.NextState.Value.Title : "---"));
} }
} }

View file

@ -13,9 +13,9 @@ namespace cylvester
int SelectedState { set; } int SelectedState { set; }
State[] States { get; } State[] States { get; }
string CurrentState { get; } State CurrentState { get; }
string PreviousState { get; } State? PreviousState { get; }
string NextState { get; } State? NextState { get; }
void OnMidiReceived(MidiMessage message); void OnMidiReceived(MidiMessage message);
} }
@ -70,11 +70,11 @@ namespace cylvester
public State[] States { get; private set; } public State[] States { get; private set; }
public string CurrentState => States[sceneSelection].Title; public State CurrentState => States[sceneSelection];
public string PreviousState => sceneSelection == 0 ? "---" : States[sceneSelection-1].Title; public State? PreviousState => sceneSelection == 0 ? (State?) null : States[sceneSelection-1];
public string NextState => sceneSelection == States.Length - 1 ? "---" : States[sceneSelection + 1].Title; public State? NextState => sceneSelection == States.Length - 1 ? (State?) null : States[sceneSelection + 1];
public int SelectedState public int SelectedState
{ {