Esempio n. 1
0
 public void Initialize(UpgradeType type)
 {
     _autoClickerType = type;
     SetSillhouette();
     SetButtonTextToCost(type);
     GetComponent<Button>().interactable = false;
 }
Esempio n. 2
0
 public Upgrade(UpgradeType type, Products target, string name, BigInteger price)
 {
     this.Type = type;
     this.Target = target;
     this.Name = name;
     this.Price = price;
 }
Esempio n. 3
0
    //For normal, building/vehicle upgrades
	public Upgrade(string newName,int newID, string newDescription, Sprite newIcon, float newPrice, 
	               float newMonthlyIncome, float newCarbonSavings, UpgradeType newUpgradeType, float newDuration, int newLevelRequired){
		upgradeName = newName;
		iD = newID;
		description = newDescription;
		icon = Resources.Load<Sprite>(newName);
		price = newPrice;
		monthlyIncome = newMonthlyIncome;
		carbonSavings = newCarbonSavings;
		upgradeType = newUpgradeType;
		duration = newDuration;
		levelRequired = newLevelRequired;
		unlocked = false;

        if (!UpgradeDatabase.bestCarbUpgrds.ContainsKey(newUpgradeType) || !UpgradeDatabase.bestIncomeUpgrds.ContainsKey(newUpgradeType))
        {
            UpgradeDatabase.bestCarbUpgrds.Add(newUpgradeType, this);
            UpgradeDatabase.bestIncomeUpgrds.Add(newUpgradeType, this);

        }
        else if (UpgradeDatabase.bestCarbUpgrds[newUpgradeType].carbonSavings < newCarbonSavings) //New upgrade has better carbon savings
        {
            UpgradeDatabase.bestCarbUpgrds[newUpgradeType] = this;
        }
        else if (UpgradeDatabase.bestCarbUpgrds[newUpgradeType].monthlyIncome < newMonthlyIncome) //New upgrade has better monthly income
        {
            UpgradeDatabase.bestIncomeUpgrds[newUpgradeType] = this;
        }
    }
 public BuyableGameObject(float price, UpgradeType type, string spriteName, Vector2 position)
     : base(spriteName)
 {
     this.price = price;
     this.type = type;
     base.position = position;
 }
Esempio n. 5
0
 public Tile()
 {
     x = 0.0f;
     y = 0.0f;
     _isIndestructible = false;
     _isDestructible = false;
     _isUpgrade = false;
     _upgradeType = UpgradeType.None;
 }
 //need some testing, UpgradingTypePostswitching method created as DRY on CodeReview
 /// <summary>
 /// Actions after succesfull upgrading type switching.
 /// </summary>
 /// <param name="upType">Up type.</param>
 /// <param name="unlimitedUpToConfig">Sets upgrading type</param>
 /// <param name="GBUnlimited">Sets Unlimited Group Box enabled or not</param>
 /// <param name="GBLimited">Sets Limited Group Box enabled or not.</param>
 private void UpgradingTypePostswitching(UpgradeType upType, bool unlimitedUpToConfig, bool GBUnlimited, bool GBLimited)
 {
   GBUpType.Tag = (int)upType;
   TowerConfig.UpgradeParams.RemoveRange(1, TowerConfig.UpgradeParams.Count - 1);
   GBLimitedUp.Text = Resources.LimitedUpgradeDefaultTitle;
   CurrentUpLevel = -1;
   TowerConfig.UnlimitedUp = unlimitedUpToConfig;
   GBUnlimitedUp.Enabled = GBUnlimited;
   GBLimitedUp.Enabled = GBLimited;
 }
        /// <summary>
        /// Begins an asychronous operation to change the configuration of a deployment.
        /// </summary>
        /// <param name="cloudServiceName">The name of the cloud service which contains the deployment with the configuration to be changed. Required.</param>
        /// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment with the configuration to be changed.</param>
        /// <param name="configFilePath">The local file path to the Azure deployment configuration file (.cscfg) defining the deployment. Required.</param>
        /// <param name="treatWarningsAsError">Set to true to treat configuation warnings as errors and fail the configuration change. Default is false.</param>
        /// <param name="mode">The <see cref="UpgradeType"/> value indicating whether the configuation change should happen automatically (<see cref="UpgradeType.Auto"/> or
        /// manually (<see cref="UpgradeType.Manual"/>. If set to <see cref="UpgradeType.Manual"/>, you must subsequently call <see cref="WalkUpgradeDomainAsync"/> to
        /// control the configuration change across the deployment.</param>
        /// <param name="extendedProperties">An optional <see cref="IDictionary{String, String}"/> that contains Name Value pairs representing user defined metadata for the deployment.</param>
        /// <param name="token">An optional <see cref="CancellationToken"/>.</param>
        /// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
        /// <remarks>ChangeDeploymentConfigurationAsync is a long-running asynchronous operation. When the Task representing ChangeDeploymentConfigurationAsync is complete,
        /// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
        /// the long-running operation use the operation Id returned from the ChangeDeploymentConfigurationAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
        /// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
        public Task<string> ChangeDeploymentConfigurationAsync(string cloudServiceName, DeploymentSlot slot, string configFilePath, bool treatWarningsAsError = false, UpgradeType mode = UpgradeType.Auto, IDictionary<string, string> extendedProperties = null, CancellationToken token = default(CancellationToken))
        {
            Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");

            //this validates the other parameters...
            ChangeDeploymentConfigurationInfo info = ChangeDeploymentConfigurationInfo.Create(configFilePath, treatWarningsAsError, mode, extendedProperties);

            HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotChangeConfig, cloudServiceName, slot.ToString()), info);

            return StartSendTask(message, token);
        }
Esempio n. 8
0
    //For multiplier/bonus upgrades
	public Upgrade(string newName, int newID, string newDescription, Sprite newIcon, float newPriceX, float newIncomeX, float newCarbonX, float newDurationX, UpgradeType newUpgradeType) {
		upgradeName = newName;
		iD = newID;
		description = newDescription;
		icon = newIcon;
		priceX = newPriceX; 
		incomeX = newIncomeX;
		carbonX = newCarbonX;
		durationX = newDurationX;
		upgradeType = newUpgradeType;
		unlocked = false;
	}
Esempio n. 9
0
 public IPromise UpgradeIfCan(UpgradeType type)
 {
     Promise promise = new Promise();
     if (IsUpgradeInProgress())
         promise.Reject(new UpgradeInProgressException());
     else if (isMaxUpgrade(type))
         promise.Reject(new MaxUpgradeException());
     else if (!currencyService.CanBePurchased(getNexUpgradeCost(type)))
         promise.Reject(new NotEnoughCoinsException());
     else
     {
         startUpgrade(type);
         promise.Resolve();
     }
     return promise;
 }
 public static IUpgrade GetUpgrade(UpgradeType upgrade)
 {
     switch (upgrade)
     {
         case UpgradeType.Bomb:
             return new UpgradeBomb();
         case UpgradeType.Laser:
             return new UpgradeLaser();
         case UpgradeType.Line:
             return new UpgradeBombLine();
         case UpgradeType.Kick:
             return new UpgradeKick();
         case UpgradeType.Radioactive:
             return new UpgradeRadioactive();
         case UpgradeType.None:
         default:
             Debug.LogError(upgrade + " is not a supported upgrade type");
             return null;
     }
 }
Esempio n. 11
0
 void applyUpgrade(ShipModelComponent model, UpgradeType key, float bonus)
 {
     switch (key)
     {
         case UpgradeType.Health:
             model.health += (int)bonus;
             break;
         case UpgradeType.LaserDamage:
             model.hasLaser = true;
             model.laserDamage += (int)bonus;
             break;
         case UpgradeType.MagnetRadius:
             model.hasMagnetField = true;
             model.magnetRadius += bonus;
             break;
         case UpgradeType.MissileDamage:
             model.missileDamage += (int)bonus;
             break;
         case UpgradeType.MissileSpawnDelay:
             model.missileSpawnDelay -= bonus;
             break;
         case UpgradeType.MissileSpeed:
             model.missileVelocity += bonus;
             break;
         case UpgradeType.SecondaryMisileSpawnDelay:
             model.hasSecondaryMissiles = true;
             model.secondaryMissileSpawnDelay -= bonus;
             break;
         case UpgradeType.SecondaryMissileDamage:
             model.hasSecondaryMissiles = true;
             model.secondaryMissileDamage += (int)bonus;
             break;
         case UpgradeType.SecondaryMissileSpeed:
             model.hasSecondaryMissiles = true;
             model.secondaryMissileVelocity += bonus;
             break;
         case UpgradeType.Speed:
             model.maxVelocity += bonus;
             break;
     }
 }
        internal static ChangeDeploymentConfigurationInfo Create(string configFilePath, bool treatWarningsAsError, UpgradeType mode, IDictionary<string, string> extendedProperties)
        {
            Validation.ValidateStringArg(configFilePath, "configuration");
            Validation.ValidateExtendedProperties(extendedProperties);
            if (!File.Exists(configFilePath)) throw new FileNotFoundException(string.Format(Resources.ConfigFileNotFound, configFilePath), configFilePath);

            string configText = File.ReadAllText(configFilePath);

            ExtendedPropertyCollection collection = null;
            if (extendedProperties != null)
            {
                collection = new ExtendedPropertyCollection(extendedProperties);
            }

            return new ChangeDeploymentConfigurationInfo
            {
                Configuration = configText.EncodeBase64(),
                TreatWarningsAsError = treatWarningsAsError,
                Mode = mode,
                ExtendedProperties = collection
            };
        }
Esempio n. 13
0
 public int? GetCost(UpgradeType type)
 {
     if (Upgrades[(int)type] == Upgrade.None)
     {
         return 100;
     }
     else if (Upgrades[(int)type] == Upgrade.One)
     {
         return 200;
     }
     else if (Upgrades[(int)type] == Upgrade.Two)
     {
         return 300;
     }
     else if (Upgrades[(int)type] == Upgrade.Three)
     {
         return 400;
     }
     else if (Upgrades[(int)type] == Upgrade.Four)
     {
         return 500;
     }
     else return null;
 }
Esempio n. 14
0
 public StrengthUpgrade(IGun toUpgrade, int strength, UpgradeType type)
     : base(toUpgrade, type)
 {
     this.strength = strength;
 }
Esempio n. 15
0
		// ^ Skill check ^

		/// <summary>
		/// Initializes upgrade effect, setting required default values.
		/// You should generally use this constructor!
		/// </summary>
		/// <param name="type"></param>
		public UpgradeEffect(UpgradeType type)
		{
			Type = type;
			Unk1 = 0;
			Unk2 = 0;
			Stat = 0;
			ValueType = 0;
			Value = 0;
			SkillId = 0;
			SkillVar = 0;
			Unk4 = 0x0A;
			Unk5 = 0;
			CheckType = UpgradeCheckType.None;
			CheckStat = 0;
			CheckRace = 0;
			CheckPtj = 0;
			CheckMonth = 0;
			CheckBroken = false;
			CheckTitleId = 0;
			CheckCondition = 0;
			CheckValueType = 0;
			CheckValue = 0;
			CheckSkillId = 0;
			CheckSkillRank = 0;
		}
Esempio n. 16
0
 public EffectUpgrade(IGun toUpgrade, Effects newEffects, bool keepExistingEffects, UpgradeType type)
     : base(toUpgrade, type)
 {
     this.newEffects          = newEffects;
     this.keepExistingEffects = keepExistingEffects;
 }
Esempio n. 17
0
 public PremiumUpgrade(UpgradeType ty, BigInteger upgradeCost, string dispName, string saveName) : base(ty, upgradeCost, dispName, saveName)
 {
 }
Esempio n. 18
0
 public override bool isUpgrading(UpgradeType upgrade) {
   bool ret = bwapiclientPINVOKE.PlayerImpl_isUpgrading(swigCPtr, UpgradeType.getCPtr(upgrade));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
        /// <summary>
        /// Begins an asychronous operation to upgrade a deployment.
        /// </summary>
        /// <param name="cloudServiceName">The name of the cloud service which contains the deployment to be upgraded. Required.</param>
        /// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment to be upgraded.</param>
        /// <param name="mode">The <see cref="UpgradeType"/> value indicating whether the ugrade should happen automatically (<see cref="UpgradeType.Auto"/> or
        /// manually (<see cref="UpgradeType.Manual"/>. If set to <see cref="UpgradeType.Manual"/>, you must subsequently call <see cref="WalkUpgradeDomainAsync"/> to
        /// control the upgrade across the deployment.</param>
        /// <param name="packageUrl">The <see cref="Uri"/> representing the location of the azure deployment package (.cspkg) to be deployed.
        /// The service package can be located either in a storage account beneath the same subscription or a Shared Access Signature (SAS) URI from any storage account. 
        /// For more info about Shared Access Signatures, see <see href="http://msdn.microsoft.com/en-us/library/windowsazure/ee395415">Using a Shared Access Signature (REST API)</see>. Required.
        /// </param>
        /// <param name="configFilePath">The local file path to the Azure deployment configuration file (.cscfg) defining the deployment. Required.</param>
        /// <param name="label">The label for the deployment, may be up to 100 characters in length. Required.</param>
        /// <param name="roleToUpgrade">The name of a specific role to upgrade. Optional.</param>
        /// <param name="treatWarningsAsError">Specifies whether to treat package validation warnings as errors and fail the upgrade. Default is false.</param>
        /// <param name="force">Specifies whether the upgrade should proceed even when it will cause local data to be lost from some role instances. Default is false.</param>
        /// <param name="extendedProperties">An optional <see cref="IDictionary{String, String}"/> that contains Name Value pairs representing user defined metadata for the service.</param>
        /// <param name="token">An optional <see cref="CancellationToken"/>.</param>
        /// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
        /// <remarks>UpgradeDeploymentAsync is a long-running asynchronous operation. When the Task representing UpgradeDeploymentAsync is complete,
        /// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
        /// the long-running operation use the operation Id returned from the UpgradeDeploymentAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
        /// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
        public Task<string> UpgradeDeploymentAsync(string cloudServiceName, DeploymentSlot slot, UpgradeType mode, Uri packageUrl, string configFilePath, string label, string roleToUpgrade = null, bool treatWarningsAsError = false, bool force = false, IDictionary<string, string> extendedProperties = null, CancellationToken token = default(CancellationToken))
        {
            Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");

            //this validates the other parameters...
            UpgradeDeploymentInfo info = UpgradeDeploymentInfo.Create(mode, packageUrl, configFilePath, label, roleToUpgrade, treatWarningsAsError, force, extendedProperties);

            HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotUpgrade, cloudServiceName, slot.ToString()), info);

            return StartSendTask(message, token);
        }
Esempio n. 20
0
 public UpgradeSaveData(Upgrade upgrade)
 {
     type         = upgrade.type;
     currentLevel = upgrade.currentLevel;
 }
Esempio n. 21
0
 public virtual bool upgrade(UpgradeType upgrade) {
   bool ret = bwapiPINVOKE.Unit_upgrade(swigCPtr, UpgradeType.getCPtr(upgrade));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public void SetActiveAuraType(UpgradeType auraType)
 {
     activeAura = auraType;
 }
 public void SetActiveAuraTypeAndSave(UpgradeType auraType)
 {
     activeAura = auraType;
     SaveLoad.Save();
 }
Esempio n. 24
0
 public UpgradeResult(UpgradeType upgradeType, string comment, string upgradeUrl)
 {
     CurrentUpgradeType = upgradeType;
     Comment            = comment;
     UpgradeUrl         = upgradeUrl;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ModdedUpgradeRepresenter"/> class
 /// </summary>
 /// <param name="type">The <see cref="global::UpgradeType"/> to store</param>
 /// <param name="level">The level of the upgrade to store</param>
 public ModdedUpgradeRepresenter(UpgradeType type, int level)
 {
     UpgradeType = type;
     Level       = level;
 }
Esempio n. 26
0
 /// <summary>
 /// Checks whether or not the given <see cref="UpgradeType"/> and level is already in use by an <see cref="UpgradeDescription"/>
 /// </summary>
 /// <param name="upgradeManager"></param>
 /// <param name="ID">The ID of the upgrade</param>
 /// <param name="Level"></param>
 /// <returns></returns>
 public static bool IsUpgradeTypeAndLevelUsed(this UpgradeManager upgradeManager, UpgradeType ID, int Level = 1)
 {
     return(UpgradeManager.Instance.GetUpgrade(ID, Level) != null);
 }
Esempio n. 27
0
 public static int Get(UpgradeType u)
 {
     if (!UpgradeLevel.ContainsKey(u)) return 0;
     return UpgradeLevel[u];
 }
Esempio n. 28
0
        private UpgradeAction ParseUpgradeAction()
        {
            UpgradeType upgrade = (UpgradeType)_input.ReadByte();

            return(new UpgradeAction(sequence, frame, player, upgrade));
        }
Esempio n. 29
0
 public virtual int getUpgradeLevel(UpgradeType upgrade) {
   int ret = bwapiPINVOKE.Unit_getUpgradeLevel(swigCPtr, UpgradeType.getCPtr(upgrade));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 30
0
        // 班級升級
        private void UpgradeDGClassItem(UpgradeType ut)
        {
            // 對所選擇的 Row 判斷
            foreach (DataGridViewRow dgv in dgClassUpgrade.SelectedRows)
            {
                int defGrYear, upgradeGrYear, defClassYear;

                string ClassName = "", newClassName = "", ClassNamingRule = "";
                ClassName       = dgv.Cells[2].Value.ToString();
                ClassNamingRule = "" + dgv.Cells[6].Value;

                if (ut == UpgradeType.升級)
                {
                    bool checkNew = true;

                    if (dgv.Cells[5].Value != null)
                    {
                        if (dgv.Cells[5].Value.ToString() == "升級")
                        {
                            dgv.Cells[3].Value = "";
                            dgv.Cells[4].Value = "";
                            dgv.Cells[5].Value = "";
                            foreach (DataGridViewCell dd in dgv.Cells)
                            {
                                dd.Style.BackColor = Color.White;
                            }
                            checkNew = false;
                        }
                    }

                    if (checkNew == true)
                    {
                        int.TryParse(dgv.Cells[1].Value.ToString(), out defGrYear);
                        string strUpgradeGrYear;
                        upgradeGrYear      = defGrYear + 1;
                        dgv.Cells[3].Value = strUpgradeGrYear = upgradeGrYear.ToString();

                        // 檢查是否有命名規則
                        bool checkClassNamingRule = UpgradeClassDAL.ValidateNamingRule(ClassNamingRule);

                        if (checkClassNamingRule == true)
                        {
                            // 使用預設命名規則
                            newClassName       = UpgradeClassDAL.ParseClassName(ClassNamingRule, upgradeGrYear);
                            dgv.Cells[4].Value = newClassName;
                        }
                        else
                        {
                            // 沒有命名規則
                            newClassName = ClassName;
                            if (upgradeGrYear > 10)
                            {
                                newClassName = strUpgradeGrYear + ClassName.Substring(2, (ClassName.Length - 2));
                            }
                            else
                            {
                                newClassName = strUpgradeGrYear + ClassName.Substring(1, (ClassName.Length - 1));
                            }

                            dgv.Cells[4].Value = newClassName;
                        }
                        dgv.Cells[5].Value = "升級";
                        foreach (DataGridViewCell dd in dgv.Cells)
                        {
                            dd.Style.BackColor = Color.Yellow;
                        }
                    }
                }

                if (ut == UpgradeType.畢業)
                {
                    bool checkNew = true;

                    if (dgv.Cells[5].Value != null)
                    {
                        if (dgv.Cells[5].Value.ToString() == "畢業")
                        {
                            dgv.Cells[3].Value = "";
                            dgv.Cells[4].Value = "";
                            dgv.Cells[5].Value = "";
                            foreach (DataGridViewCell dd in dgv.Cells)
                            {
                                dd.Style.BackColor = Color.White;
                            }
                            checkNew = false;
                        }
                    }

                    if (checkNew == true)
                    {
                        dgv.Cells[3].Value = "";
                        dgv.Cells[4].Value = txtSchoolYear.Text + ClassName;
                        dgv.Cells[5].Value = "畢業";
                        foreach (DataGridViewCell dd in dgv.Cells)
                        {
                            dd.Style.BackColor = Color.LightCyan;
                        }
                    }
                }

                if (ut == UpgradeType.恢復)
                {
                    dgv.Cells[3].Value = "";
                    dgv.Cells[4].Value = "";
                    dgv.Cells[5].Value = "";
                    foreach (DataGridViewCell dd in dgv.Cells)
                    {
                        dd.Style.BackColor = Color.White;
                    }
                }
            }
        }
    void Upgrade(Weapon weapon, UpgradeType type, float amtToAdd)
    {
        ScrapManager s = GameObject.Find("scrapCountLabel").GetComponent<ScrapManager>();

        if (s.Scrap >= weapon.costToUpgrade)
        {
            if (weapon.tier < weapon.maxTier)
            {
                s.Scrap -= weapon.costToUpgrade;
                ++weapon.tier;
                //weapon.costToUpgrade += 20;
                //print(weapon.tier);
                string typeOfUpgrade = string.Empty;

                switch (type)
                {
                    case UpgradeType.FireRate:
                        {
                            weapon.fireRate += amtToAdd;
                            typeOfUpgrade = "Firerate";
                            break;
                        }
                    case UpgradeType.Damage:
                        {
                            weapon.damage += amtToAdd;
                            typeOfUpgrade = "Damage";
                            break;
                        }
                    case UpgradeType.Accuracy:
                        {
                            if (weapon.spread > 1.0f)
                            {
                                weapon.spread -= amtToAdd; //subtract
                            }

                            typeOfUpgrade = "Accuracy";
                            break;
                        }
                    default:
                        {
                            typeOfUpgrade = "Unknown UpgradeType";
                            break;
                        }
                }

                upgradeMenu.GetComponent<AudioSource>().clip = upgradeSound;
                upgradeMenu.GetComponent<AudioSource>().Play();

                //  descText.text = typeOfUpgrade + " + " + amtToAdd.ToString().Replace("-", "");
            }

            else
            {
                //descText.text = "Weapon has been fully upgraded!";
            }

        }
        else
        {
            //descText.text = "Insufficient funds";
        }
    }
Esempio n. 32
0
 public abstract string UpgradeTypeToXws(UpgradeType faction);
 /// <summary>
 /// Returns true if there is enough resources required to upgrade the given tech type.
 /// </summary>
 /// <returns></returns>
 public static bool CanUpgrade(UpgradeType upgradeType) {
     return SWIG.BWAPI.bwapi.Broodwar.canUpgrade(null, upgradeType.BwapiObject);
 }
Esempio n. 34
0
 public int GetUpgradeLevel(UpgradeType type)
 {
     return(UpgradeLevels[(int)type]);
 }
Esempio n. 35
0
 public static UnitCommand upgrade(Unit unit, UpgradeType upgrade) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_upgrade(Unit.getCPtr(unit), UpgradeType.getCPtr(upgrade)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 36
0
    public static void addUpgrade(float basePrice, float exponentialCost, string upgradeText, string effectText, UpgradeType upgradeType, int maxLevel, int currentLevel)
    {
        Upgrade    upgrade = new Upgrade(basePrice, exponentialCost, upgradeText, effectText, upgradeType, maxLevel, currentLevel);
        GameObject btn     = GameObject.Instantiate(upgradeButton);

        upgrade.setButton(btn);
        btn.GetComponentInChildren <Text>().text = "ffs";
        btn.transform.parent = scrollViewContent.transform;



        currentY += (margin + buttonHeight);
        scrollViewContent.GetComponent <RectTransform>().sizeDelta = new Vector2(0, currentY);
        btn.transform.localPosition = new Vector3(0, -currentY);



        upgrades.Add(upgrade);
    }
Esempio n. 37
0
        public UpgradeCardInfo(
            string name,
            UpgradeType type         = UpgradeType.None,
            List <UpgradeType> types = null,
            int cost         = 0,
            bool isLimited   = false,
            bool isSolitary  = false,
            int limited      = 0,
            Type abilityType = null,
            UpgradeCardRestriction restriction   = null,
            UpgradeCardRestrictions restrictions = null,
            int charges                    = 0,
            bool regensCharges             = false,
            bool cannotBeRecharged         = false,
            int seImageNumber              = 0,
            SpecialWeaponInfo weaponInfo   = null,
            ShipArcInfo addArc             = null,
            ActionInfo addAction           = null,
            List <ActionInfo> addActions   = null,
            LinkedActionInfo addActionLink = null,
            UpgradeSlot addSlot            = null,
            List <UpgradeSlot> addSlots    = null,
            bool feIsLimitedPerShip        = false,
            UpgradeType forbidSlot         = UpgradeType.None,
            List <UpgradeType> forbidSlots = null,
            Dictionary <UpgradeType, int> costReductionByType = null,
            int addShields         = 0,
            int addHull            = 0,
            int addForce           = 0,
            UpgradeSubType subType = UpgradeSubType.None,
            Type remoteType        = null
            )
        {
            Name              = name;
            Cost              = cost;
            Charges           = charges;
            RegensCharges     = regensCharges;
            CannotBeRecharged = cannotBeRecharged;
            SEImageNumber     = seImageNumber;
            WeaponInfo        = weaponInfo;
            AddActionLink     = addActionLink;
            IsSolitary        = isSolitary;

            AbilityTypes = new List <Type>();
            if (abilityType != null)
            {
                AbilityTypes.Add(abilityType);
            }

            Limited = (isLimited) ? 1 : 0;
            if (limited != 0)
            {
                Limited = limited;
            }

            FeIsLimitedPerShip = feIsLimitedPerShip;

            UpgradeTypes = new List <UpgradeType>();
            if (type != UpgradeType.None)
            {
                UpgradeTypes.Add(type);
            }
            if (types != null)
            {
                UpgradeTypes.AddRange(types);
            }

            Restrictions = new UpgradeCardRestrictions();
            if (restriction != null)
            {
                Restrictions = new UpgradeCardRestrictions(restriction);
            }
            if (restrictions != null)
            {
                Restrictions = restrictions;
            }

            AddedSlots = new List <UpgradeSlot>();
            if (addSlot != null)
            {
                AddedSlots.Add(addSlot);
            }
            if (addSlots != null)
            {
                AddedSlots.AddRange(addSlots);
            }

            AddedActions = new List <ActionInfo>();
            if (addAction != null)
            {
                AddedActions.Add(addAction);
            }
            if (addActions != null)
            {
                AddedActions.AddRange(addActions);
            }

            ForbiddenSlots = new List <UpgradeType>();
            if (forbidSlot != UpgradeType.None)
            {
                ForbiddenSlots.Add(forbidSlot);
            }
            if (forbidSlots != null)
            {
                ForbiddenSlots.AddRange(forbidSlots);
            }

            CostReductionByType = new Dictionary <UpgradeType, int>();
            if (costReductionByType != null)
            {
                CostReductionByType = costReductionByType;
            }

            AddHull    = addHull;
            AddShields = addShields;
            AddForce   = addForce;

            AddArc = addArc;

            SubType    = subType;
            RemoteType = remoteType;
        }
Esempio n. 38
0
 public Upgrade(float basePrice, float exponentialCost, string upgradeText, string effectText, UpgradeType upgradeType, int maxLevel, int currentLevel)
 {
     this.basePrice   = basePrice;
     exp              = exponentialCost;
     this.maxLevel    = maxLevel;
     this.upgradeText = upgradeText;
     this.effectText  = effectText;
     this.upgradeType = upgradeType;
     this.level       = currentLevel;
 }
Esempio n. 39
0
 /// <summary>
 /// Allows the upgrade to execute
 /// </summary>
 /// <param name="newUpgrade"></param>
 public void EnableUpgrade(UpgradeType ut)
 {
     upgradeLibrary[ut].enabled = true;
 }
Esempio n. 40
0
 public UpgradeSlotPanel(GenericUpgrade upgrade, UpgradeType slotType, GameObject panel)
 {
     Upgrade  = upgrade;
     SlotType = slotType;
     Panel    = panel;
 }
Esempio n. 41
0
    private void ShowInventoryChip()
    {
        myInventoryChipsObject.SetActive(true);

        for (int i = 0; i < myInventoryChipsPanel.childCount; i++)
        {
            Destroy(myInventoryChipsPanel.GetChild(i).gameObject);
        }

        UpgradeType typeSeached = UpgradeType.TYPEA;

        if (myUpgradeCategoryIndex == 1)
        {
            typeSeached = UpgradeType.TYPEB;
        }
        else if (myUpgradeCategoryIndex == 2)
        {
            typeSeached = UpgradeType.TYPEC;
        }
        else if (myUpgradeCategoryIndex == 3)
        {
            typeSeached = UpgradeType.TYPED;
        }

        for (int i = 0; i < myUpgradesInventory.Count; i++)
        {
            if (myUpgradesInventory[i] != null && myUpgradesInventory[i].GetMyType() == typeSeached)
            {
                myIsReplacing = true;
                Transform t = Instantiate(myInventoryChipsItemPrefab, myInventoryChipsPanel);
                if (myUpgradeCategoryIndex == 0)
                {
                    t.GetComponent <Image>().sprite = myTypeASprite;
                }
                else if (myUpgradeCategoryIndex == 1)
                {
                    t.GetComponent <Image>().sprite = myTypeBSprite;
                }
                else if (myUpgradeCategoryIndex == 2)
                {
                    t.GetComponent <Image>().sprite = myTypeCSprite;
                }
                else if (myUpgradeCategoryIndex == 3)
                {
                    t.GetComponent <Image>().sprite = myTypeDSprite;
                }
                if (myCurrentUpgradeReplaceSelected == null)
                {
                    myCurrentUpgradeReplaceSelected          = myUpgradesInventory[i];
                    myCurrentUpgradeReplaceTransformSelected = t;
                    myCurrentUpgradeReplaceTransformSelected.GetChild(0).gameObject.SetActive(true);
                    myUpgradeReplaceIndex = i;

                    myReplaceChipDescriptionObject.SetActive(true);

                    myReplaceChipNameText.text = myCurrentUpgradeReplaceSelected.GetName();
                    myReplaceChipDescText.text = myCurrentUpgradeReplaceSelected.GetDescription();
                    myReplaceChipHeatText.text = myCurrentUpgradeReplaceSelected.GetHeat().ToString();
                    myReplaceChipWattText.text = myCurrentUpgradeReplaceSelected.GetWatt().ToString();
                }
            }
        }
    }
 public void Upgrade(UpgradeType upgrade, float duration)
 {
     Upgrade(upgrade);
     Invoke(nameof(UpgradeDestroy), duration);
 }
Esempio n. 43
0
		/// <summary>
		/// Changes effect's type.
		/// </summary>
		/// <param name="type"></param>
		public void SetType(UpgradeType type)
		{
			Type = type;
		}
 public void StartCutscene(UpgradeType upgrade, float duration)
 {
     StartCutscene();
     Upgrade(upgrade, duration);
 }
Esempio n. 45
0
 private void ChangePts(UpgradeType upgrade, int amount)
 {
     if (upgrader.AvailablePoints >= amount)
     {
         upgrader.ChangePts(upgrade, amount);
         upgrader.AvailablePoints -= amount;
     }
     UpdatePanel();
 }
Esempio n. 46
0
 private int CountUpgradeIcons(UpgradeType upgradeType)
 {
     return(Ship.ShipInfo.UpgradeIcons.Upgrades.Count(n => n == upgradeType) + Ship.PilotInfo.ExtraUpgrades.Count(n => n == upgradeType));
 }
Esempio n. 47
0
 public virtual UpgradeType getUpgrade() {
   UpgradeType ret = new UpgradeType(bwapiPINVOKE.Unit_getUpgrade(swigCPtr), true);
   return ret;
 }
 private bool ShipHasUpgradeIcon(UpgradeType upgradeType)
 {
     return(Ship.ShipInfo.UpgradeIcons.Upgrades.Contains(upgradeType) || Ship.PilotInfo.ExtraUpgrades.Contains(upgradeType));
 }
Esempio n. 49
0
 public override UpgradeType getUpgrade() {
   UpgradeType ret = new UpgradeType(bwapiclientPINVOKE.UnitImpl_getUpgrade(swigCPtr), true);
   return ret;
 }
Esempio n. 50
0
 public void Upgrade(float value, UpgradeType type)
 {
     gameManager.Upgrade(value, type);
     SoundPlayer.main.PlaySound(GameSoundType.ShopUpgrade);
 }
 public WeaponUpgrade(UpgradeType type, string description, float ammount, int cost)
 {
     this.type = type;
     this.description = description;
     this.ammount = ammount;
     this.Cost = cost;
 }
        public UpgradeType armorUpgrade()
        {
            UpgradeType ret = new UpgradeType(bwapiPINVOKE.UnitType_armorUpgrade(swigCPtr), true);

            return(ret);
        }
Esempio n. 53
0
 public override int getMaxUpgradeLevel(UpgradeType upgrade) {
   int ret = bwapiclientPINVOKE.PlayerImpl_getMaxUpgradeLevel(swigCPtr, UpgradeType.getCPtr(upgrade));
   if (bwapiclientPINVOKE.SWIGPendingException.Pending) throw bwapiclientPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public UpgradePresentRestriction(UpgradeType upgradeSlot)
 {
     UpgradeSlot = upgradeSlot;
 }
 /// <summary>
 /// Returns true if the given unit can upgrade the given upgrade type and there is enough resources required to upgrade.
 /// </summary>
 /// <param name="unitWhereToUpgrade"></param>
 /// <param name="upgradeType"></param>
 /// <returns></returns>
 public static bool CanUpgrade(Unit unitWhereToUpgrade, UpgradeType upgradeType) {
     return SWIG.BWAPI.bwapi.Broodwar.canUpgrade(unitWhereToUpgrade.BwapiObject, upgradeType.BwapiObject);
 }
Esempio n. 56
0
 public void ApplyUpgrade(UpgradeType upgradeType)
 {
     _upgradeBehaviours.UpgradeAct(upgradeType);
 }
 private void getLevelSelectVariables()
 {
     element     = levelSelect.element;
     upgradeType = levelSelect.upgradeType;
     material    = levelSelect.material;
 }
Esempio n. 58
0
 public bool HasType(UpgradeType upgradeType)
 {
     return(UpgradeTypes.Contains(upgradeType));
 }
Esempio n. 59
0
 public UpgradeType getUpgradeType() {
   UpgradeType ret = new UpgradeType(bwapiPINVOKE.UnitCommand_getUpgradeType(swigCPtr), true);
   return ret;
 }
Esempio n. 60
0
 public void WeaponUpgradeCollected(UpgradeType upgradeType)
 {
     playerWeaponUpgrades.Add(upgradeType);
     gameController.playerControl.UpgradePlayerWeapon(upgradeType);
 }