void Start() { if (instance != null && instance != this) { Destroy(this); return; } instance = this; world = gameObject.AddComponent <World>(); CreatePlayerData(); AddController(); currentPlayer = 0; order = new PlayerColor[4]; order[0] = PlayerColor.Blue; order[1] = PlayerColor.Blue; order[2] = PlayerColor.Blue; order[3] = PlayerColor.Blue; OnNewTurn.Invoke(order[currentPlayer]); //StartCoroutine(DeterminePlayerOrder(3)); }
public void StartNewTurn() { turn++; isXTurn = !isXTurn; isPlayerOnesTurn = !isPlayerOnesTurn; if (isPlayerOnesTurn) { turnTimer = 1f; } OnNewTurn?.Invoke(); }
private void CheckEndFight() { foreach (var enemy in enemies) { if (!enemy.IsMoved) { return; } } isFight = false; OnNewTurn.Invoke(); player.StartAming(); }
public void EndTurn(int inPlayerID) { if (currentPlayerTurn != inPlayerID) { throw new System.Exception("A player tried to end turn despite not being its turn. Desync or cheater!"); } currentPlayerTurn++; if (currentPlayerTurn > Program.networkManager.CurrentRoom.PlayerCount) { currentPlayerTurn = 1; } OnNewTurn?.Invoke(currentPlayerTurn); if (currentPlayerTurn == Program.networkManager.LocalPlayer.ID) { OnNewMyTurn?.Invoke(); } }
/// <summary> /// Calls our new turn event handler. /// Called after our CurrentActivePlayer is updated in our screen. /// </summary> public void NewTurn() { // Draw a card - in the draw method we will add it to our hand if we can for (int i = 0; i < CardsToDrawPerTurn; i++) { if (CardsLeftInDeck > 0) { DrawCard(); } } ResourceCardsPlacedThisTurn = 0; // Refresh all our resources so they are all available for use now for (ResourceType resourceIndex = ResourceType.Crew; resourceIndex != ResourceType.kNumResourceTypes; resourceIndex++) { foreach (ResourceCard card in Resources[(int)resourceIndex]) { card.Used = false; } } OnNewTurn?.Invoke(this); }
private void NewTurn() { transform.rotation = Quaternion.Euler(0, 0, 0); CursorState = CursorState.INACTIVE; OnNewTurn?.Invoke(); }
public void NewTurn() { ++TurnCount; Debug.Log($"New turn: {TurnCount}"); OnNewTurn?.Invoke(TurnCount); }
/// <summary> /// Handles a NewTurnPacket. /// </summary> /// <param name="packet"></param> private void HandleNewTurn(NewTurnPacket packet) { var args = new NewTurnEventArgs(packet.GuesserPlayerIndex, packet.DrawerPlayerIndex); OnNewTurn?.Invoke(this, args); }