本文整理汇总了C#中Direction.Opposite方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.Opposite方法的具体用法?C# Direction.Opposite怎么用?C# Direction.Opposite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.Opposite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddField
public BaseField AddField(Direction location, BaseField field, bool updateRowColumn = true)
{
_fieldDictionary[location] = field;
if (updateRowColumn)
{
field.Row = Row;
field.Column = Column;
switch (location)
{
case Direction.Up:
field.Row = Row + 1;
break;
case Direction.Down:
field.Row = Row - 1;
break;
case Direction.Left:
field.Column = Column - 1;
break;
case Direction.Right:
field.Column = Column + 1;
break;
}
}
if (field.GetField(location.Opposite()) == null)
field.AddField(location.Opposite(), this, false);
return this;
}
示例2: Move
public override bool Move(Direction dir, out bool acted)
{
var moved = base.Move(dir, out acted);
if(this.Position.SquaredDistanceFrom(controller.Position) > squaredPerceptionRange)
{
base.Move(dir.Opposite(), out acted);
moved = false;
}
acted = false;
return moved;
}