本文整理汇总了C#中IntVector3.FastRotate方法的典型用法代码示例。如果您正苦于以下问题:C# IntVector3.FastRotate方法的具体用法?C# IntVector3.FastRotate怎么用?C# IntVector3.FastRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntVector3
的用法示例。
在下文中一共展示了IntVector3.FastRotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareNextActionOverride
protected override GameAction PrepareNextActionOverride(out JobStatus progress)
{
var random = this.Worker.World.Random;
int rand = random.Next(100);
GameAction action = null;
Direction dir = m_dir;
if (rand < 25)
{
dir = Direction.None;
}
else if (rand < 50)
{
}
else if (rand < 75)
{
var v = new IntVector3(dir);
v = v.FastRotate(random.Next() % 2 == 0 ? 1 : -1);
dir = v.ToDirection();
}
else
{
var v = new IntVector3(dir);
v = v.FastRotate(random.Next() % 2 == 0 ? 2 : -2);
dir = v.ToDirection();
}
if (dir == Direction.None)
{
action = new WaitAction(random.Next(4) + 1);
}
else
{
var env = this.Worker.Environment;
m_dir = dir;
IntVector2 ov = new IntVector2(dir);
for (int i = 0; i < 7; ++i)
{
var v = ov.FastRotate(((i + 1) >> 1) * (((i % 2) << 1) - 1));
var d = EnvironmentHelpers.AdjustMoveDir(env, this.Worker.Location, v.ToDirection());
if (d != Direction.None)
action = new MoveAction(d);
}
if (action == null && EnvironmentHelpers.CanMoveFromTo(this.Worker, Direction.Up))
action = new MoveAction(Direction.Up);
if (action == null && EnvironmentHelpers.CanMoveFromTo(this.Worker, Direction.Down))
action = new MoveAction(Direction.Down);
if (action == null)
action = new WaitAction(random.Next(4) + 1);
}
progress = JobStatus.Ok;
return action;
}