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


C# Character.GetSkills方法代码示例

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


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

示例1: GetSkillMenuList

    public BattleMenuItem[] GetSkillMenuList(int type, Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];
        if(this.addBack && this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        ArrayList skills = new ArrayList();
        SkillLearn[] s = character.GetSkills();
        for(int i=0; i<s.Length; i++)
        {
            if(DataHolder.Skill(s[i].skillID).useInBattle &&
                (this.combineSkills || DataHolder.Skill(s[i].skillID).skilltype == type))
            {
                skills.Add(s[i].skillID);
            }
        }
        skills.Sort(new SkillNameSorter());
        for(int i=0; i<skills.Count; i++)
        {
            SkillLearn sk = character.GetSkill((int)skills[i]);
            if(sk != null)
            {
                if(DataHolder.Skill(sk.skillID).TargetSelf())
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            character.battleID, sk.skillID, sk.GetLevel())), list);
                }
                else if(DataHolder.Skill(sk.skillID).TargetNone())
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            BattleAction.NONE, sk.skillID, sk.GetLevel())), list);
                    list[list.Length-1].action.targetRaycast = DataHolder.Skill(sk.skillID).targetRaycast;
                }
                else if(DataHolder.Skill(sk.skillID).TargetSingleEnemy() &&
                    DataHolder.BattleControl().IsAutoUseOnTarget() &&
                    DataHolder.Skill(sk.skillID).InRange(character, DataHolder.BattleControl().partyTarget, sk.GetLevel()))
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()),
                            new BattleAction(AttackSelection.SKILL, character,
                            BattleAction.PARTY_TARGET, sk.skillID, sk.GetLevel())), list);
                }
                else
                {
                    list = ArrayHelper.Add(new BattleMenuItem(sk.GetContent(), sk.skillID, sk.GetLevel(), BattleMenu.SKILL, true,
                            DataHolder.Skill(sk.skillID).GetSkillCostString(character, sk.GetLevel()), null), list);
                }
            }
        }
        if(this.addBack && !this.backFirst)
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }
        return list;
    }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:61,代码来源:BattleMenu.cs

示例2: Check

    public bool Check(Character c)
    {
        this.lastAdd = this.add;
        this.lastActive = this.active;
        bool targetChange = false;

        // add check
        this.add = true;
        if(this.action != null && (!this.action.InRange() || !this.action.TargetAlive()))
        {
            this.add = false;
        }
        if(this.action != null && this.action.RangeDifference())
        {
            targetChange = true;
        }

        // active check
        this.active = true;
        // blocked
        if((BattleMenu.ATTACK == this.type && c.IsBlockAttack()) ||
            (BattleMenu.SKILL == this.type && c.IsBlockSkills()) ||
            (BattleMenu.ITEM == this.type && c.IsBlockItems()) ||
            (BattleMenu.DEFEND == this.type && c.IsBlockDefend()) ||
            (BattleMenu.ESCAPE == this.type && (c.IsBlockEscape() || !DataHolder.BattleSystem().canEscape)))
        {
            this.active = false;
        }
        // skill
        else if(this.isTarget && BattleMenu.SKILL == this.type &&
            this.id >= 0 && !DataHolder.Skill(this.id).CanUse(c, this.useLevel))
        {
            this.active = false;
        }
        // no skills
        else if(!this.isTarget && BattleMenu.SKILL == this.type && c.GetSkills().Length == 0)
        {
            this.active = false;
        }
        // no items
        else if(!this.isTarget && BattleMenu.ITEM == this.type && !GameHandler.HasItems())
        {
            this.active = false;
        }

        // active time checks
        if(this.active && DataHolder.BattleSystem().IsActiveTime())
        {
            if(BattleMenu.ATTACK == this.type && this.isTarget &&
                ((!DataHolder.BattleSystem().attackEndTurn &&
                c.usedTimeBar+DataHolder.BattleSystem().attackTimebarUse > DataHolder.BattleSystem().maxTimebar) ||
                (DataHolder.BattleSystem().attackEndTurn && c.usedTimeBar > 0)))
            {
                this.active = false;
            }
            else if(BattleMenu.SKILL == this.type && this.isTarget && this.id >= 0 &&
                ((!DataHolder.Skill(this.id).level[this.useLevel].endTurn &&
                c.usedTimeBar+DataHolder.Skill(this.id).level[this.useLevel].timebarUse > DataHolder.BattleSystem().maxTimebar) ||
                (DataHolder.Skill(this.id).level[this.useLevel].endTurn && c.usedTimeBar > 0)))
            {
                this.active = false;
            }
            else if(BattleMenu.ITEM == this.type && this.isTarget &&
                ((!DataHolder.BattleSystem().itemEndTurn &&
                c.usedTimeBar+DataHolder.BattleSystem().itemTimebarUse > DataHolder.BattleSystem().maxTimebar) ||
                (DataHolder.BattleSystem().itemEndTurn && c.usedTimeBar > 0)))
            {
                this.active = false;
            }
            else if(BattleMenu.DEFEND == this.type &&
                ((!DataHolder.BattleSystem().defendEndTurn &&
                c.usedTimeBar+DataHolder.BattleSystem().defendTimebarUse > DataHolder.BattleSystem().maxTimebar) ||
                (DataHolder.BattleSystem().defendEndTurn && c.usedTimeBar > 0)))
            {
                this.active = false;
            }
            else if(BattleMenu.ESCAPE == this.type &&
                ((!DataHolder.BattleSystem().escapeEndTurn &&
                c.usedTimeBar+DataHolder.BattleSystem().escapeTimebarUse > DataHolder.BattleSystem().maxTimebar) ||
                (DataHolder.BattleSystem().escapeEndTurn && c.usedTimeBar > 0)))
            {
                this.active = false;
            }
        }

        // should update check
        return this.lastAdd != this.add || this.lastActive != this.active || targetChange;
    }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:88,代码来源:BattleMenu.cs

示例3: BattleMenuList

    public BattleMenuItem[] BattleMenuList(Character character)
    {
        BattleMenuItem[] list = new BattleMenuItem[0];
        this.LoadIcons();

        if(this.addBack && this.backFirst && DataHolder.BattleSystem().IsRealTime())
        {
            list = ArrayHelper.Add(this.GetBackItem(), list);
        }

        for(int i=0; i<this.order.Length; i++)
        {
            if(this.order[i] == BattleMenu.ATTACK && this.showAttack)
            {
                if(DataHolder.BattleControl().IsAutoUseOnTarget() &&
                    character.InAttackRange(DataHolder.BattleControl().partyTarget))
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.attackName[GameHandler.GetLanguage()].ToString(), this.attackIcon),
                            -1, BattleMenu.ATTACK, true, "",
                            new BattleAction(AttackSelection.ATTACK, character, BattleAction.PARTY_TARGET, -1, 0)), list);
                }
                else
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.attackName[GameHandler.GetLanguage()].ToString(), this.attackIcon),
                            -1, BattleMenu.ATTACK, true, ""), list);
                }
            }
            else if(this.order[i] == BattleMenu.SKILL && this.showSkills)
            {
                SkillLearn[] skills = character.GetSkills();
                if(this.combineSkills)
                {
                    if(skills.Length > 0)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(
                            new GUIContent(this.skillName[GameHandler.GetLanguage()].ToString(), this.skillIcon),
                            -1, BattleMenu.SKILL, false, ""), list);
                    }
                }
                else
                {
                    ArrayList types = new ArrayList();
                    for(int j=0; j<skills.Length; j++)
                    {
                        if(DataHolder.Skill(skills[j].skillID).useInBattle)
                        {
                            int st = DataHolder.Skill(skills[j].skillID).skilltype;
                            if(!types.Contains(st))
                            {
                                types.Add(st);
                            }
                        }
                    }
                    types.Sort(new SkillTypeSorter());
                    for(int j=0; j<types.Count; j++)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(DataHolder.SkillTypes().GetContent(
                                (int)types[j]), (int)types[j], BattleMenu.SKILL, false, ""), list);
                    }
                }
            }
            else if(this.order[i] == BattleMenu.ITEM && this.showItems)
            {
                if(this.combineItems)
                {
                    list = ArrayHelper.Add(new BattleMenuItem(
                        new GUIContent(this.itemName[GameHandler.GetLanguage()].ToString(), this.itemIcon),
                        -1, BattleMenu.ITEM, false, ""), list);
                }
                else
                {
                    ArrayList types = new ArrayList();
                    foreach(int key in GameHandler.Items().Keys)
                    {
                        if(DataHolder.Item(key).useInBattle)
                        {
                            int it = DataHolder.Item(key).itemType;
                            if(!types.Contains(it))
                            {
                                types.Add(it);
                            }
                        }
                    }
                    types.Sort(new ItemTypeSorter());
                    for(int j=0; j<types.Count; j++)
                    {
                        list = ArrayHelper.Add(new BattleMenuItem(DataHolder.ItemTypes().GetContent(
                                (int)types[j]), (int)types[j], BattleMenu.ITEM, false, ""), list);
                    }
                }
            }
            else if(this.order[i] == BattleMenu.DEFEND && this.showDefend)
            {
                list = ArrayHelper.Add(new BattleMenuItem(
                    new GUIContent(this.defendName[GameHandler.GetLanguage()].ToString(), this.defendIcon),
                    -1, BattleMenu.DEFEND, false, ""), list);
            }
            else if(this.order[i] == BattleMenu.ESCAPE && this.showEscape)
//.........这里部分代码省略.........
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:101,代码来源:BattleMenu.cs


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