Skip to content
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
20 changes: 18 additions & 2 deletions Assets/BossRoom/Prefabs/State/BossRoomState.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: -1764033382396218637}
- component: {fileID: 3608714310874968837}
- component: {fileID: 5762482089640033414}
- component: {fileID: 2113376856512980659}
m_Layer: 0
m_Name: BossRoomState
m_TagString: Untagged
Expand Down Expand Up @@ -83,8 +84,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_PlayerPrefab: {fileID: 6009713983291384767, guid: 8237adf32a9b6de4892e6febe6b4bdef, type: 3}
m_EnemyPrefab: {fileID: 3713729372785093435, guid: 6cdd52f1fa2ed34469a487ae6477eded, type: 3}
m_BossPrefab: {fileID: 3688950541947916326, guid: 365e94337fd10fe4ebde1906df413ac7, type: 3}
m_PlayerSpawnPoints:
- {fileID: 6319832178442273571}
- {fileID: 374135395555381814}
Expand All @@ -94,6 +93,23 @@ MonoBehaviour:
- {fileID: 6314369147267609336}
- {fileID: 8725901042666772653}
- {fileID: 7239491272522478247}
--- !u!114 &2113376856512980659
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: ab1e76745edfc434ab8154ad27efc5fd, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EnemyPrefab: {fileID: 3713729372785093435, guid: 6cdd52f1fa2ed34469a487ae6477eded, type: 3}
m_BossPrefab: {fileID: 3688950541947916326, guid: 365e94337fd10fe4ebde1906df413ac7, type: 3}
m_SpawnEnemyKeyCode: 101
m_SpawnBossKeyCode: 98
m_InstantQuitKeyCode: 113
--- !u!1 &1088799320945899822
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@ public class ServerBossRoomState : GameStateBehaviour
[Tooltip("Make sure this is included in the NetworkManager's list of prefabs!")]
private NetworkObject m_PlayerPrefab;

// note: this is temporary, for testing!
[SerializeField]
[Tooltip("Make sure this is included in the NetworkManager's list of prefabs!")]
private NetworkObject m_EnemyPrefab;

// note: this is temporary, for testing!
[SerializeField]
[Tooltip("Make sure this is included in the NetworkManager's list of prefabs!")]
private NetworkObject m_BossPrefab;

[SerializeField] [Tooltip("A collection of locations for spawning players")]
private Transform[] m_PlayerSpawnPoints;

private List<Transform> m_PlayerSpawnPointsList = null;

// note: this is temporary, for testing!
public override GameState ActiveState { get { return GameState.BossRoom; } }

/// <summary>
Expand Down Expand Up @@ -216,27 +206,5 @@ private IEnumerator CoroGameOver(float wait, bool gameWon)
GameStateRelay.SetRelayObject(gameWon);
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame");
}

/// <summary>
/// Temp code to spawn an enemy
/// </summary>
private void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
var newEnemy = Instantiate(m_EnemyPrefab);
newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
}
if (Input.GetKeyDown(KeyCode.B))
{
var newEnemy = Instantiate(m_BossPrefab);
newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
}
if (Input.GetKeyDown(KeyCode.Q))
{
GameStateRelay.SetRelayObject(false);
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame");
}
}
}
}
68 changes: 68 additions & 0 deletions Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using MLAPI;
using UnityEngine;

namespace BossRoom.Server
{
/// <summary>
/// Provides various special commands that the Host can use while developing and
/// debugging the game. These are not compiled into release builds. (If you want
/// to disable them for debug builds, disable or remove this component from the
/// BossRoomState prefab.)
/// </summary>
public class ServerTestingHotkeys : NetworkBehaviour
{
#if UNITY_EDITOR || DEVELOPMENT_BUILD
[SerializeField]
[Tooltip("Enemy to spawn. Make sure this is included in the NetworkManager's list of prefabs!")]
private NetworkObject m_EnemyPrefab;

[SerializeField]
[Tooltip("Boss to spawn. Make sure this is included in the NetworkManager's list of prefabs!")]
private NetworkObject m_BossPrefab;

[SerializeField]
[Tooltip("Key that the Host can press to spawn an extra enemy")]
KeyCode m_SpawnEnemyKeyCode = KeyCode.E;

[SerializeField]
[Tooltip("Key that the Host can press to spawn an extra boss")]
KeyCode m_SpawnBossKeyCode = KeyCode.B;

[SerializeField]
[Tooltip("Key that the Host can press to quit the game")]
KeyCode m_InstantQuitKeyCode = KeyCode.Q;

public override void NetworkStart()
{
base.NetworkStart();

if (!IsServer)
{
// these commands don't work on the client
enabled = false;
}
}

private void Update()
{
if (!IsServer) { return; } // not initialized yet

if (m_SpawnEnemyKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnEnemyKeyCode))
{
var newEnemy = Instantiate(m_EnemyPrefab);
newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
}
if (m_SpawnBossKeyCode != KeyCode.None && Input.GetKeyDown(m_SpawnBossKeyCode))
{
var newEnemy = Instantiate(m_BossPrefab);
newEnemy.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
}
if (m_InstantQuitKeyCode != KeyCode.None && Input.GetKeyDown(m_InstantQuitKeyCode))
{
GameStateRelay.SetRelayObject(false); // indicate to the post-game screen that the game was lost
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("PostGame");
}
}
#endif
}
}
11 changes: 11 additions & 0 deletions Assets/BossRoom/Scripts/Server/ServerTestingHotkeys.cs.meta

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