public GameObject CreatePortart(Selector selector, GameObject gameObject, Shape bounds) { IHavePortrait portraitGraphics = null; if (gameObject.GetComponent <GraphicsComponent>() is IHavePortrait) { portraitGraphics = gameObject.GetComponent <GraphicsComponent>() as IHavePortrait; } else { throw new Exception("Provied component is not a IHavePortrait"); } GameObject newPortart = new GameObject(); newPortart.Add(new PortatGraphicsComponent(portraitGraphics, bounds, newPortart)); newPortart.Add(new PortraitUserInputComponent(selector, gameObject, newPortart)); return(newPortart); }
public PortatGraphicsComponent(IHavePortrait subject, Shape bounds, GameObject holder) : base(holder) { _subject = subject ?? throw new NullReferenceException(); _bounds = bounds ?? throw new NullReferenceException(); }