コード例 #1
0
        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);
        }
コード例 #2
0
 public PortatGraphicsComponent(IHavePortrait subject, Shape bounds, GameObject holder) : base(holder)
 {
     _subject = subject ?? throw new NullReferenceException();
     _bounds  = bounds ?? throw new NullReferenceException();
 }