예제 #1
0
    /// <summary> Finding which players can trade right now and starting choosing. </summary>
    private void OnClick()
    {
        List <PlayerInGame> playersFreeToTrade = new List <PlayerInGame>();

        // In all player objects.
        foreach (var player in GameManager.singleton.playersObjects)
        {
            NetworkInstanceId playerNetId = player.GetComponent <PlayerInGame>().netId;
            // If player is not fighting, helping with fight or isn't same player who clicked this button.
            if (playerNetId != GameManager.singleton.fightingPlayerNetId &&
                playerNetId != GameManager.singleton.helpingPlayerNetId &&
                playerNetId != PlayerInGame.localPlayerInGame.netId)
            {
                playersFreeToTrade.Add(player.GetComponent <PlayerInGame>());
            }
        }

        if (playersFreeToTrade.Count > 0)
        {
            PlayerInGame.localPlayerInGame.ChoosePlayerToTradeWith(playersFreeToTrade.ToArray());
        }
        else
        {
            InfoPanel.Alert("Zero potential traders found!");
        }
    }
예제 #2
0
 void RpcInitiateFight()
 {
     //Debug.Log("RpcInititating fight with: " + this.gameObject);
     gameManager.fightingMonsters.Add(this.gameObject);
     ClientSetActiveCardButtons(false);
     PlayerInGame.localPlayerInGame.progressButton.ActivateButton();
     HelpButton.Activate();
     LevelCounter.OnStartFight();
     InfoPanel.Alert("Fight with " + cardValues.name + " starts!");
 }
예제 #3
0
    /// <summary> Saving game under specified file name. </summary>
    void OnClick()
    {
        // Players currently can't save when cards are waiting in queue to be used or during fights.
        if (GameManager.singleton.cardsUsageQueue.Count > 0 || GameManager.singleton.fightInProggres)
        {
            InfoPanel.Alert("Can't save right now!");
            return;
        }

        string path = SaveGameMenu.pathToSaveIn;

        // Ask if Player wants to overwrite the save.
        if (File.Exists(path))
        {
            SaveOverwriteAlert.Alert();
            return;
        }

        SaveSystem.SaveGame(path);
    }