public void Add(DrawNode child) { if (_items == null) _items = new Bag<DrawNode>(); _items.Add(child); child.Parent = this; }
internal void DrawNode(DrawNode node) { _layerTransform = DrawInfo.FromDrawable(SkidiGame.Camera); _transform = _layerTransform; _spriteBatch.Begin(); InternalDrawNode(node); _spriteBatch.End(); }
public void RemoveChild(DrawNode child) { if (_items == null) return; if (_items.Remove(child)) child.Parent = null; }
private void InternalDrawNode(DrawNode node) { node.WorldPosition = _transform.Position + node.Position; node.ScreenPosition = node.WorldPosition - _layerCamPosition; if (node.Visible) node.Draw(this); else return; if (node.ChildrenCount == 0) return; var startTransform = _transform; _transform.Position += node.Position; if (node.Cascade) { _transform.Alpha *= node.Alpha; _transform.Color *= node.Color.ToVector3(); _transform.Rotation += node.Rotation; _transform.Scale *= node.Scale; } foreach (var child in node.Children) InternalDrawNode(child); _transform = startTransform; }
public void Remove(DrawNode node) { _nodes.Remove(node); }
public void Add(DrawNode node) { _nodes.Add(node); }