Exemple #1
0
    public void updateHUDafterTrade()
    {
        GameManager  manager = FindObjectOfType <GameManager>();
        Player_Class player  = manager.currentPlayer;

        victoryPointsText.text   = player.calcVictoryPoints().ToString();
        wealthText.text          = player.getWealth().ToString();
        achievementText.text     = player.getAchievement().ToString();
        commonMineralText.text   = player.getCommonMineral().ToString();
        uncommonMineralText.text = player.getRareMineral().ToString();
        rareMineralText.text     = player.getVeryRareMineral().ToString();
    }
    public void tradeAccept()
    {
        MainTrader = gm.currentPlayer;

        if (MainTrader == gm.players[0])
        {
            SecondTrader = gm.players[1];
        }
        else
        {
            SecondTrader = gm.players[0];
        }



        PlayerCmnRes = MainTrader.getCommonMineral();
        print("Common Resources: " + PlayerCmnRes);
        PlayerCmnResRequested = SecondTrader.getCommonMineral();
        InputCmnHolder        = int.Parse(inputForPlayer1Cmn.text);
        InputCmnHolderP2      = int.Parse(inputForPlayer2Cmn.text);

        PlayerRareRes = MainTrader.getRareMineral();
        print("Rare Resources: " + PlayerRareRes);
        PlayerRareResRequested = SecondTrader.getRareMineral();
        InputRareHolder        = int.Parse(inputForPlayer1Rare.text);
        InputRareHolderP2      = int.Parse(inputForPlayer2Rare.text);

        PlayerVeryRareRes = MainTrader.getVeryRareMineral();
        print("Very Rare Resources: " + PlayerVeryRareRes);
        PlayerVeryRareResRequested = SecondTrader.getVeryRareMineral();
        InputVeryRareHolder        = int.Parse(inputForPlayer1VeryRare.text);
        InputVeryRareHolderP2      = int.Parse(inputForPlayer2VeryRare.text);



        if (InputCmnHolder <= PlayerCmnRes && InputRareHolder <= PlayerRareRes && InputVeryRareHolder <= PlayerVeryRareRes)
        {
            Trade_GUI.GetComponent <Canvas>().enabled         = false;
            TradeConfirmation.GetComponent <Canvas>().enabled = true;
            p1CmnTxt.text  = inputForPlayer1Cmn.text;
            p1RareTxt.text = inputForPlayer1Rare.text;
            p1VRTxt.text   = inputForPlayer1VeryRare.text;
            p2CmnTxt.text  = inputForPlayer2Cmn.text;
            p2RareTxt.text = inputForPlayer2Rare.text;
            p2VRTxt.text   = inputForPlayer2VeryRare.text;
        }
        else
        {
            print(InputCmnHolder + ": " + PlayerCmnRes);
            errorCanvas.enabled = true;
            print("Insufficient Minerals");
        }
    }
Exemple #3
0
    /*public static void checkForHUDHoverOver() {
     *  raycastResults = GetEventSystemRaycastResults();
     *  for(int i = 0; i < raycastResults.Count; i++) {
     *      RaycastResult curResult = raycastResults[i];
     *      IHUDHoverable hoverable = curResult.gameObject.GetComponent<IHUDHoverable>();
     *      if(hoverable != null) {
     *          hoverable.onHover();
     *      }
     *  }
     * }*/

    public void updateHUD()
    {
        GameManager  manager = FindObjectOfType <GameManager>();
        Player_Class player  = manager.currentPlayer;

        victoryPointsText.text   = player.calcVictoryPoints().ToString();
        wealthText.text          = player.getWealth().ToString();
        achievementText.text     = player.getAchievement().ToString();
        commonMineralText.text   = player.getCommonMineral().ToString();
        uncommonMineralText.text = player.getRareMineral().ToString();
        rareMineralText.text     = player.getVeryRareMineral().ToString();
        //turnNumber.text = manager.turnsSoFar.ToString();

        clearShipInfo();
        notifications.refreshNotificationsDisplay(player);
    }