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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public class PlayModeExampleTest
{
// [UnityTest] - This won't work until we have reconnections
[UnityTest]
public IEnumerator SimpleConnectionTest()
{
PlayerPrefs.DeleteAll();
Expand Down Expand Up @@ -84,7 +84,7 @@ public IEnumerator CreatePlayerAndTestDecay()

// Standing still should decay a bit
PlayerController.Local.EnableTestInput();
while (foodEaten < 200)
while (foodEaten < 50)
{
Debug.Assert(circle != null, nameof(circle) + " != null");
var ourEntity = GameManager.Conn.Db.Entity.EntityId.Find(circle.EntityId);
Expand Down Expand Up @@ -116,6 +116,11 @@ public IEnumerator CreatePlayerAndTestDecay()
Debug.Assert(foodEntity != null, nameof(foodEntity) + " != null");
Debug.Assert(ourNewEntity != null, nameof(ourNewEntity) + " != null");
var toThisFood = (Vector2)foodEntity.Position - (Vector2)ourNewEntity.Position;
// We have to go slow for the first few pieces of food otherwise we can "hop" over it
if (foodEaten < 10)
{
toThisFood = toThisFood.normalized * 0.5f;
}
PlayerController.Local.SetTestInput(toThisFood);
}

Expand All @@ -131,7 +136,7 @@ public IEnumerator CreatePlayerAndTestDecay()
Debug.Assert(massEnd < massStart, "Mass should have decayed");
}

// [UnityTest] - This won't work until we have reconnections
[UnityTest]
public IEnumerator OneOffTest1()
{
var connected = false;
Expand Down Expand Up @@ -176,7 +181,7 @@ public IEnumerator OneOffTest1()
Debug.Log($"id: {players[0].PlayerId} Username: {players[0].Name}");
}

// [UnityTest] - This won't work until we have reconnections
[UnityTest]
public IEnumerator OneOffTest2()
{
var connected = false;
Expand Down Expand Up @@ -220,7 +225,7 @@ public IEnumerator OneOffTest2()
Debug.Log($"id: {players[0].PlayerId} Username: {players[0].Name}");
}

//[UnityTest]
[UnityTest]
public IEnumerator ReconnectionViaReloadingScene()
{
var connected = false;
Expand Down
3 changes: 3 additions & 0 deletions demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class GameManager : MonoBehaviour

private void Start()
{
// Clear game state in case we've disconnected and reconnected
Entities.Clear();
Players.Clear();
Comment thread
bfops marked this conversation as resolved.
Instance = this;
Application.targetFrameRate = 60;

Expand Down
Loading