コード例 #1
0
 public override void BuyAbility()
 {
     playerEnergyAbility = new BurstEnergy(abilityDataSet[2]);
     if (canTakeEnergy)
     {
         playerHealth.UpdateHealth(playerEnergyAbility.TotalUseAbility());
     }
     Invoke("DelayBuyAbility", 0.5f);
 }
コード例 #2
0
    private void SetAbility(string nameAbility)
    {
        PlayerAbility playerAbility = null;

        try
        {
            if (!nameAbility.Contains("Burst"))
            {
                if (nameAbility == simplePlayerPanelDataSet.NameButtons[0] && !isStartCoolDown[0])
                {
                    playerAbility      = new Damage(abilityDataSet[0], heroesInAttacked.abilityDataSet[0], idTurn, heroesInAttacked.idTurn);
                    isStartCoolDown[0] = true;
                    coolDown[0]        = 0;
                    if (idTurn == heroesInAttacked.idTurn)
                    {
                        playerAbility      = null;
                        heroesInAttacked   = null;
                        isStartCoolDown[0] = false;
                    }
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[1] && !isStartCoolDown[1])
                {
                    playerAbility      = new Shield(abilityDataSet[1]);
                    heroesInAttacked   = null;
                    isStartCoolDown[1] = true;
                    coolDown[1]        = 0;
                }
                this.playerAbility = playerAbility;
            }
            else
            {
                if (nameAbility == simplePlayerPanelDataSet.NameButtons[2] && !isStartCoolDown[2])
                {
                    if (abilityDataSet[2].CurrentLevel < abilityDataSet[2].CountLevelLimit)
                    {
                        playerAbility      = new BurstEnergy(abilityDataSet[2]);
                        isStartCoolDown[2] = true;
                        if (IsMain && abilityDataSet[2].CurrentLevel >= abilityDataSet[2].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[2].SetActive(false);
                        }
                    }
                    coolDown[2] = 0;
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[3])
                {
                    if (abilityDataSet[0].CurrentLevel < abilityDataSet[0].CountLevelLimit)
                    {
                        playerAbility = new Damage(abilityDataSet[0], idTurn);
                        if (IsMain && abilityDataSet[0].CurrentLevel >= abilityDataSet[0].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[3].SetActive(false);
                        }
                    }
                }
                else if (nameAbility == simplePlayerPanelDataSet.NameButtons[4])
                {
                    if (abilityDataSet[1].CurrentLevel < abilityDataSet[1].CountLevelLimit)
                    {
                        playerAbility = new Shield(abilityDataSet[1]);
                        if (IsMain && abilityDataSet[1].CurrentLevel >= abilityDataSet[1].CountLevelLimit - 1)
                        {
                            simplePlayerPanelDataSet.ButtonsAbilities[4].SetActive(false);
                        }
                    }
                }
                heroesInAttacked     = null;
                this.playerUpAbility = playerAbility;
            }
        }
        catch (System.NullReferenceException)
        {
            Debug.Log("Выбери цель с начала, а потом жми (Речь про дамажущую кнопочку)");
        }
        if (playerAbility != null)
        {
            SetCanMove(true);
            CountReadyHero++;
            onReadyHero?.Invoke();
        }
    }