当前位置: 首页>>代码示例>>C#>>正文


C# Spell.Equals方法代码示例

本文整理汇总了C#中Spell.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.Equals方法的具体用法?C# Spell.Equals怎么用?C# Spell.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spell的用法示例。


在下文中一共展示了Spell.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: activate_skill

 public void activate_skill(Spell skill)
 {
     if(skill.Equals(actives[0]))
     {
         GetComponent<PlayerAttributes>().curHP += actives[0].skillValue+1;
         if(GetComponent<PlayerAttributes>().curHP >= GetComponent<PlayerAttributes>().maxHP)
             GetComponent<PlayerAttributes>().curHP = GetComponent<PlayerAttributes>().maxHP;
         actives[0].lastCastTime = Time.time;
         GetComponent<PlayerAttributes>().curMana -= actives[0].manaCost;
         skillSprite.DoAnim("Heal");
         GetComponent<Controls>().doSkill1();
         audio.PlayOneShot(soundActives[0]);
         return;
     }
     if(skill.Equals(actives[1]))
     {
         actives[1].lastCastTime = Time.time;
         GetComponent<PlayerAttributes>().curMana -= actives[1].manaCost;
         GetComponent<Controls>().doSkill2();
         audio.PlayOneShot(soundActives[1]);
         return;
     }
     if(skill.Equals(actives[2]))
     {
         actives[2].lastCastTime = Time.time;
         GetComponent<PlayerAttributes>().curMana -= actives[2].manaCost;
         GetComponent<Controls>().doSkill3();
         audio.PlayOneShot(soundActives[2]);
         return;
     }
     if(skill.Equals(actives[3]))
     {
         GetComponent<Controls>().doSkill4();
         skillSprite2.DoAnim("Intervention");
         intervention = true;
         GetComponent<PlayerAttributes>().curMana -= actives[3].manaCost;
         actives[3].lastCastTime = Time.time;
         audio.PlayOneShot(soundActives[3]);
         return;
     }
 }
开发者ID:jpbonson,项目名称:Game_CleasingTheUndead,代码行数:41,代码来源:LevelUpSystem.cs

示例2: up_skill

    public void up_skill(Spell skill)
    {
        if(skill.Equals(actives[0])) // active skill 1
        {
            if(actives[0].level < maxSkilllvl  && skillPoints > 0)
            {
                actives[0].level++;
                skillPoints--;
                actives[0].skillValue += actives[0].valueIncreasePerLvl;
            }
        }

        if(skill.Equals(actives[1])) // active skill 2
        {
            if(actives[1].level < maxSkilllvl  && skillPoints > 0)
            {
                actives[1].level++;
                skillPoints--;
                actives[1].skillValue += actives[1].valueIncreasePerLvl;
                actives[1].cooldown += actives[1].cooldownChangePerLvl;
            }
        }

        if(skill.Equals(actives[2])) // active skill 3
        {
            if(actives[2].level < maxSkilllvl  && skillPoints > 0)
            {
                actives[2].level++;
                skillPoints--;
                actives[2].skillValue += actives[2].valueIncreasePerLvl;
                actives[2].cooldown += actives[2].cooldownChangePerLvl;
            }
        }

        if(skill.Equals(actives[3])) // active skill 3
        {
            if(actives[3].level < maxSkilllvl  && skillPoints > 0)
            {
                actives[3].level++;
                skillPoints--;
                actives[3].skillValue += actives[3].valueIncreasePerLvl;
            }
        }

        if(skill.Equals(passives[0])) // passive skill 1
        {
            if(passives[0].level < maxSkilllvl && skillPoints > 0)
            {
                passives[0].level++;
                skillPoints--;
                GetComponent<PlayerAttributes>().atkDamage+=passives[0].valueIncreasePerLvl;
            }
        }

        if(skill.Equals(passives[1])) // passive skill 2
        {
            if(passives[1].level < maxSkilllvl && skillPoints > 0)
            {
                passives[1].level++;
                skillPoints--;
                GetComponent<PlayerAttributes>().maxHP+=
                    ((int)GetComponent<PlayerAttributes>().maxHP*passives[1].valueIncreasePerLvl)/100;
                GetComponent<PlayerAttributes>().curHP+=
                    ((int)GetComponent<PlayerAttributes>().maxHP*passives[1].valueIncreasePerLvl)/100;
            }
        }
    }
开发者ID:jpbonson,项目名称:Game_CleasingTheUndead,代码行数:67,代码来源:LevelUpSystem.cs


注:本文中的Spell.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。