public Scene() { snake = new Snake(GenericGameObjectsFactory.getContentManager().Load <Texture2D>("segment"), Direction.SOUTH, new Vector2(100, 100), 10); snake.Attach(this); snake.Attach(pointsLabel); //snake.Attach(coordinatesLabel); label.Text = ""; inputController = new InputController(snake); SpawnAppleRandomly(); ComponentManager.attachComponent(inputController); ComponentManager.attachComponent(snake); ComponentManager.attachComponent(pointsLabel); ComponentManager.attachComponent(label); //ComponentManager.attachComponent(coordinatesLabel); }
public Snake(Texture2D _segmentTexture, Direction _direction, Vector2 startPos, int startGrowth, int _segmentId = 0) : base(true) { segmentTexture = _segmentTexture; direction = _direction; position = startPos; SegmentID = _segmentId; for (int i = 0; i < startGrowth; i++) { Snake childSnakeSegment = this.grow(); childSnakeSegment.Attach(this); } }