本文整理汇总了C#中Actor.GetEnabledTargetTypes方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.GetEnabledTargetTypes方法的具体用法?C# Actor.GetEnabledTargetTypes怎么用?C# Actor.GetEnabledTargetTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actor
的用法示例。
在下文中一共展示了Actor.GetEnabledTargetTypes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanGiveTo
public bool CanGiveTo(Actor collector)
{
if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
return false;
if (!info.ValidTargets.Overlaps(collector.GetEnabledTargetTypes()))
return false;
var positionable = collector.TraitOrDefault<IPositionable>();
if (positionable == null)
return false;
return collector.World.Map.FindTilesInCircle(collector.Location, info.MaxRadius)
.Any(c => positionable.CanEnterCell(c));
}
示例2: IsValidAgainst
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
public virtual bool IsValidAgainst(Actor victim, Actor firedBy)
{
if (!AffectsParent && victim == firedBy)
return false;
var stance = firedBy.Owner.Stances[victim.Owner];
if (!ValidStances.HasStance(stance))
return false;
// A target type is valid if it is in the valid targets list, and not in the invalid targets list.
if (!IsValidTarget(victim.GetEnabledTargetTypes()))
return false;
return true;
}
示例3: CanAttackTarget
protected static bool CanAttackTarget(Actor a, Actor target)
{
if (!a.Info.HasTraitInfo<AttackBaseInfo>())
return false;
var targetTypes = target.GetEnabledTargetTypes();
if (!targetTypes.Any())
return false;
var arms = a.TraitsImplementing<Armament>();
foreach (var arm in arms)
if (arm.Weapon.IsValidTarget(targetTypes))
return true;
return false;
}
示例4: IsValidAgainst
/// <summary>Checks if the weapon is valid against (can target) the actor.</summary>
public bool IsValidAgainst(Actor victim, Actor firedBy)
{
var targetTypes = victim.GetEnabledTargetTypes();
if (!IsValidTarget(targetTypes))
return false;
// PERF: Avoid LINQ.
foreach (var warhead in Warheads)
if (warhead.IsValidAgainst(victim, firedBy))
return true;
return false;
}
示例5: CanTargetActor
public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
{
return targetTypes.Overlaps(target.GetEnabledTargetTypes());
}
示例6: GetAttractiveness
/// <summary>Evaluates a single actor according to the rules defined in this consideration</summary>
public int GetAttractiveness(Actor a, Stance stance, Player firedBy)
{
if (stance != Against)
return 0;
if (a == null)
return 0;
if (!a.IsTargetableBy(firedBy.PlayerActor))
return 0;
if (Types.Overlaps(a.GetEnabledTargetTypes()))
{
switch (TargetMetric)
{
case DecisionMetric.Value:
var valueInfo = a.Info.TraitInfoOrDefault<ValuedInfo>();
return (valueInfo != null) ? valueInfo.Cost * Attractiveness : 0;
case DecisionMetric.Health:
var health = a.TraitOrDefault<Health>();
return (health != null) ? (health.HP / health.MaxHP) * Attractiveness : 0;
default:
return Attractiveness;
}
}
return 0;
}