Esempio n. 1
0
 /// <summary>
 ///  Gets the component of type <typeparamref  name="T"/> from current entity or first parent entity. If component does not exists, throws an exception
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public T GetComponentInParent <T>() where T : BaseComponent
 {
     return(SourceEntity.GetComponentInParentDefault <T>() ?? throw new ArgumentException($"Component '{typeof(T).Name}' does not belong to current entity or any other parent entities"));
 }
Esempio n. 2
0
 /// <summary>
 ///  Gets the component of type <typeparamref  name="T"/> from current entity or first parent entity. Returns default value if component does not exists
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public T GetComponentInParentOrDefault <T>() where T : BaseComponent
 {
     return(SourceEntity.GetComponentInParentDefault <T>());
 }