コード例 #1
0
 public void RaiseEvent(PlayerIDList playerID)
 {
     foreach (GoalEventListener listener in listeners)
     {
         listener.RaiseEvent(playerID);
     }
 }
コード例 #2
0
    public void UpdateScore(PlayerIDList playerID)
    {
        if (playerID == PlayerIDList.LOCAL)
        {
            awayScore++;
        }
        else
        {
            localScore++;
        }

        UpdateUI();

        if (localScore == MaxScore || awayScore == MaxScore)
        {
            //End game event
        }
    }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void SpawnBallAfterGoal(PlayerIDList playerID)
 {
     transform.position = spawnPositions[(int)playerID].position;
     SetBallInitialVelocity();
 }
コード例 #5
0
 public void RaiseEvent(PlayerIDList playerID)
 {
     goalEventResponse.Invoke(playerID);
 }