示例#1
0
        public void RemoveComponent <T>()
        {
            Component2D Com = Components.Find(x => x is T);

            if (Com != null)
            {
                Components.Remove(Com);
            }
            else
            {
                Debug.LogError("2DObject \"" + ObjectName + "\" does not already contain the component \"" + typeof(T).Name + "\"");
            }
        }
示例#2
0
        public Component2D AddComponent(Component2D component)
        {
            if (component != null)
            {
                Components.Add(component);
                component.LinkedObject = this;
                component.Awake();
                component.Start();
                if (ComponentAdded != null)
                {
                    ComponentAdded(component);
                }
            }

            return(component);
        }
示例#3
0
        public bool HasComponent <T>()
        {
            Component2D com = Components.Find(x => x is T);

            return(com != null ? true : false);
        }