本文整理汇总了C#中IMove类的典型用法代码示例。如果您正苦于以下问题:C# IMove类的具体用法?C# IMove怎么用?C# IMove使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMove类属于命名空间,在下文中一共展示了IMove类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NodeBase
internal NodeBase(INode parentNode, IMove move, float uctk, IPlayer player)
{
this.parent = parentNode;
this.move = move;
this.uctk = uctk;
this.playerJustMoved = player;
}
示例2: Execute
public GameState Execute()
{
_numPushed = 0;
_oldPieceToMove = _state.PieceToMove;
_oldLastMove = _state.LastMove;
_start = _piece.Position;
int ystep = _end.Y - _start.Y;
_state.BoardPositions[_piece.Position.Y][_piece.Position.X] = null;
Piece currentPiece = _piece;
while (_state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] != null)
{
Piece next = _state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X];
_state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] = currentPiece;
currentPiece.Position = new Point(currentPiece.Position.X, currentPiece.Position.Y + ystep);
currentPiece = next;
_numPushed++;
}
_state.BoardPositions[currentPiece.Position.Y + ystep][currentPiece.Position.X] = currentPiece;
currentPiece.Position = new Point(currentPiece.Position.X, currentPiece.Position.Y + ystep);
_state.IsPlayerTwo = !_state.IsPlayerTwo;
_state.PieceToMove = currentPiece;
_state.LastMove = this;
List<IMove> possible = new List<IMove>();
possible.Add(new SumoDazedMove(_state, currentPiece));
_state.PossibleMoves = possible;
return _state;
}
示例3: IsValidMove
public override bool IsValidMove(IPlayer player, IMove move)
{
var checkersBoard = (CheckersBoard)CurrentGameState;
var checkersMove = (CheckersMove)move;
var checkersPlayer = (CheckersPlayer)player;
var startPiece = (CheckersPiece)checkersBoard.GetPieceAt(checkersMove.MovePath[0]);
if (startPiece==null) return false;
if (startPiece.Color != checkersPlayer.Color) return false;
int maxEat=0;
bool eatMove=false;
foreach (var piece in checkersBoard.GetPiecesOfColor(startPiece.Color))
{
var possibleMoves = piece.PossibleMoves;
if (possibleMoves.Count > 0)
{
var otherMove = possibleMoves[0] as CheckersMove;
if (maxEat < otherMove.MovePath.Length)
{
maxEat = otherMove.MovePath.Length;
}
if (otherMove.EatMove)
eatMove = true;
}
}
bool isPossible = startPiece.PossibleMoves.Cast<CheckersMove>().Contains(checkersMove);
return
eatMove==checkersMove.EatMove &&
checkersMove.MovePath.Length==maxEat &&
isPossible;
}
示例4: Pouring
internal Pouring(IReadOnlyList<int> capacities, IReadOnlyList<int> state, Pouring previous, IMove move)
{
Capacities = capacities;
State = state;
Move = move;
Previous = previous;
}
示例5: Enter
protected Enter(Actor self, Actor target, int maxTries = 1, bool targetCenter = false)
{
this.move = self.Trait<IMove>();
this.target = Target.FromActor(target);
this.maxTries = maxTries;
this.targetCenter = targetCenter;
}
示例6: DeliverGoods
public DeliverGoods(Actor self)
{
trader = self.Trait<Trader>();
traderInfo = self.Info.Traits.Get<TraderInfo>();
move = self.Trait<IMove>();
pathFinder = self.World.WorldActor.Trait<IPathFinder>();
}
示例7: Follow
public Follow(Actor self, Target target, WRange minRange, WRange maxRange)
{
this.target = target;
this.minRange = minRange;
this.maxRange = maxRange;
move = self.Trait<IMove>();
}
示例8: LayMines
public LayMines(Actor self)
{
minelayer = self.TraitOrDefault<Minelayer>();
info = self.Info.TraitInfo<MinelayerInfo>();
ammoPools = self.TraitsImplementing<AmmoPool>().ToArray();
movement = self.Trait<IMove>();
rearmBuildings = info.RearmBuildings;
}
示例9: Contrail
public Contrail(Actor self, ContrailInfo info)
{
contrailTurret = new Turret(info.ContrailOffset);
history = new ContrailHistory(info.TrailLength,
info.UsePlayerColor ? ContrailHistory.ChooseColor(self) : info.Color);
facing = self.Trait<IFacing>();
move = self.Trait<IMove>();
}
示例10: Refuel
public Refuel(Actor self, Actor host)
{
move = self.TraitOrDefault<IMove>();
this.host = host;
target = Target.FromActor(host);
refuels = host.TraitOrDefault<RefuelsUnits>();
fueltank = self.TraitOrDefault<Fueltank>();
}
示例11: Drag
public Drag(Actor self, WPos start, WPos end, int length)
{
positionable = self.Trait<IPositionable>();
movement = self.TraitOrDefault<IMove>();
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
this.start = start;
this.end = end;
this.length = length;
}
示例12: PutShipsUserControl
public PutShipsUserControl(IMove lvl)
{
InitializeComponent();
computer = Computer.getInstance(lvl);
DisableComputerBoard();
computerShipsAdded = computer.PutComputerShips();
MessageBox.AppendText("Dodano wszystkie statki przeciwnika.");
MessageBox.AppendText(Environment.NewLine + "Proszę dodać dwumasztowy statek.");
}
示例13: getInstance
public static Computer getInstance(IMove lvl)
{
if (instance == null)
{
instance = new Computer(lvl);
}
return instance;
}
示例14: Drag
public Drag(Actor self, WPos start, WPos end, int length)
{
positionable = self.Trait<IPositionable>();
movement = self.TraitOrDefault<IMove>();
disableable = movement as IDisabledTrait;
this.start = start;
this.end = end;
this.length = length;
}
示例15: Board
public Board(int[,] data, IMove move)
{
if (data == null) { throw new ArgumentNullException(nameof(data)); }
_data = (int[,])data.Clone();
_data[move.Row, move.Column] = move.Value;
// Validate(_data);
}