/// <summary> /// Add specified hudElement as child, and rename it. /// </summary> /// <param name="hudElement">The hudElement to be added</param> /// <param name="newName">The new hudElement name</param> public void Add(HudElement hudElement, string newName) { hudElement.name = newName; if(hudElement == this) { } else { hudElement.parent = this; children.Add(hudElement.name, hudElement); } }
/// <summary> /// Add specified hudElement as child. /// </summary> /// <param name="hudElement">The hudElement to be added</param> public void Add(HudElement hudElement) { if(hudElement == this) { } else { hudElement.parent = this; children.Add(hudElement.name, hudElement); } }
/// <summary> /// Checks if this hudElement contains the specified hudElement. /// </summary> /// <param name="hudElement">The hudElement</param> /// <returns>True if this hudElement contains the specified hudElement</returns> public bool HasChild(HudElement hudElement) { return this == hudElement.parent; // TODO: performance check //return children.ContainsValue(hudElement); }
/// <summary> /// Delete and detach specified child. /// </summary> /// <param name="hudElement">The child</param> public void RemoveChild(HudElement hudElement) { if(children.ContainsValue(hudElement)) { hudElement = null; children.Remove(hudElement.name); //TODO: performance } }
public bool Equals(HudElement obj) { return name == obj.name; }