コード例 #1
0
    /// <summary>
    /// Muestra las habilidades disponibles del jugador.
    /// </summary>
    public void SetPlayerHabilities()
    {
        if (inInventory)
        {
            return;
        }

        habilitiesText.Clear();

        habilitiesText.Add("[0] Atacar");
        for (int i = 0; i < player.characteristics.playerJob.unlockedHabilities.Count; i++)
        {
            Hability currentHability = player.characteristics.playerJob.unlockedHabilities[i];

            if (currentHability.isAvailable)
            {
                habilitiesText.Add("[0." +
                                   currentHability.jobIdentifier + "." +
                                   currentHability.habilityID + "] " +
                                   TextConverter.MakeFirstLetterUpper(currentHability.habilityName));
            }
            else
            {
                habilitiesText.Add("<color=#696969>" +
                                   "[0." +
                                   currentHability.jobIdentifier + "." +
                                   currentHability.habilityID + "] " +
                                   TextConverter.MakeFirstLetterUpper(currentHability.habilityName) +
                                   ". . . . . . " +
                                   "</color>");
            }
        }

        playerUI.habilitiesText.text = string.Join("\n", habilitiesText.ToArray());
    }
コード例 #2
0
 public IActionResult Post([FromBody] Hability model)
 {
     if (ModelState.IsValid)
     {
         _hablility.Add(model);
         return(new CreatedAtRouteResult("createdHability", new { id = model.Id }, model));
     }
     return(BadRequest("Some fields are empty"));
 }
コード例 #3
0
 public IActionResult Put([FromBody] Hability model)
 {
     if (model.Id > 0 && model.Title != null)
     {
         return(Ok(_hablility.Update(model)));
     }
     else
     {
         return(BadRequest("Some fields are empty"));
     }
 }
コード例 #4
0
ファイル: Person.cs プロジェクト: WHorn712/gitProjectNCE
 public Person(char s, int id, int r)
 {
     sexo     = s;
     idade    = id;
     registro = r;
     DecididIdadeDie();
     habiliti = new Hability();
     if (s == 'F')
     {
         quantSon = Random.Range(0, 8);
     }
 }
コード例 #5
0
 public bool Add(Hability entity)
 {
     try
     {
         entity.CreatedAt = _dateTime;
         _dbContext.Add(entity);
         _dbContext.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #6
0
    public int ReturnCost(string name)
    {
        Hability h = Array.Find(habilities, hability => hability.name == name);

        if (h == null)
        {
            h = Array.Find(defenses, defense => defense.name == name);
            if (h == null)
            {
                Debug.LogWarning(name + " not found.");
                return(0);
            }
        }
        return(h.cost);
    }
コード例 #7
0
        public Hability GetById(int id)
        {
            var result = new Hability();

            try
            {
                result = _dbContext.Habilities.First(x => x.Id == id);
            }
            catch (Exception)
            {
                result = null;
            }

            return(result);
        }
コード例 #8
0
        public bool Update(Hability entity)
        {
            try
            {
                var model = _dbContext.Habilities.First(x => x.Id == entity.Id);
                model.Title       = entity.Title;
                model.UpdateAt    = _dateTime;
                model.Description = entity.Description;

                _dbContext.Habilities.Update(model);
                _dbContext.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #9
0
    // Muda a habilidade do player.
    public void SetHability(string hability)
    {
        for (int i = 0; i < habilities.Count; i++)
        {
            if (habilities[i]._name == hability)  // Encontra na lista a habilidade desejada.

            {
                currentHability = habilities[i];

                // (NÃO IMPLEMENTADO) <<<<------------ Resto das coisas que devêm acontecer

                effects.habilityEffect.sprite = currentHability.displayEffect;

                return;
            }
        }

        // Mostra um erro caso a habilidade seja inválida,
        Debug.LogError("(Player) Hability <+" + hability + "+> is not valid!");
    }
コード例 #10
0
    public void SetIconToDefenseSlot(string name)
    {
        Hability d = Array.Find(defenses, defense => defense.name == name);

        if (d == null)
        {
            Debug.LogWarning(name + " not found.");
            return;
        }
        if (d.cost > gc.player.cash)
        {
            return;
        }
        foreach (RawImage slot in defenseSlots)
        {
            if (!slot.gameObject.activeSelf || slot.gameObject.GetComponent <SlotInfo>().content == d.name)
            {
                SlotInfo sInfo = slot.gameObject.GetComponent <SlotInfo>();
                slot.texture = d.icon;
                slot.gameObject.SetActive(true);
                sInfo.content = d.name;
                if (sInfo.charges < d.maxCharges)
                {
                    if (sInfo.charges + d.charges <= d.maxCharges)
                    {
                        sInfo.ChangeCharges(d.charges);
                    }
                    else
                    {
                        sInfo.ChangeCharges(d.maxCharges - d.charges);
                    }
                    gc.player.cash -= d.cost;
                    gc.uiController.ChangeCash(gc.player.cash);
                }
                return;
            }
        }
    }
コード例 #11
0
    public void SetIconToHabilitySlot(string name)
    {
        Hability h = Array.Find(habilities, hability => hability.name == name);

        if (h == null)
        {
            Debug.LogWarning(name + " not found.");
            return;
        }
        if (h.cost > gc.player.cash)
        {
            return;
        }
        foreach (RawImage slot in habilitySlots)
        {
            if (!slot.gameObject.activeSelf || slot.gameObject.GetComponent <SlotInfo>().content == h.name)
            {
                SlotInfo sInfo = slot.gameObject.GetComponent <SlotInfo>();
                slot.texture = h.icon;
                slot.gameObject.SetActive(true);
                sInfo.content = h.name;
                if (sInfo.charges < h.maxCharges)
                {
                    if (sInfo.charges + h.charges <= h.maxCharges)
                    {
                        sInfo.ChangeCharges(h.charges);
                    }
                    else
                    {
                        sInfo.ChangeCharges(h.maxCharges - h.charges);
                    }
                    gc.player.cash -= h.cost;
                    gc.uiController.ChangeCash(gc.player.cash);
                }
                return;
            }
        }
    }
コード例 #12
0
    public void AddUpgrade()
    {
        System.Type t = Type.GetType(itemToAdd);
        Debug.Log(t);
        switch (itemType)
        {
        case ItemType.Upgrade:
            if (itemToAdd == "DMGUp")
            {
                Debug.Log("is DMGUP");
                DMGUp du = null;
                du = GameManager.Instance.Player.GetComponent(t.ToString()) as DMGUp;
                if (du == null)
                {
                    GameManager.Instance.Player.gameObject.AddComponent(t);
                }
                else
                {
                    du.Level++;
                }
            }
            if (itemToAdd == "VELUp")
            {
                Debug.Log("is VELUP");
                VELUp vu = null;
                vu = GameManager.Instance.Player.GetComponent(t.ToString()) as VELUp;
                if (vu == null)
                {
                    GameManager.Instance.Player.gameObject.AddComponent(t);
                }
                else
                {
                    vu.Level++;
                }
            }
            if (itemToAdd == "AOEUpgrade")
            {
                Debug.Log("is AOE");
                AOEUpgrade u = null;
                u = GameManager.Instance.Player.GetComponent(t.ToString()) as AOEUpgrade;
                if (u == null)
                {
                    GameManager.Instance.Player.gameObject.AddComponent(t);
                }
                else
                {
                    u.Level++;
                }
            }
            else
            {
                goto NotAccepted;
            }
            break;

        case ItemType.Hability:

            Hability h = null;
            if (t is Hability)
            {
                Debug.Log("item is just Hability");
                h = GameManager.Instance.Player.GetComponent(t.ToString()) as Hability;
            }

            if (h == null)
            {
                GameManager.Instance.Player.gameObject.AddComponent(t);
            }
            else
            {
                goto NotAccepted;
            }
            break;

        case ItemType.HabilityUpgrade:

            if (itemToAdd == "Berserk")
            {
                Berserk.RefLevel++;
            }
            if (itemToAdd == "Barrido")
            {
                Barrido.RefLevel++;
            }
            if (itemToAdd == "Barrera")
            {
                Barrera.RefLevel++;
            }
            break;
        }

NotAccepted:
        return;
    }
コード例 #13
0
    public IEnumerator WaitHabilityCooldown(float time, Hability wichOne, PlayerManager player)
    {
        yield return(new WaitForSecondsRealtime(time));

        player.controller.combatController.SetEnemyDescription();
    }
コード例 #14
0
    public IEnumerator WaitHabilityCooldown(float time, Hability wichOne)
    {
        yield return(new WaitForSecondsRealtime(time));

        wichOne.isAvailable = true;
    }