Skip to content

feat: removing bridge classes for game states MTT-4204 #697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Assets/GameData/Transforms.meta

This file was deleted.

3 changes: 0 additions & 3 deletions Assets/GameData/Transforms/NetworkGameState.asset

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/GameData/Transforms/NetworkGameState.asset.meta

This file was deleted.

93 changes: 0 additions & 93 deletions Assets/Prefabs/Game/NetworkGameState.prefab

This file was deleted.

7 changes: 0 additions & 7 deletions Assets/Prefabs/Game/NetworkGameState.prefab.meta

This file was deleted.

17 changes: 0 additions & 17 deletions Assets/Prefabs/State/BossRoomState.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ GameObject:
m_Component:
- component: {fileID: 5655447013084909147}
- component: {fileID: 3608714310874968837}
- component: {fileID: -1764033382396218637}
- component: {fileID: 5762482089640033414}
- component: {fileID: 1290852967062359934}
m_Layer: 0
Expand Down Expand Up @@ -59,22 +58,6 @@ MonoBehaviour:
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
AutoObjectParentSync: 1
--- !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:
parentReference:
TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController
autoRun: 1
autoInjectGameObjects: []
--- !u!114 &5762482089640033414
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
21 changes: 3 additions & 18 deletions Assets/Prefabs/State/PostGameState.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ GameObject:
- component: {fileID: 7475764267130300179}
- component: {fileID: -1007214952234040975}
- component: {fileID: 7475764267130300178}
- component: {fileID: 4223400095609434710}
- component: {fileID: 6576822806953781696}
m_Layer: 0
m_Name: PostGameState
Expand Down Expand Up @@ -66,24 +65,10 @@ MonoBehaviour:
parentReference:
TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController
autoRun: 1
autoInjectGameObjects: []
autoInjectGameObjects:
- {fileID: 0}
- {fileID: 0}
m_NetcodeHooks: {fileID: 6576822806953781696}
--- !u!114 &4223400095609434710
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7475764267130300177}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1cb58d1788f410740b05cace1af646d7, type: 3}
m_Name:
m_EditorClassIdentifier:
parentReference:
TypeName: Unity.Multiplayer.Samples.BossRoom.Shared.ApplicationController
autoRun: 1
autoInjectGameObjects: []
--- !u!114 &6576822806953781696
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scenes/BossRoom.unity
Git LFS file not shown
4 changes: 2 additions & 2 deletions Assets/Scenes/BossRoom/DungeonBossRoom.unity
Git LFS file not shown
4 changes: 2 additions & 2 deletions Assets/Scenes/BossRoom/DungeonEntrance.unity
Git LFS file not shown
4 changes: 2 additions & 2 deletions Assets/Scenes/BossRoom/DungeonTransition.unity
Git LFS file not shown
4 changes: 2 additions & 2 deletions Assets/Scenes/PostGame.unity
Git LFS file not shown
4 changes: 0 additions & 4 deletions Assets/Scripts/ConnectionManagement/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ public class ConnectionManager : MonoBehaviour
NetworkManager m_NetworkManager;
public NetworkManager NetworkManager => m_NetworkManager;

[SerializeField]
NetworkObject m_GameState;
public NetworkObject GameState => m_GameState;

[Inject]
IObjectResolver m_Resolver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class HostingState : ConnectionState

public override void Enter()
{
var gameState = UnityEngine.Object.Instantiate(m_ConnectionManager.GameState);

gameState.Spawn();

SceneLoaderWrapper.Instance.AddOnSceneEventCallback();

//The "BossRoom" server always advances to CharSelect immediately on start. Different games
Expand Down
12 changes: 0 additions & 12 deletions Assets/Scripts/Gameplay/GameState/ClientBossRoomState.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Gameplay/GameState/ClientBossRoomState.cs.meta

This file was deleted.

13 changes: 0 additions & 13 deletions Assets/Scripts/Gameplay/GameState/ClientPostGameState.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Assets/Scripts/Gameplay/GameState/GameStateBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum GameState
}

/// <summary>
/// A special kind of NetworkBehaviour that represents a discrete game state. The special feature it offers is
/// A special component that represents a discrete game state and its dependencies. The special feature it offers is
/// that it provides some guarantees that only one such GameState will be running at a time.
/// </summary>
/// <remarks>
Expand All @@ -32,7 +32,7 @@ public enum GameState
/// 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.
/// current GameState object will live on, and the version in the new scene will auto-destruct 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).
Expand Down
34 changes: 0 additions & 34 deletions Assets/Scripts/Gameplay/GameState/NetworkGameState.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Gameplay/GameState/NetworkGameState.cs.meta

This file was deleted.

11 changes: 0 additions & 11 deletions Assets/Scripts/Gameplay/GameState/NetworkWinState.cs.meta

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ public enum WinState
}

/// <summary>
/// MonoBehaviour containing only one NetworkVariableBool to represent the game session's win state.
/// MonoBehaviour containing only one NetworkVariable<WinState> to represent the game session's win state.
/// </summary>
public class NetworkWinState : NetworkBehaviour
public class PersistentGameState : NetworkBehaviour
{
public NetworkVariable<WinState> winState = new NetworkVariable<WinState>(WinState.Invalid);

public static PersistentGameState Instance;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading