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


C# Combatant.IsBlockDefend方法代码示例

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


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

示例1: GetAction


//.........这里部分代码省略.........
                                    else if(DataHolder.Item(action.useID).TargetAlly())
                                    {
                                        target = c.GetRandomTargetObject(allies);
                                    }
                                }
                                if(target != null)
                                {
                                    action.rayTargetSet = true;
                                    action.rayPoint = DataHolder.Item(action.useID).targetRaycast.GetAIPoint(
                                            c.prefabInstance, target);
                                }
                            }
                        }
                        else if(DataHolder.Item(action.useID).TargetAllyGroup() && c is Enemy)
                        {
                            action.targetID = BattleAction.ALL_ENEMIES;
                        }
                        else if(DataHolder.Item(action.useID).TargetAllyGroup() && c is Character)
                        {
                            action.targetID = BattleAction.ALL_CHARACTERS;
                        }
                        else if(DataHolder.Item(action.useID).TargetEnemyGroup() && c is Enemy)
                        {
                            action.targetID = BattleAction.ALL_CHARACTERS;
                            targetEnemy = true;
                        }
                        else if(DataHolder.Item(action.useID).TargetEnemyGroup() && c is Character)
                        {
                            action.targetID = BattleAction.ALL_ENEMIES;
                            targetEnemy = true;
                        }
                        else if(DataHolder.Item(action.useID).TargetSingleAlly())
                        {
                            if(valid == -2 || !DataHolder.BattleSystem().CheckForID(valid, allies,
                                !DataHolder.Item(action.useID).revive))
                            {
                                if(DataHolder.BattleSystem().IsRealTime())
                                {
                                    action.targetID = c.GetNearestTarget(allies);
                                }
                                else
                                {
                                    action.targetID = c.GetRandomTarget(allies);
                                }
                            }
                        }
                        else if(DataHolder.Item(action.useID).TargetSingleEnemy())
                        {
                            if(valid == -2 || !DataHolder.BattleSystem().CheckForID(valid, enemies, true))
                            {
                                if(DataHolder.BattleSystem().IsRealTime())
                                {
                                    action.targetID = c.GetNearestTarget(enemies);
                                }
                                else
                                {
                                    action.targetID = c.GetRandomTarget(enemies);
                                }
                            }
                            targetEnemy = true;
                        }
                        found = true;
                    }
                    else if(action.IsDefend() && !c.IsBlockDefend())
                    {
                        action.targetID = c.battleID;
                        found = true;
                    }
                    // set up escape
                    else if(action.IsEscape() && !c.IsBlockEscape())
                    {
                        action.targetID = c.battleID;
                        found = true;
                    }
                    else if(action.IsDeath() || action.IsNone())
                    {
                        action.targetID = c.battleID;
                        found = true;
                    }

                    // check active time
                    if(found)
                    {
                        if((DataHolder.BattleSystem().IsActiveTime() &&
                            c.usedTimeBar+action.GetTimeUse() > DataHolder.BattleSystem().maxTimebar) ||
                            (targetEnemy && enemies.Length == 0))
                        {
                            found = false;
                            targetEnemy = false;
                            action = new BattleAction();
                        }
                        else break;
                    }
                }
            }
        }

        if(!found) action = null;
        return action;
    }
开发者ID:hughrogers,项目名称:RPGQuest,代码行数:101,代码来源:AIBehaviour.cs


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