mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Update HostSetup.cs
adding virtual methods for test setup
This commit is contained in:
parent
7bcf957c23
commit
3fcc7415b4
@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
@ -14,6 +13,11 @@ public class HostSetup
|
||||
protected GameObject playerGO;
|
||||
protected NetworkIdentity identity;
|
||||
|
||||
protected virtual bool AutoAddPlayer => true;
|
||||
|
||||
protected virtual void afterStartHost() { }
|
||||
protected virtual void beforeStopHost() { }
|
||||
|
||||
[UnitySetUp]
|
||||
public IEnumerator SetupHost()
|
||||
{
|
||||
@ -28,15 +32,30 @@ public IEnumerator SetupHost()
|
||||
|
||||
manager.playerPrefab = playerGO;
|
||||
manager.autoStartServerBuild = false;
|
||||
manager.autoCreatePlayer = AutoAddPlayer;
|
||||
|
||||
if (Application.isBatchMode)
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
}
|
||||
|
||||
yield return null;
|
||||
|
||||
manager.StartHost();
|
||||
|
||||
yield return null;
|
||||
|
||||
afterStartHost();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void ShutdownHost()
|
||||
|
||||
[UnityTearDown]
|
||||
public IEnumerator ShutdownHost()
|
||||
{
|
||||
beforeStopHost();
|
||||
|
||||
yield return null;
|
||||
|
||||
Object.DestroyImmediate(playerGO);
|
||||
manager.StopHost();
|
||||
Object.DestroyImmediate(networkManagerGo);
|
||||
|
Loading…
Reference in New Issue
Block a user