Exemplo n.º 1
0
    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));
    }
Exemplo n.º 2
0
    public void StartNewTurn()
    {
        turn++;
        isXTurn          = !isXTurn;
        isPlayerOnesTurn = !isPlayerOnesTurn;

        if (isPlayerOnesTurn)
        {
            turnTimer = 1f;
        }
        OnNewTurn?.Invoke();
    }
Exemplo n.º 3
0
 private void CheckEndFight()
 {
     foreach (var enemy in enemies)
     {
         if (!enemy.IsMoved)
         {
             return;
         }
     }
     isFight = false;
     OnNewTurn.Invoke();
     player.StartAming();
 }
Exemplo n.º 4
0
    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();
        }
    }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
 private void NewTurn()
 {
     transform.rotation = Quaternion.Euler(0, 0, 0);
     CursorState        = CursorState.INACTIVE;
     OnNewTurn?.Invoke();
 }
Exemplo n.º 7
0
 public void NewTurn()
 {
     ++TurnCount;
     Debug.Log($"New turn: {TurnCount}");
     OnNewTurn?.Invoke(TurnCount);
 }
Exemplo n.º 8
0
        /// <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);
        }