public void SellWeapon()
 {
     if (!saleInitiated)
     {
         saleInitiated = true;
         this.buttons["W"].GetComponent <Image>().sprite = sellConfirmSprite;
     }
     else
     {
         if (connectedZone)
         {
             int worth = (turret.costCurrency) / 2;  //sell for half of purchase cost
             GameManager.Instance.PlayerCurrencyTransaction(worth);
             currentWeaponUpgradeSprite.sprite = null;
             connectedZone.Clear();
             connectedZone.CloseOut();
         }
     }
 }
Esempio n. 2
0
    public void BuildSelectedObject(GameObject obj)
    {
        if (connectedZone == null)
        {
            Destroy(gameObject);
            return;
        }

        Input.ResetInputAxes();

        int cost = (int)TurretUpgradeInfo.GetData(obj.GetComponent <Turret>(), TurretField.Cost);

        if (GameManager.Instance.GetPlayerTotalCurrency() >= cost)
        {
            GameManager.Instance.PlayerCurrencyTransaction(-cost);
            GameObject weap = Instantiate(obj, connectedZone.transform.position, Quaternion.identity) as GameObject;

            Turret t = weap.GetComponent <Turret>();

            connectedZone.currentState  = BuildZone.ZONE_STATE.BUILT_ON;
            connectedZone.currentWeapon = weap;
            connectedZone.CloseOut();
        }
    }
Esempio n. 3
0
 public void HideRadialMenu()
 {
     lastBuildZoneClicked.CloseOut();
     lastBuildZoneClicked = null;
 }