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 + "\""); } }
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); }
public bool HasComponent <T>() { Component2D com = Components.Find(x => x is T); return(com != null ? true : false); }