public virtual void Setup() { if (Content.CoilgunTop == null) { Content.LoadBuildingGraphics(this); } Top = new DrawPart(Content.CoilgunTop, new Vector2(2.2f, 0f)); Cables = new DrawPart(Content.CoilgunCables, new Vector2(2.2f, 0f)); Top.DepthOffset = AltitudeLayer.PawnUnused.AltitudeFor() + 0.001f; // Barrel of gun draws over pawns. Cables.DepthOffset = Top.DepthOffset + 0.05f; LeftPivot = new DrawPart(Content.CoilgunLinkLeft, new Vector2(1f, 0f)); RightPivot = new DrawPart(Content.CoilgunLinkRight, new Vector2(1f, 0f)); BarLeft = new DrawPart(Content.CoilgunBarLeft, new Vector2(0f, 0f)); BarRight = new DrawPart(Content.CoilgunBarRight, new Vector2(0f, 0f)); BarLeft.OffsetUsingGrandparent = true; BarRight.OffsetUsingGrandparent = true; Top.AddChild(LeftPivot); Top.AddChild(RightPivot); LeftPivot.AddChild(BarLeft); RightPivot.AddChild(BarRight); BarLeft.MatchRotation = Top; BarRight.MatchRotation = Top; }
public bool RemoveChild(DrawPart child) { if (child == null || child.Parent != this) { return(false); } child.Parent = null; children.Remove(child); return(true); }
public bool AddChild(DrawPart child) { if (child == null || child.Parent != null || Parent == child) { return(false); } children.Add(child); child.Parent = this; return(true); }