Exemplo n.º 1
0
        public void _Show(Ability ability, Vector3 pos, int pivotCorner = 2, Vector3 offset = default(Vector3))
        {
            SetPivot(pivotCorner);

            labelName.text = ability.name;
            labelDesp.text = ability.desp;    labelDesp.enabled = true;

            if (AbilityManager.UseRscManagerForCost())
            {
                List <float> cost = ability.GetCostRsc();
                for (int i = 0; i < RscManager.GetResourceCount(); i++)
                {
                    rscItemList[i].imgMain.sprite = RscManager.GetRscIcon(i);
                    rscItemList[i].lbMain.text    = cost[i].ToString("f0");
                    rscItemList[i].SetActive(true);
                }
            }
            else
            {
                rscItemList[0].imgMain.sprite = AbilityDB.GetRscIcon();
                rscItemList[0].lbMain.text    = ability.GetCost().ToString("f0");
                for (int i = 1; i < RscManager.GetResourceCount(); i++)
                {
                    rscItemList[i].SetActive(false);
                }
            }

            minHeight = 120;

            rectT.position = pos + offset;

            canvasGroup.alpha = 1;
            thisObj.SetActive(true);
        }
Exemplo n.º 2
0
        //called when an ability is fired, reduce the energy, start the cooldown and what not
        public void ActivateAbility(Ability ab, Vector3 pos = default(Vector3))
        {
            ab.usedCount += 1;
            energy       -= ab.GetCost();
            StartCoroutine(ab.CooldownRoutine());

            CastAbility(ab, pos);

            if (onAbilityActivatedE != null)
            {
                onAbilityActivatedE(ab);
            }
        }
Exemplo n.º 3
0
        void ShowTooltip(Ability ability)
        {
            lbTooltipName.text = ability.name;
            lbTooltipDesp.text = ability.GetDesp();

            tooltipRscItem.label.text = ability.GetCost().ToString("f0");

            //~ List<int> cost=tower.GetCost();
            //~ for(int i=0; i<tooltipRscItemList.Count; i++){
            //~ tooltipRscItemList[i].label.text=cost[i].ToString();
            //~ }

            tooltipCanvasG.alpha = 1; tooltipObj.SetActive(true);
        }
Exemplo n.º 4
0
        //called when an ability is fired, reduce the energy, start the cooldown and what not
        public void ActivateAbility(Ability ab, Vector3 pos = default(Vector3), Unit unit = null)
        {
            energy -= ab.GetCost();
            ab.Activate(pos);

            //ab.CastEffectObject(pos);

            //CastAbility(ab, pos, unit);
            //if(ab.effectObj!=null)
            //	ObjectPoolManager.Spawn(ab.effectObj, pos, Quaternion.identity);

            if (ab.useDefaultEffect)
            {
                StartCoroutine(ApplyAbilityEffect(ab, pos, unit));
            }

            TDTK.OnAbilityActivated(ab);
        }
Exemplo n.º 5
0
		//called when an ability is fired, reduce the energy, start the cooldown and what not
		public void ActivateAbility(Ability ab, Vector3 pos=default(Vector3), Unit unit=null){
			ab.usedCount+=1;
			energy-=ab.GetCost();
			StartCoroutine(ab.CooldownRoutine());
			
			CastAbility(ab, pos, unit);
			
			if(onAbilityActivatedE!=null) onAbilityActivatedE(ab);
		}