本文整理汇总了C#中Unit.IsAlly方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsAlly方法的具体用法?C# Unit.IsAlly怎么用?C# Unit.IsAlly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.IsAlly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TilesInRangeSkill
public HashSet<Tile> TilesInRangeSkill(Tile t, int range, Unit agent, Skill skill)
{
HashSet<Tile> set = new HashSet<Tile>();
if(t!=null)
DLS_NoBarrier(t.gridPos, set, range, null);
//this isn't the actual place to put them
foreach (List<Tile> row in tiles)
{
foreach (Tile tile in row)
{
if (tile != null)
{
Material mat = defaultMat;
if (set.Contains(tile))
mat = skill.ValidTile(agent, tile) ? (tile.unit != null && agent.IsAlly(tile.unit) ? allySelectMat : attackMat) : walkSelectMat;
tile.GetComponent<Renderer>().material = mat;
}
}
}
return set;
}
示例2: ValidTile
public bool ValidTile(Unit user, Tile tile)
{
if (tileRestriction == TargetTileRestriction.ANY)
return true;
if (tileRestriction == TargetTileRestriction.UNIT)
{
if (targetType == TargetType.ENEMY)
{
if (tile.unit != null && user.IsEnemy(tile.unit))
return true;
}
else if (targetType == TargetType.ALLY)
{
if (tile.unit != null && user.IsAlly(tile.unit))
return true;
}
else
{
if (tile.unit != null && user == tile.unit)
return true;
}
return false;
}
return tile.unit == null;
}
示例3: GetNearestAlly
public Unit GetNearestAlly(Unit unit)
{
Tile t = FindTileF(unit.tile, tile =>
{
return tile.unit != null && tile.unit != unit && unit.IsAlly(tile.unit);
});
return t == null ? null : t.unit;
}
示例4: gatherTargets
//gather targets from center of tile extending out aoe tiles. The targettype affects it.
public List<Unit> gatherTargets(Unit user, Tile t, TargetType tt)
{
List<Unit> list = new List<Unit>();
foreach (Tile tile in GameManager.instance.TilesInRangeSkill(t, aoe, user,this))
{
if(tt == TargetType.ENEMY)
{
if (tile.unit != null && user.IsEnemy(tile.unit))
list.Add(tile.unit);
}
else if (tt == TargetType.ALLY)
{
if (tile.unit != null && user.IsAlly(tile.unit))
list.Add(tile.unit);
}
else if (tt == TargetType.SELF)
{
if (tile.unit != null && user == tile.unit)
list.Add(tile.unit);
}
}
return list;
}