private void NextTurn() { if (actors.Count > token.Turn + 1) { if (OnTurnFinished != null) { OnTurnFinished.Invoke(token); } token.Turn++; turnDone = false; GrantTurn(actors[token.Turn]); } else { if (OnRoundFinished != null) { OnRoundFinished.Invoke(token); } token.Target = null; token.Round++; StartRound(); } }
private void GrantTurn(TurnComponent actor) { token.Target = actor; actor.Entity.Events.AddListener(OnActorTurnDone, EntityTurnDoneEvent.EVENT_TYPE); actor.GrantTurn(token); if (OnTurnStarted != null) { OnTurnStarted.Invoke(token); } }
public void EndTurn(TurnResult result) { currentPlayerIndex++; if (currentPlayerIndex >= players.Count) { GameManager.instance.currentRound++; currentPlayerIndex = 0; if (duringBuildPhase) { foreach (Player player in players) { player.wallet.Add(50); } buildTurnsLeftInPhase--; } } if (duringBuildPhase && buildTurnsLeftInPhase == 0) { //end build phase duringBuildPhase = false; buildTurnsLeftInPhase = buildTurnsPerPhase; shopUI.SetActive(false); } print($"Player {currentPlayerIndex + 1}'s turn!"); ScoreUIManager.instance.SetActiveCursor(currentPlayerIndex); //if (currentPlayer == 0 && TableZoneManager.instance.player1Zone.cueBalls.Count == 0 && TableZoneManager.instance.neutralZone.cueBalls.Count == 0) //{ // currentPlayer = 1; //} //else if (currentPlayer == 1 && TableZoneManager.instance.player2Zone.cueBalls.Count == 0 && TableZoneManager.instance.neutralZone.cueBalls.Count == 0) //{ // currentPlayer = 0; //} players[currentPlayerIndex].EndTurn(); EndTurnEvent?.Invoke(result); }
public void StartRound() { if (pendingActors.Count > 0) { actors.AddRange(pendingActors); actors.Sort((a, b) => b.Initiative.CompareTo(a.Initiative)); pendingActors.Clear(); } token.Turn = 0; turnDone = false; if (actors.Count > 0) { GrantTurn(actors[0]); if (OnRoundStarted != null) { OnRoundStarted.Invoke(token); } } }
public void OnEventRaised(Vector2 p, StoneColor c) { Response.Invoke(p, c); }