Skip to content

Commit e30c8f9

Browse files
committed
initial state machine implementation
1 parent 4bbe421 commit e30c8f9

21 files changed

+915
-83
lines changed

Assets/BossRoom/Prefabs/GameNetPortal.prefab

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ GameObject:
99
serializedVersion: 6
1010
m_Component:
1111
- component: {fileID: 5062837533140207352}
12-
- component: {fileID: 5062837533140207350}
13-
- component: {fileID: 5062837533140207353}
14-
- component: {fileID: 5062837533140207351}
12+
- component: {fileID: 1984353324962460586}
1513
m_Layer: 0
1614
m_Name: GameNetPortal
1715
m_TagString: GameNetPortal
@@ -29,11 +27,12 @@ Transform:
2927
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
3028
m_LocalPosition: {x: 0, y: 0, z: 0}
3129
m_LocalScale: {x: 1, y: 1, z: 1}
30+
m_ConstrainProportionsScale: 0
3231
m_Children: []
3332
m_Father: {fileID: 0}
3433
m_RootOrder: 0
3534
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
36-
--- !u!114 &5062837533140207350
35+
--- !u!114 &1984353324962460586
3736
MonoBehaviour:
3837
m_ObjectHideFlags: 0
3938
m_CorrespondingSourceObject: {fileID: 0}
@@ -42,34 +41,9 @@ MonoBehaviour:
4241
m_GameObject: {fileID: 5062837533140207349}
4342
m_Enabled: 1
4443
m_EditorHideFlags: 0
45-
m_Script: {fileID: 11500000, guid: 7ba4a1d598313d94a81a08ceae147b57, type: 3}
44+
m_Script: {fileID: 11500000, guid: bf51ea31bbc84cc3aa883cc5f1caae06, type: 3}
4645
m_Name:
4746
m_EditorClassIdentifier:
4847
m_NetworkManager: {fileID: 0}
4948
m_AvatarRegistry: {fileID: 11400000, guid: 48d17d764bff6c643a3dc035fb71c979, type: 2}
50-
PlayerName:
51-
--- !u!114 &5062837533140207353
52-
MonoBehaviour:
53-
m_ObjectHideFlags: 0
54-
m_CorrespondingSourceObject: {fileID: 0}
55-
m_PrefabInstance: {fileID: 0}
56-
m_PrefabAsset: {fileID: 0}
57-
m_GameObject: {fileID: 5062837533140207349}
58-
m_Enabled: 1
59-
m_EditorHideFlags: 0
60-
m_Script: {fileID: 11500000, guid: 5bd31edc1b1fd1342b3bf8193a5a03b2, type: 3}
61-
m_Name:
62-
m_EditorClassIdentifier:
63-
--- !u!114 &5062837533140207351
64-
MonoBehaviour:
65-
m_ObjectHideFlags: 0
66-
m_CorrespondingSourceObject: {fileID: 0}
67-
m_PrefabInstance: {fileID: 0}
68-
m_PrefabAsset: {fileID: 0}
69-
m_GameObject: {fileID: 5062837533140207349}
70-
m_Enabled: 1
71-
m_EditorHideFlags: 0
72-
m_Script: {fileID: 11500000, guid: 54b0859a1da930541adf0b2d1bb8d977, type: 3}
73-
m_Name:
74-
m_EditorClassIdentifier:
7549
m_GameState: {fileID: 7151198093957655792, guid: 3af96a32a84bcf74d9538fa7af973c97, type: 3}

Assets/BossRoom/Scenes/Startup.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:57ebb73c6fac9cb948a60578d22c0c76ac8980c78e51e261e867c06eeb10013e
3-
size 46492
2+
oid sha256:6361055f2512c46595263043d91a3a0fe186dd34e66e0f27eccde053ad88c4a1
3+
size 45826

Assets/BossRoom/Scripts/ApplicationLifecycle/ApplicationController.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ namespace Unity.Multiplayer.Samples.BossRoom.Shared
1919
public class ApplicationController : MonoBehaviour
2020
{
2121
[SerializeField] UpdateRunner m_UpdateRunner;
22-
[SerializeField] GameNetPortal m_GameNetPortal;
23-
[SerializeField] ClientGameNetPortal m_ClientNetPortal;
24-
[SerializeField] ServerGameNetPortal m_ServerGameNetPortal;
22+
[SerializeField] ConnectionManager m_ConnectionManager;
2523

2624
LocalLobby m_LocalLobby;
2725
LobbyServiceFacade m_LobbyServiceFacade;
@@ -40,9 +38,7 @@ private void Awake()
4038

4139
scope.BindInstanceAsSingle(this);
4240
scope.BindInstanceAsSingle(m_UpdateRunner);
43-
scope.BindInstanceAsSingle(m_GameNetPortal);
44-
scope.BindInstanceAsSingle(m_ClientNetPortal);
45-
scope.BindInstanceAsSingle(m_ServerGameNetPortal);
41+
scope.BindInstanceAsSingle(m_ConnectionManager);
4642

4743
//the following singletons represent the local representations of the lobby that we're in and the user that we are
4844
//they can persist longer than the lifetime of the UI in MainMenu where we set up the lobby that we create or join

Assets/BossRoom/Scripts/Gameplay/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ void Start()
6060
m_Portal = GetComponent<GameNetPortal>();
6161

6262
m_Portal.NetManager.OnClientDisconnectCallback += OnDisconnectOrTimeout;
63+
m_Portal.NetManager.OnClientConnectedCallback += NetManagerOnOnClientConnectedCallback;
64+
}
65+
66+
void NetManagerOnOnClientConnectedCallback(ulong obj)
67+
{
68+
Debug.Log("Client connected callback");
6369
}
6470

6571
void OnDestroy()
@@ -69,6 +75,7 @@ void OnDestroy()
6975
if (m_Portal.NetManager != null)
7076
{
7177
m_Portal.NetManager.OnClientDisconnectCallback -= OnDisconnectOrTimeout;
78+
m_Portal.NetManager.OnClientConnectedCallback -= NetManagerOnOnClientConnectedCallback;
7279
}
7380

7481
if (NetworkManager.Singleton != null && NetworkManager.Singleton.CustomMessagingManager != null)
@@ -146,6 +153,7 @@ private void OnDisconnectReasonReceived(ConnectStatus status)
146153

147154
private void OnDisconnectOrTimeout(ulong clientID)
148155
{
156+
Debug.Log("DisconnectCallback");
149157
// This is also called on the Host when a different client disconnects. To make sure we only handle our own disconnection, verify that we are either
150158
// not a host (in which case we know this is about us) or that the clientID is the same as ours if we are the host.
151159
if (!NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsHost && NetworkManager.Singleton.LocalClientId == clientID)
@@ -180,7 +188,7 @@ private void OnDisconnectOrTimeout(ulong clientID)
180188
default:
181189
throw new NotImplementedException(DisconnectReason.Reason.ToString());
182190
}
183-
191+
Debug.Log(DisconnectReason.Reason);
184192
m_ConnectStatusPub.Publish(DisconnectReason.Reason);
185193
DisconnectReason.Clear();
186194
}

0 commit comments

Comments
 (0)