Beispiel #1
0
        /// <summary>
        /// Check if this object is of the specified UE type.
        /// </summary>
        /// <param name="baseClass">Expected UE type of this UObject instance.</param>
        /// <returns>true if the instance is of the specified UE type, false otherwise</returns>
        public bool IsA(UClass baseClass)
        {
            var thisClass = (UClass)this.GetType();

            if (thisClass == baseClass)
            {
                return(true);
            }
            return(thisClass.IsChildOf(baseClass));
        }
Beispiel #2
0
 /// <summary>
 ///     Construct a TSubclassOf instance encapsulating the given UClass instance.
 /// </summary>
 /// <param name="clazz">UClass instance to assign to this TSubclassOf instance, or null.</param>
 public TSubclassOf(UClass clazz)
 {
     if (clazz != null)
     {
         if (!clazz.IsChildOf((UClass)typeof(TBaseClass)))
         {
             throw new ArgumentException($"{clazz.Name} is not a subclass of {typeof(TBaseClass).Name}!", nameof(clazz));
         }
     }
     Class = clazz;
 }
Beispiel #3
0
 /// <summary>
 /// Construct a TSubclassOf instance encapsulating the given UClass instance.
 /// </summary>
 /// <param name="clazz">UClass instance to assign to this TSubclassOf instance, or null.</param>
 public TSubclassOf(UClass clazz)
 {
     if (clazz != null)
     {
         if (!clazz.IsChildOf((UClass)typeof(TBaseClass)))
         {
             throw new ArgumentException(
                       String.Format(
                           "{0} is not a subclass of {1}!",
                           clazz.Name, typeof(TBaseClass).Name
                           ),
                       "clazz"
                       );
         }
     }
     Class = clazz;
 }
Beispiel #4
0
 /// <summary>
 ///     Check if this UE type is derived from the specified UE type.
 /// </summary>
 /// <param name="baseClass">A base class.</param>
 /// <returns>true is this class is derived from baseClass, false otherwise</returns>
 public bool IsChildOf(UClass baseClass)
 {
     return(ObjectUtils.IsClassChildOf(NativeObject, baseClass.NativeObject));
 }
Beispiel #5
0
 // Hide UObject.IsA(), IsChildOf() should be used instead when dealing with UClass instances.
 private new bool IsA(UClass baseClass)
 {
     return(base.IsA(baseClass));
 }