Ejemplo n.º 1
0
        public T AddComponent <T>() where T : YuoComponent, new()
        {
            if (GetComponent <T>() != null)
            {
                return(GetComponent <T>());
            }
            T component = new T();

            component.Entity = this;
            var type = typeof(T);

            Components.Add(type, component);
            World.Instance.AddComponet(this, component);
            Parent?.AddChildComponent(type, component);
            return(component);
        }