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


C# Combatant.IsBlockAttack方法代码示例

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


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

示例1: GetAction

    /*
    ============================================================================
    Action handling functions
    ============================================================================
    */
    public BattleAction GetAction(Combatant c, int valid, Combatant[] allies, Combatant[] enemies)
    {
        BattleAction action = new BattleAction();
        bool found = false;
        bool targetEnemy = false;
        int difID = GameHandler.GetDifficulty();
        if(this.difficultyID <= difID)
        {
            for(int i=0; i<this.attackSelection.Length; i++)
            {
                if(this.actionDifficultyID[i] <= difID)
                {
                    if(valid == -2 && c.attackPartyTarget && DataHolder.BattleControl().HasPartyTarget())
                    {
                        action.targetID = DataHolder.BattleControl().GetPartyTargetID();
                    }
                    else if(valid == -2 && c.attackLastTarget && c.lastTargetBattleID >= 0 &&
                        DataHolder.BattleSystem().CheckForID(c.lastTargetBattleID, enemies, true))
                    {
                        action.targetID = c.lastTargetBattleID;
                    }
                    else
                    {
                        action.targetID = valid;
                    }
                    action.type = this.attackSelection[i];
                    // set up base attack
                    if(action.IsAttack() && !c.IsBlockAttack())
                    {
                        targetEnemy = true;
                        if(valid == -2)
                        {
                            if(c.aiNearestTarget)
                            {
                                action.targetID = c.GetNearestTarget(enemies);
                            }
                            else
                            {
                                action.targetID = c.GetRandomTarget(enemies);
                            }
                        }
                        found = true;
                    }
                    // set up skill
                    else if(action.IsSkill() && !c.IsBlockSkills() &&
                        c.HasSkill(this.useID[i], this.useLevel[i]) &&
                        DataHolder.Skill(this.useID[i]).CanUse(c, this.useLevel[i]-1))
                    {
                        action.useID = this.useID[i];
                        action.useLevel = this.useLevel[i]-1;
                        if(DataHolder.Skill(action.useID).TargetSelf())
                        {
                            action.targetID = c.battleID;
                        }
                        else if(DataHolder.Skill(action.useID).TargetNone())
                        {
                            action.targetID = BattleAction.NONE;
                            if(DataHolder.Skill(action.useID).targetRaycast.active)
                            {
                                GameObject target = null;
                                if(c.aiNearestTarget)
                                {
                                    if(DataHolder.Skill(action.useID).TargetEnemy())
                                    {
                                        target = c.GetNearestTargetObject(enemies);
                                    }
                                    else if(DataHolder.Skill(action.useID).TargetAlly())
                                    {
                                        target = c.GetNearestTargetObject(allies);
                                    }
                                }
                                else
                                {
                                    if(DataHolder.Skill(action.useID).TargetEnemy())
                                    {
                                        target = c.GetRandomTargetObject(enemies);
                                    }
                                    else if(DataHolder.Skill(action.useID).TargetAlly())
                                    {
                                        target = c.GetRandomTargetObject(allies);
                                    }
                                }
                                if(target != null)
                                {
                                    action.rayTargetSet = true;
                                    action.rayPoint = DataHolder.Skill(action.useID).targetRaycast.GetAIPoint(
                                            c.prefabInstance, target);
                                }
                            }
                        }
                        else if(DataHolder.Skill(action.useID).TargetAllyGroup() && c is Enemy)
                        {
                            action.targetID = BattleAction.ALL_ENEMIES;
                        }
                        else if(DataHolder.Skill(action.useID).TargetAllyGroup() && c is Character)
//.........这里部分代码省略.........
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:101,代码来源:AIBehaviour.cs


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