public void Moving() { SnakeBlock tempNode = head; for (var i = 0; i < count; i++) { tempNode.Moving(); tempNode = tempNode.Previous; } }
public void Turn(Direction direction) { SnakeBlock tempNode = head.Previous; Point fixState = new Point(head.Position.X, head.Position.Y); head.ToTurn(fixState, direction); for (var i = 0; i < count - 1; i++) { tempNode.ToTurn(fixState, direction); tempNode = tempNode.Previous; } }
public void Draw() { spriteBatch.Begin(); SnakeBlock tempNode = head; for (var i = 0; i <= count; i++) { spriteBatch.Draw(rectangleBlock, tempNode.ToRectangle(), tempNode.Color); tempNode = tempNode.Previous; } spriteBatch.End(); }
public void Add(SnakeBlock snakeBlock) { SnakeBlock node = snakeBlock; if (head == null) { head = node; head.Next = node; head.Previous = node; } else { node.Previous = head.Previous; node.Next = head; head.Previous.Next = node; head.Previous = node; } count++; }
public void Clear() { head = null; count = 0; BeginInitialise(); }