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

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

        onNewTurn += SetActivePlayer;
    }
Ejemplo n.º 9
0
 public void RemoveNewTurnListener(OnNewTurn turnCallback)
 {
     listenersCount--;
     NewTurn -= turnCallback;
 }
Ejemplo n.º 10
0
 public void NewTurnListener(OnNewTurn turnCallback)
 {
     listenersCount++;
     NewTurn += turnCallback;
 }
Ejemplo n.º 11
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);
        }