本文整理汇总了C#中Combatant.GetRandomTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Combatant.GetRandomTarget方法的具体用法?C# Combatant.GetRandomTarget怎么用?C# Combatant.GetRandomTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combatant
的用法示例。
在下文中一共展示了Combatant.GetRandomTarget方法的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)
//.........这里部分代码省略.........