private void SetDirection(Map.Side side, AvaibleSides avaibleSides) { if (avaibleSides.CheckAvaiblity(side)) { this.snake.ChangeDirection(side); this.SetInput(); } }
// private void ShiftNeighbours(Field[] neighbours) // { // } private bool CanDirectionBeFollowed(Field start, Field[] neighbours, Map.Side dir) { foreach (var neighbour in neighbours) { if (neighbour.IsWalkable() && dir == Map.Direction(start, neighbour)) { return(true); } } return(false); }
private void ChangeDirection(Map.Side side) { if (gotInput) { return; } if (ActualSide(this.rightAndLeft)) { this.SetDirection(side, this.upAndDown); } else if (ActualSide(this.upAndDown)) { this.SetDirection(side, this.rightAndLeft); } }
public void Turn(Map.Side side) { switch (side) { case Map.Side.right: dir = Map.Right(dir); break; case Map.Side.left: dir = Map.Left(dir); break; default: break; } }
public bool CheckAvaiblity(Map.Side side) { return(side == this.one || side == this.another); }
public AvaibleSides(Map.Side one, Map.Side another) { this.one = one; this.another = another; }
private Vector2 Direction(Map.Side side) { return(Map.Direction(side)); }
public void ChangeDirection(Map.Side side) { dir = side; }