Beispiel #1
0
 public void BuyUpgrade()
 {
     if (affectedShip)
     {
         ShipUpgrades u = affectedShip.gameObject.GetComponent <ShipUpgrades> ();
         if (u)
         {
             u.UpgradeThisShip();
         }
     }
 }
    public void SetButtonText()
    {
        if (selectedShip != 0)
        {
            GameObject ship = ships [selectedShip - 1];
            GetComponent <AudioManager> ().selectedShip = ship;
            if (ship != null)
            {
                buyUpgradePanel.SetActive(true);
                buyShipsPanel.SetActive(false);
                buyUpgradePanel.gameObject.transform.GetChild(0).GetComponent <Button> ().enabled = true;

                ShipUpgrades u = ship.GetComponent <ShipUpgrades> ();
                SetButtonActive(buyUpgradePanel.transform.GetChild(0).gameObject, u.UpgradeText());
                if (u.AmountOfUpgrades() != u.GetMaxUpgrades())
                {
                    priceText1.text = "" + 5;                     // u.GetUpgradeCost
                    priceText2.text = "";
                }
                else
                {
                    priceText1.text = "";
                    priceText2.text = "";
                }

                /*if (ship.GetComponent<ShipUpgrades> ().GetMaxUpgrades () - ship.GetComponent<ShipUpgrades> ().AmountOfUpgrades () > 0) {
                 *      SetButtonActive (buyUpgradePanel.transform.GetChild (0).gameObject, "Buy Upgrade");
                 *      priceText1.text = "" + 5;
                 *      priceText2.text = "";
                 * } else if (ship.GetComponent<ShipUpgrades> ().GetMaxUpgrades () == ship.GetComponent<ShipUpgrades> ().AmountOfUpgrades ()) {
                 *      buyUpgradePanel.gameObject.transform.GetChild (0).GetComponent<Button> ().enabled = false;
                 *      SetButtonActive (buyUpgradePanel.transform.GetChild (0).gameObject, "Ship Fully Upgraded");
                 *      priceText1.text = "";
                 *      priceText2.text = "";
                 * }*/
            }
            else
            {
                selectedShip = ShipContainer.GetSpaceshipCount() + 1;
                buyShipsPanel.SetActive(true);
                buyUpgradePanel.SetActive(false);
                SetButtonActive(buyShipsPanel.transform.GetChild(0).gameObject, "Buy Pidgeon");
                priceText1.text = "" + 5;
                priceText2.text = "" + 5;
                SetButtonActive(buyShipsPanel.transform.GetChild(1).gameObject, "Buy UFO");
            }
        }
        else
        {
            buyUpgradePanel.SetActive(false);
            buyShipsPanel.SetActive(false);
        }
    }
Beispiel #3
0
 public bool UpgradeAvailable()
 {
     if (affectedShip)
     {
         ShipUpgrades u = affectedShip.gameObject.GetComponent <ShipUpgrades> ();
         if (u)
         {
             return(u.AmountOfUpgrades() != u.GetMaxUpgrades());
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(true);
     }
 }
Beispiel #4
0
    public void SetShip(ShipControl ship, Sprite image, bool disregardValidity)
    {
        ShipUpgrades u = null;

        if ((ship) || (disregardValidity))
        {
            if (ship)
            {
                u = ship.gameObject.GetComponent <ShipUpgrades> ();
            }
            this.gameObject.SetActive(true);
            affectedShip   = ship;
            display.sprite = image;
        }
        else
        {
            this.gameObject.SetActive(false);
        }
        if (u)
        {
            if (upgrade)
            {
                upgrade.gameObject.SetActive(u.AmountOfUpgrades() == u.GetMaxUpgrades());
            }
            if (upgradeText)
            {
                upgradeText.text = u.AmountOfUpgrades().ToString();
                upgradeText.gameObject.SetActive(true);
            }
        }
        else
        {
            if (upgrade)
            {
                upgrade.gameObject.SetActive(false);
            }
            if (upgradeText)
            {
                upgradeText.gameObject.SetActive(false);
            }
        }
    }
Beispiel #5
0
        // public byte[] Shipupgrades;
        //
        //public string Account;

        //public Variant Claim; //remove?

        public override void Read(IStarboundStream stream)
        {
            // AssetDigest = stream.ReadToEnd();

            AssetDigest = stream.ReadUInt8Array();
            SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0}", AssetDigest.Length));
            UUID = stream.ReadUInt8Array(16);
            SharpStarLogger.DefaultLogger.Info(string.Format("uuid:{0}", UUID.Length));
            PlayerName = stream.ReadString();
            SharpStarLogger.DefaultLogger.Info(string.Format("player name:{0}", PlayerName));
            Species = stream.ReadString();
            SharpStarLogger.DefaultLogger.Info(string.Format("species:{0}", Species));
            Shipworld = stream.ReadUInt8Array();
            SharpStarLogger.DefaultLogger.Info(string.Format("Sw:{0}", Shipworld.Length));
            ShipUpgrade = ShipUpgrades.FromStream(stream);
            Account     = stream.ReadString();
            SharpStarLogger.DefaultLogger.Info(string.Format("Account:{0}", Account));
            //  Shipupgrades = stream.ReadToEnd();
            //SharpStarLogger.DefaultLogger.Info(string.Format("Sw:{0}", Shipupgrades.Length));
            // ShipUpgrade = ShipUpgrades.FromStream(stream);
            // SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0},{1},{2}", ShipUpgrade.shipLevel.Value,ShipUpgrade.maxFuel.Value,ShipUpgrade.Capabilites.Length));

            //Account = stream.ReadString();
            // SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0}UUID:{1}PN:{2}SP:{3}SHW:{4}SHU:{5}"UUID,PlayerName,Shipworld,ShipUpgrade));

            /*
             * AssetDigest = stream.ReadUInt8Array();
             * //   Claim = stream.ReadVariant();
             * bool uuid = stream.ReadBoolean();
             * if (uuid)
             *  UUID = stream.ReadUInt8Array(16);
             * PlayerName = stream.ReadString();
             * Species = stream.ReadString();
             * Shipworld = stream.ReadUInt8Array();
             * //todo shipupgrades
             *
             *
             */
        }