浏览代码

redoing state machine pattern. It now uses prefabs to model states.

/main
David Woodruff 4 年前
当前提交
966b103d
共有 53 个文件被更改,包括 1269 次插入471 次删除
  1. 61
      Assets/Scenes/MainMenu.unity
  2. 58
      Assets/Scenes/SampleScene.unity
  3. 4
      Assets/Scripts/Client/Net/ClientGNHLogic.cs
  4. 3
      Assets/Scripts/Client/UI/MainMenuUI.cs
  5. 7
      Assets/Scripts/Server/Net/ServerGNHLogic.cs
  6. 8
      Assets/Scripts/Shared/Net/GameNetHub.cs
  7. 3
      ProjectSettings/EditorBuildSettings.asset
  8. 2
      Assets/Scripts/Client/Game/State/ClientBossRoomState.cs.meta
  9. 2
      Assets/Scripts/Client/Game/State/ClientCharSelectState.cs.meta
  10. 2
      Assets/Scripts/Client/Game/State/ClientMainMenuState.cs.meta
  11. 2
      Assets/Scripts/Server/Game/State/ServerBossRoomState.cs.meta
  12. 2
      Assets/Scripts/Server/Game/State/ServerCharSelectState.cs.meta
  13. 2
      Assets/Scripts/Shared/Game/State/CharSelectData.cs.meta
  14. 2
      Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs.meta
  15. 8
      Assets/Prefabs/State.meta
  16. 634
      Assets/Scenes/CharSelect.unity
  17. 7
      Assets/Scenes/CharSelect.unity.meta
  18. 8
      Assets/Scripts/Client/Game/State.meta
  19. 8
      Assets/Scripts/Server/Game/State.meta
  20. 8
      Assets/Scripts/Shared/Game/State.meta
  21. 76
      Assets/Prefabs/State/BossRoomState.prefab
  22. 7
      Assets/Prefabs/State/BossRoomState.prefab.meta
  23. 89
      Assets/Prefabs/State/CharSelectState.prefab
  24. 7
      Assets/Prefabs/State/CharSelectState.prefab.meta
  25. 30
      Assets/Scripts/Client/Game/State/ClientBossRoomState.cs
  26. 28
      Assets/Scripts/Client/Game/State/ClientCharSelectState.cs
  27. 29
      Assets/Scripts/Client/Game/State/ClientMainMenuState.cs
  28. 28
      Assets/Scripts/Server/Game/State/ServerBossRoomState.cs
  29. 38
      Assets/Scripts/Server/Game/State/ServerCharSelectState.cs
  30. 38
      Assets/Scripts/Shared/Game/State/CharSelectData.cs
  31. 101
      Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs
  32. 31
      Assets/Scripts/Client/Game/ClientCharSelectBRState.cs
  33. 28
      Assets/Scripts/Client/Game/ClientGameBRState.cs
  34. 37
      Assets/Scripts/Client/Game/ClientMainMenuBRState.cs
  35. 31
      Assets/Scripts/Server/Game/ServerCharSelectBRState.cs
  36. 33
      Assets/Scripts/Server/Game/ServerGameBRState.cs
  37. 152
      Assets/Scripts/Shared/Game/BossRoomStateManager.cs
  38. 35
      Assets/Scripts/Shared/Game/CharSelectBRState.cs
  39. 11
      Assets/Scripts/Shared/Game/GameBRState.cs.meta
  40. 33
      Assets/Scripts/Shared/Game/IBossRoomState.cs
  41. 11
      Assets/Scripts/Shared/Game/IBossRoomState.cs.meta
  42. 36
      Assets/Scripts/Shared/Game/GameBRState.cs
  43. 0
      /Assets/Scripts/Client/Game/State/ClientBossRoomState.cs.meta
  44. 0
      /Assets/Scripts/Client/Game/State/ClientCharSelectState.cs.meta
  45. 0
      /Assets/Scripts/Client/Game/State/ClientMainMenuState.cs.meta
  46. 0
      /Assets/Scripts/Server/Game/State/ServerBossRoomState.cs.meta
  47. 0
      /Assets/Scripts/Server/Game/State/ServerCharSelectState.cs.meta
  48. 0
      /Assets/Scripts/Shared/Game/State/CharSelectData.cs.meta
  49. 0
      /Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs.meta

61
Assets/Scenes/MainMenu.unity


serializedVersion: 6
m_Component:
- component: {fileID: 308991160}
- component: {fileID: 308991159}
- component: {fileID: 308991158}
m_Layer: 0
m_Name: GameHub

m_Name:
m_EditorClassIdentifier:
NetworkingManagerGO: {fileID: 1359040525}
--- !u!114 &308991159
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 308991157}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 39332c63269f3f34db37df122adcc57b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &308991160
Transform:
m_ObjectHideFlags: 0

NetworkTransport: {fileID: 1359040529}
RegisteredScenes:
- MainMenu
- CharSelect
- Prefab: {fileID: 3565665953789623672, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
PlayerPrefab: 0
- Prefab: {fileID: 297185343939699586, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
PlayerPrefab: 0
PlayerPrefabHash:
id: 0
CreatePlayerPrefab: 0

m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1767010205
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1767010207}
- component: {fileID: 1767010206}
m_Layer: 0
m_Name: MainMenuState
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1767010206
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767010205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab10fd7c6aa7d36438f5ac1c0ebfadbb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1767010207
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767010205}
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: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1985907275
GameObject:

58
Assets/Scenes/SampleScene.unity


ReceiveTickrate: 0
MaxReceiveEventsPerTickRate: 1000
EventTickrate: 0
MaxObjectUpdatesPerTick: -1
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionData:

m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1522473406
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 297185343939699586, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_Name
value: BossRoomState
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5655447013084909147, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8b9c63e7d70c5ff48a03aad51e17103c, type: 3}
--- !u!1 &1601651753
GameObject:
m_ObjectHideFlags: 0

4
Assets/Scripts/Client/Net/ClientGNHLogic.cs


m_hub = hub;
}
public void RecvConnectFinished( ConnectStatus status, BossRoomState targetState )
public void RecvConnectFinished( ConnectStatus status )
m_hub.GetComponent<BossRoomStateManager>().ChangeState(targetState, null);
//m_hub.GetComponent<BossRoomStateManager>().ChangeState(targetState, null);
}

3
Assets/Scripts/Client/UI/MainMenuUI.cs


public void OnHostClicked()
{
Debug.Log("Host Clicked");
GetIPAddress();
m_netHub.StartHost(GetIPAddress(), 9998);

{
Debug.Log("Connect Clicked");
m_netHub.StartClient(GetIPAddress(), 9998);
}
}

7
Assets/Scripts/Server/Net/ServerGNHLogic.cs


{
m_Hub = hub;
m_Hub.NetManager.ConnectionApprovalCallback += this.ApprovalCheck;
//The "BossRoom" server always advances to CharSelect immediately on start. Different games
//may do this differently.
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("CharSelect");
}
/// <summary>

}
//TODO: GOMPS-78. We'll need to save our client guid so that we can handle reconnect.
Debug.Log("host ApprovalCheck: client payload was: " + payload);
Debug.Log("host ApprovalCheck: client guid was: " + payload_config["client_guid"]);

//FIXME_DMW: it is weird to do this after the callback, but the custom message won't be delivered if we call it beforehand.
//This creates an "honor system" scenario where it is up to the client to politely leave on failure. Probably
//we should add a NetManager.DisconnectClient call directly below this line, when we are rejecting the connection.
m_Hub.S2C_ConnectResult(clientId, ConnectStatus.SUCCESS, BossRoomState.CHARSELECT);
m_Hub.S2C_ConnectResult(clientId, ConnectStatus.SUCCESS );
}
}

8
Assets/Scripts/Shared/Net/GameNetHub.cs


using (PooledBitReader reader = PooledBitReader.Get(stream))
{
ConnectStatus status = (ConnectStatus)reader.ReadInt32();
BossRoomState state = (BossRoomState)reader.ReadInt32();
m_ClientLogic.RecvConnectFinished(status, state);
m_ClientLogic.RecvConnectFinished(status );
}
});
}

{
//special host code. This is what kicks off the flow that happens on a regular client
//when it has finished connecting successfully. A dedicated server would remove this.
m_ClientLogic.RecvConnectFinished(ConnectStatus.SUCCESS, BossRoomState.CHARSELECT);
m_ClientLogic.RecvConnectFinished(ConnectStatus.SUCCESS );
}
}

//Server->Client RPCs
public void S2C_ConnectResult( ulong netId, ConnectStatus status, BossRoomState targetState )
public void S2C_ConnectResult( ulong netId, ConnectStatus status )
{
using (PooledBitStream stream = PooledBitStream.Get())
{

writer.WriteInt32((int)targetState);
MLAPI.Messaging.CustomMessagingManager.SendNamedMessage("S2C_ConnectResult", netId, stream, "MLAPI_INTERNAL");
}
}

3
ProjectSettings/EditorBuildSettings.asset


path: Assets/Scenes/MainMenu.unity
guid: 4b62455423c0e284f96f7fd6ac947bf9
- enabled: 1
path: Assets/Scenes/CharSelect.unity
guid: 69ca9af1235ffe340a45770dd5771f03
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {}

2
Assets/Scripts/Client/Game/State/ClientBossRoomState.cs.meta


fileFormatVersion: 2
guid: 5c5d294b879617e448dbe34b7f09616d
guid: 5e631ac38df479741af592cf6a1fb553
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Client/Game/State/ClientCharSelectState.cs.meta


fileFormatVersion: 2
guid: fb79a8334ba58754c98a2ee9fc2a5dee
guid: eca1f4b442326cc4d9be3975746b8cdb
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Client/Game/State/ClientMainMenuState.cs.meta


fileFormatVersion: 2
guid: 5a65bc8be73a02c42a41f5efef95fbae
guid: ab10fd7c6aa7d36438f5ac1c0ebfadbb
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Server/Game/State/ServerBossRoomState.cs.meta


fileFormatVersion: 2
guid: 425e77ec23730374bbbe2ee01d6e1e7c
guid: 927521835ae055247b17e4abe805b4ab
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Server/Game/State/ServerCharSelectState.cs.meta


fileFormatVersion: 2
guid: 48a8e5e3f2de1a74889818336559cf4a
guid: b4ae93287066a264d92939aa957cf227
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Shared/Game/State/CharSelectData.cs.meta


fileFormatVersion: 2
guid: 39332c63269f3f34db37df122adcc57b
guid: 3b117c7cd3ae70e458a5b755a4096609
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs.meta


fileFormatVersion: 2
guid: fe598b22e9599b540a40723c8d48686a
guid: 38f98770f9b44994caafd506520f0bdd
MonoImporter:
externalObjects: {}
serializedVersion: 2

8
Assets/Prefabs/State.meta


fileFormatVersion: 2
guid: 4f221429a11d0a14298624cbb5dbbc7f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

634
Assets/Scenes/CharSelect.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &517391266
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 517391268}
- component: {fileID: 517391267}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &517391267
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517391266}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &517391268
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517391266}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1231490491
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1231490494}
- component: {fileID: 1231490493}
- component: {fileID: 1231490492}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1231490492
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1231490491}
m_Enabled: 1
--- !u!20 &1231490493
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1231490491}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1231490494
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1231490491}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1299736798
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1299736799}
- component: {fileID: 1299736802}
- component: {fileID: 1299736801}
- component: {fileID: 1299736800}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1299736799
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299736798}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1592710793}
m_Father: {fileID: 1930582174}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1299736800
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299736798}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1299736801
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299736798}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1299736802
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299736798}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1592710792
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1592710793}
- component: {fileID: 1592710795}
- component: {fileID: 1592710794}
m_Layer: 5
m_Name: Caption
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1592710793
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1592710792}
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: 1299736799}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 400, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1592710794
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1592710792}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: CHAR SELECT
--- !u!222 &1592710795
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1592710792}
m_CullTransparentMesh: 1
--- !u!1 &1930582173
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1930582174}
m_Layer: 0
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1930582174
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1930582173}
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:
- {fileID: 1299736799}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1953834081
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1953834084}
- component: {fileID: 1953834083}
- component: {fileID: 1953834082}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1953834082
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1953834081}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1953834083
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1953834081}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1953834084
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1953834081}
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: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &3565665954918756928
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3565665953789623672, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_Name
value: CharSelectState
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3565665953789623676, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1a58a2c4657fe6d4890d9ad39f43894e, type: 3}

7
Assets/Scenes/CharSelect.unity.meta


fileFormatVersion: 2
guid: 69ca9af1235ffe340a45770dd5771f03
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/Game/State.meta


fileFormatVersion: 2
guid: a3bfc511bca025c44bca24d5919b2d47
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server/Game/State.meta


fileFormatVersion: 2
guid: c0297332f43e287449e9ecbad6c2345c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Shared/Game/State.meta


fileFormatVersion: 2
guid: 38db2dda77dde83468d68ef9ef1ba831
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

76
Assets/Prefabs/State/BossRoomState.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &297185343939699586
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5655447013084909147}
- component: {fileID: -1764033382396218637}
- component: {fileID: 3608714310874968837}
- component: {fileID: 5762482089640033414}
m_Layer: 0
m_Name: BossRoomState
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5655447013084909147
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297185343939699586}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-1764033382396218637
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297185343939699586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5e631ac38df479741af592cf6a1fb553, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3608714310874968837
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297185343939699586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkedInstanceId: 0
PrefabHash: 3948170283650285722
PrefabHashGenerator: BossRoomState
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
--- !u!114 &5762482089640033414
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 297185343939699586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 927521835ae055247b17e4abe805b4ab, type: 3}
m_Name:
m_EditorClassIdentifier:

7
Assets/Prefabs/State/BossRoomState.prefab.meta


fileFormatVersion: 2
guid: 8b9c63e7d70c5ff48a03aad51e17103c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

89
Assets/Prefabs/State/CharSelectState.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3565665953789623672
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3565665953789623676}
- component: {fileID: 3565665953789623675}
- component: {fileID: 3565665953789623674}
- component: {fileID: 3565665953789623673}
- component: {fileID: 1092063945021251778}
m_Layer: 0
m_Name: CharSelectState
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3565665953789623676
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565665953789623672}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3565665953789623675
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565665953789623672}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b4ae93287066a264d92939aa957cf227, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3565665953789623674
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565665953789623672}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eca1f4b442326cc4d9be3975746b8cdb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3565665953789623673
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565665953789623672}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3b117c7cd3ae70e458a5b755a4096609, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1092063945021251778
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3565665953789623672}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkedInstanceId: 0
PrefabHash: 9664049137678660408
PrefabHashGenerator: CharSelectState
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0

7
Assets/Prefabs/State/CharSelectState.prefab.meta


fileFormatVersion: 2
guid: 1a58a2c4657fe6d4890d9ad39f43894e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

30
Assets/Scripts/Client/Game/State/ClientBossRoomState.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// Client specialization of core BossRoom game logic.
/// </summary>
public class ClientBossRoomState : GameStateBehaviour
{
public override GameState ActiveState { get { return GameState.BOSSROOM; } }
public override void NetworkStart()
{
base.NetworkStart();
if( !IsClient ) { this.enabled = false; }
}
// Update is called once per frame
void Update()
{
}
}
}

28
Assets/Scripts/Client/Game/State/ClientCharSelectState.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// Client specialization of the Characterc Select game state.
/// </summary>
public class ClientCharSelectState : GameStateBehaviour
{
public override GameState ActiveState { get { return GameState.CHARSELECT; } }
public override void NetworkStart()
{
base.NetworkStart();
if (!IsClient) { this.enabled = false; }
}
// Update is called once per frame
void Update()
{
}
}
}

29
Assets/Scripts/Client/Game/State/ClientMainMenuState.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// Game Logic that runs when sitting at the MainMenu. This is likely to be "nothing", as no game has been started. But it is
/// nonetheless important to have a game state, as the GameStateBehaviour system requires that all scenes have states.
/// </summary>
public class ClientMainMenuState : GameStateBehaviour
{
public override GameState ActiveState { get { return GameState.MAINMENU; } }
public override void NetworkStart()
{
//note: this code won't ever run, because there is no network connection at the main menu screen.
//fortunately we know you are a client, because all players are clients when sitting at the main menu screen.
}
// Update is called once per frame
void Update()
{
}
}
}

28
Assets/Scripts/Server/Game/State/ServerBossRoomState.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomServer
{
/// <summary>
/// Server specialization of core BossRoom game logic.
/// </summary>
public class ServerBossRoomState : GameStateBehaviour
{
public override GameState ActiveState { get { return GameState.BOSSROOM; } }
public override void NetworkStart()
{
base.NetworkStart();
if (!IsServer) { this.enabled = false; }
}
// Update is called once per frame
void Update()
{
}
}
}

38
Assets/Scripts/Server/Game/State/ServerCharSelectState.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomServer
{
public class ServerCharSelectState : GameStateBehaviour
{
public override GameState ActiveState { get { return GameState.CHARSELECT; } }
//TODO: GOMPS-83. Remove this temp variable and replace with core CharSelect logic.
private float m_start_s; //TEMP. manages transition.
public override void NetworkStart()
{
base.NetworkStart();
if (!IsServer) { this.enabled = false; }
m_start_s = Time.time;
}
// Update is called once per frame
void Update()
{
if( (Time.time - m_start_s) > 3 )
{
//temp: we don't have any logic or anything in CharSelect, so for now we just skip on to the next scene.
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("SampleScene");
}
}
}
}

38
Assets/Scripts/Shared/Game/State/CharSelectData.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MLAPI;
namespace BossRoom
{
/// <summary>
/// Common data and RPCs for the CharSelect stage.
/// </summary>
public class CharSelectData : NetworkedBehaviour
{
//TODO: GOMPS-83. implement the true synced array for CharacterSlots. There should be 8, and some can be null.
//They can probably just be strings for now.
private MLAPI.NetworkedVar.Collections.NetworkedList<string> CharSlots;
// Start is called before the first frame update
void Start()
{
}
public override void NetworkStart()
{
base.NetworkStart();
CharSlots = new MLAPI.NetworkedVar.Collections.NetworkedList<string>();
}
// Update is called once per frame
void Update()
{
}
}
}

101
Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MLAPI;
namespace BossRoom
{
public enum GameState
{
MAINMENU,
CHARSELECT,
BOSSROOM,
}
/// <summary>
/// A special kind of NetworkedBehaviour that represents a discrete game state. The special feature it offers is
/// that it provides some guarantees that only one such GameState will be running at a time.
/// </summary>
/// <remarks>
/// Q: what is the relationship between a GameState and a Scene?
/// A: There is a 1-to-many relationship between states and scenes. That is, every scene corresponds to exactly one state,
/// but a single state can exist in multiple scenes.
/// Q: How do state transitions happen?
/// A: They are driven implicitly by calling MLAPI.SceneManagement.NetworkSceneManager.SwitchScene in server code. This is
/// important, because if state transitions were driven separately from scene transitions, then states that cared what
/// scene they ran in would need to carefully synchronize their logic to scene loads.
/// Q: How many GameStateBehaviours are there?
/// A: Exactly one on the server and one on the client (on the host a server and client GameStateBehaviour will run concurrently, as
/// with other networked prefabs).
/// Q: If these are MonoBehaviours, how do you have a single state that persists across multiple scenes?
/// A: Set your Persists property to true. If you transition to another scene that has the same gamestate, the
/// current GameState object will live on, and the version in the new scene will suicide to make room for it.
///
/// Important Note: We assume that every Scene has a GameState object. If not, then it's possible that a Persisting game state
/// will outlast its lifetime (as there is no successor state to clean it up).
/// </remarks>
public abstract class GameStateBehaviour : NetworkedBehaviour
{
/// <summary>
/// Does this GameState persist across multiple scenes?
/// </summary>
public virtual bool Persists { get { return false; } }
/// <summary>
/// What GameState this represents. Server and client specializations of a state should always return the same enum.
/// </summary>
public abstract GameState ActiveState {get; }
/// <summary>
/// This is the single active GameState object. There can be only one.
/// </summary>
private static GameObject s_activeStateGO;
// Start is called before the first frame update
void Start()
{
if( s_activeStateGO != null )
{
if( s_activeStateGO == this.gameObject )
{
//nothing to do here, if we're already the active state object.
return;
}
//on the host, this might return either the client or server version, but it doesn't matter which;
//we are only curious about its type, and its persist state.
var prev_state = s_activeStateGO.GetComponent<GameStateBehaviour>();
if( prev_state.Persists && prev_state.ActiveState == this.ActiveState )
{
//we need to make way for the DontDestroyOnLoad state that already exists.
Object.Destroy(this.gameObject);
return;
}
//otherwise, the old state is going away. Either it wasn't a Persisting state, or it was,
//but we're a different kind of state. In either case, we're going to be replacing it.
Object.Destroy(s_activeStateGO);
}
s_activeStateGO = this.gameObject;
if( Persists ) { Object.DontDestroyOnLoad(this.gameObject); }
}
// Update is called once per frame
void Update()
{
}
private void OnDestroy()
{
if( !Persists )
{
s_activeStateGO = null;
}
}
}
}

31
Assets/Scripts/Client/Game/ClientCharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientCharSelectBRState : CharSelectBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the character select BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

28
Assets/Scripts/Client/Game/ClientGameBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientGameBRState : GameBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the Game BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

37
Assets/Scripts/Client/Game/ClientMainMenuBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// The BossRoom state logic that runs during MainMenu. Unlike most states, there is only a client variant of this (you are always
/// a client when sitting at the Main Menu screen).
/// </summary>
class ClientMainMenuBRState : IBossRoomState
{
private BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.MAINMENU; } }
public void Destroy()
{
}
public void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
UnityEngine.Application.targetFrameRate = 60;
}
public void Update()
{
}
}
}

31
Assets/Scripts/Server/Game/ServerCharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomServer
{
class ServerCharSelectBRState : CharSelectBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all server-side logic for the character select BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

33
Assets/Scripts/Server/Game/ServerGameBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomServer
{
class ServerGameBRState : GameBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all server-side logic for the Game BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams )
{
base.Initialize(manager, stateParams);
//NOTE: it's very important to use MLAPI's scene switching logic, and not switch the scene yourself. If you do,
//MLAPI will get confused internally about which scene is active.
//MLAPI_WISHLIST: could MLAPI listen to scene change events and then handle the networked switch itself, internally?
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("SampleScene");
}
public override void Update()
{
base.Update();
}
}
}

152
Assets/Scripts/Shared/Game/BossRoomStateManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoom
{
/// <summary>
/// enum for the top-level game FSM.
/// </summary>
public enum BossRoomState
{
NONE, // no state is actively running. Currently this only happens prior to BossRoomStateManager.Start having run.
MAINMENU, // main menu logic is running.
CHARSELECT, // character select logic is running.
GAME, // core game logic is running.
}
/// <summary>
/// The BossRoomStateManager manages the top-level logic for each gamestate.
/// </summary>
/// <remarks>
/// This class is intended as the top-level FSM for the game. Because of that, it runs both before and after
/// the time when the client has an active connection to the host.
/// On the Host, server and client logic run concurrently (with server logic preceding client on every update tic).
/// On the Client, only client logic runs.
/// </remarks>
public class BossRoomStateManager : MonoBehaviour
{
public GameNetHub NetHub { get; private set; }
/// <summary>
/// Gets the active state that BossRoomStateManager is in.
/// </summary>
public BossRoomState ActiveState
{
get
{
//There is always a client state, and client and server states must always match. See ChangeState.
//Note: if converting to a dedicated server, you would need to change this to an #IF BUILD_SERVER #ELSE block
//that checked either client or server states. See note in ChangeState about converting to a dedicated server.
return m_clientState != null ? m_clientState.State : BossRoomState.NONE;
}
}
private IBossRoomState m_serverState;
private IBossRoomState m_clientState;
/// <summary>
/// Transitions from one active state to another. Will no-op if transitioning to the current active state.
/// </summary>
/// <remarks>
/// On the Host, Server and Client BossRoomState objects run concurrently. On clients, only the "client" version of each
/// state is instantiated, and for a hypothetical dedicated server, only the server object would be instantiated. If you were
/// moving to a dedicated server model and stripping out server code from the client, this is one method you would need to change
/// (for example by making a client and server factory components that plug themselves into the BossRoomStateManager, and are
/// guarded by #IF !BUILD_SERVER or #IF BUILD_SERVER, respectively)
/// </remarks>
/// <param name="target">the target state to transition to</param>
/// <param name="stateParams">Any special parameters to inform the next state about, or null for none.</param>
public void ChangeState(BossRoomState target, Dictionary<string,System.Object> stateParams )
{
if( target == ActiveState ) { return; }
Debug.Log("transitioning from state " + ActiveState + " to " + target);
switch(target)
{
case BossRoomState.NONE:
{
DestroyStates();
m_serverState = null;
m_clientState = null;
break;
}
case BossRoomState.MAINMENU:
{
DestroyStates();
m_clientState = new BossRoomClient.ClientMainMenuBRState();
m_clientState.Initialize(this, stateParams);
break;
}
case BossRoomState.CHARSELECT:
{
DestroyStates();
if( NetHub.NetManager.IsServer )
{
m_serverState = new BossRoomServer.ServerCharSelectBRState();
m_serverState.Initialize(this, stateParams);
}
if( NetHub.NetManager.IsClient )
{
m_clientState = new BossRoomClient.ClientCharSelectBRState();
m_clientState.Initialize(this, stateParams);
}
break;
}
case BossRoomState.GAME:
{
DestroyStates();
if( NetHub.NetManager.IsServer )
{
m_serverState = new BossRoomServer.ServerGameBRState();
m_serverState.Initialize(this, stateParams);
}
if( NetHub.NetManager.IsClient )
{
m_clientState = new BossRoomClient.ClientGameBRState();
m_clientState.Initialize(this, stateParams);
}
break;
}
default:
throw new System.Exception("unimplemented gamestate detected: " + target);
}
}
/// <summary>
/// Helper method for ChangeState that destroys the active states if they exist.
/// </summary>
private void DestroyStates()
{
if (m_serverState != null) { m_serverState.Destroy(); }
if (m_clientState != null) { m_clientState.Destroy(); }
m_serverState = null;
m_clientState = null;
}
// Start is called before the first frame update
void Start()
{
NetHub = this.GetComponent<GameNetHub>();
ChangeState(BossRoomState.MAINMENU, null);
}
// Update is called once per frame
void FixedUpdate()
{
if( m_serverState != null ) { m_serverState.Update(); }
if( m_clientState != null ) { m_clientState.Update(); }
}
}
}

35
Assets/Scripts/Shared/Game/CharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoom
{
/// <summary>
/// The BossRoomState that runs during Character Select.
/// </summary>
class CharSelectBRState : IBossRoomState
{
protected BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.CHARSELECT; } }
public virtual void Destroy()
{
}
public virtual void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
}
public virtual void Update()
{
//FIXME_DMW (temp): as we don't have a CharacterSelect scene yet, we just advance directly to the Game state.
m_manager.ChangeState(BossRoomState.GAME, null);
}
}
}

11
Assets/Scripts/Shared/Game/GameBRState.cs.meta


fileFormatVersion: 2
guid: 19b55cfbf40aa244f9bd90143d441ee4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Assets/Scripts/Shared/Game/IBossRoomState.cs


using System;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoom
{
/// <summary>
/// Interface that models a single state of the BossRoom game. See BossRoomStateManager for more information.
/// </summary>
interface IBossRoomState
{
/// <summary>
/// Called when this BossRoomState is transitioned to.
/// <param name="stateParams"/>optional dictionary of parameters to be used by the new gamestate. </param>
/// </summary>
void Initialize( BossRoomStateManager manager, Dictionary<string,System.Object> stateParams=null );
/// <summary>
/// Called once per Update by the BossRoomStateManager.
/// </summary>
void Update();
/// <summary>
/// Called when this BossRoomState ends.
/// </summary>
void Destroy();
/// <summary>
/// What BossRoomState this object represents.
/// </summary>
BossRoomState State { get; }
}
}

11
Assets/Scripts/Shared/Game/IBossRoomState.cs.meta


fileFormatVersion: 2
guid: d6956349616d0304abbd589d59a797f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
Assets/Scripts/Shared/Game/GameBRState.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoom
{
/// <summary>
/// The BossRoomState that runs during primary gameplay.
/// </summary>
class GameBRState : IBossRoomState
{
protected BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.GAME; } }
//!! STUB !! will be filled out with any gamestate logic shared between server and client.
public virtual void Destroy()
{
}
public virtual void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
}
public virtual void Update()
{
}
}
}

/Assets/Scripts/Client/Game/ClientCharSelectBRState.cs.meta → /Assets/Scripts/Client/Game/State/ClientBossRoomState.cs.meta

/Assets/Scripts/Client/Game/ClientGameBRState.cs.meta → /Assets/Scripts/Client/Game/State/ClientCharSelectState.cs.meta

/Assets/Scripts/Client/Game/ClientMainMenuBRState.cs.meta → /Assets/Scripts/Client/Game/State/ClientMainMenuState.cs.meta

/Assets/Scripts/Server/Game/ServerCharSelectBRState.cs.meta → /Assets/Scripts/Server/Game/State/ServerBossRoomState.cs.meta

/Assets/Scripts/Server/Game/ServerGameBRState.cs.meta → /Assets/Scripts/Server/Game/State/ServerCharSelectState.cs.meta

/Assets/Scripts/Shared/Game/BossRoomStateManager.cs.meta → /Assets/Scripts/Shared/Game/State/CharSelectData.cs.meta

/Assets/Scripts/Shared/Game/CharSelectBRState.cs.meta → /Assets/Scripts/Shared/Game/State/GameStateBehaviour.cs.meta

正在加载...
取消
保存