public void RaiseEvent(PlayerIDList playerID) { foreach (GoalEventListener listener in listeners) { listener.RaiseEvent(playerID); } }
public void UpdateScore(PlayerIDList playerID) { if (playerID == PlayerIDList.LOCAL) { awayScore++; } else { localScore++; } UpdateUI(); if (localScore == MaxScore || awayScore == MaxScore) { //End game event } }
public async Task GetConnectedPlayers_Sends_OK() { var mockClient = new Mock <SDK.SDKClient>(); var mockSdk = new AgonesSDK(); var expected = new List <string> { "player1", "player2" }; var playerList = new PlayerIDList() { List = { expected } }; var fakeCall = TestCalls.AsyncUnaryCall(Task.FromResult(playerList), Task.FromResult(new Metadata()), () => Status.DefaultSuccess, () => new Metadata(), () => { }); mockClient.Setup(m => m.GetConnectedPlayersAsync(It.IsAny <Empty>(), It.IsAny <Metadata>(), It.IsAny <DateTime?>(), It.IsAny <CancellationToken>())).Returns(fakeCall); mockSdk.alpha.client = mockClient.Object; var result = await mockSdk.Alpha().GetConnectedPlayersAsync(); CollectionAssert.AreEquivalent(expected, result); }
public void SpawnBallAfterGoal(PlayerIDList playerID) { transform.position = spawnPositions[(int)playerID].position; SetBallInitialVelocity(); }
public void RaiseEvent(PlayerIDList playerID) { goalEventResponse.Invoke(playerID); }