public bool RemoveComponent(GameObjectComponent component, bool Destroy = true) //Remove a component from a gameobject { if (component == null) { return(false); } bool FoundComp = GameObjectComponents.Remove(component); if (Destroy && FoundComp) { component.Destroy(); } return(FoundComp); }
public bool AddComponent_Generic(GameObjectComponent component) //Add a component to a gameobject { bool CanBeAdded = false; foreach (Type type in CanBeAddedMultipleTimes) { if (type == component.GetType()) { CanBeAdded = true; break; } } if (GameObjectComponents.Find(Item => Item.GetType() == component.GetType()) == null || CanBeAdded) { component.gameObject = this; GameObjectComponents.Insert(GameObjectComponents.Count, component); return(true); } return(false); }
private T ConvertGOC <T>(GameObjectComponent GOC) where T : GameObjectComponent { return(GOC as T); }