示例#1
0
    public void BuyShip(int i, int wood, int rum, int gold, int pearl)
    {
        if (!(PlayerHasEnoughResourcesToBuy(wood, 0) && PlayerHasEnoughResourcesToBuy(rum, 1) && PlayerHasEnoughResourcesToBuy(gold, 2) && PlayerHasEnoughResourcesToBuy(pearl, 3)))
        {
            return;                                                                                                                                                                           // price 100 gold for upgrade
        }
        foreach (Ship s in playerInformation.listOfShips)
        {
            if (s.tier == shipyardShips[i].tier)
            {
                return;
            }
        }
        //   if (playerInformation.listOfShips.Contains(new Ship { tier = shipyardShips[i].tier})) return;

        PayWithResources(wood, 0);
        PayWithResources(rum, 1);
        PayWithResources(gold, 2);
        PayWithResources(pearl, 3);

        playerInformation.Add_to_shipList(shipyardShips[i]);
        UpdateResources();
        StartCoroutine(ShipInsert(i));
        audio_source.Play();
    }