/// <summary> /// Converts the specified object ID value into a managed game object. /// </summary> /// <param name="objectId">The object ID to convert.</param> /// <returns>The associated object if it exists, otherwise null.</returns> public static NwObject?ToNwObject(this uint objectId) { return(NwObject.CreateInternal(objectId)); }
/// <summary> /// Converts the specified object ID value into a managed game object. /// </summary> /// <param name="objectId">The object ID to convert.</param> /// <typeparam name="T">The expected object type.</typeparam> /// <returns>The associated object if it exists, otherwise null.</returns> /// <exception cref="InvalidCastException">Thrown if the object associated with the object ID is not of type T.</exception> public static T?ToNwObject <T>(this uint objectId) where T : NwObject { return((T?)NwObject.CreateInternal(objectId)); }
public static T?ToNwObjectSafe <T>(this ICGameObject gameObject) where T : NwObject { return(NwObject.CreateInternal(gameObject) as T); }
public static NwObject?ToNwObject(this ICGameObject gameObject) { return(NwObject.CreateInternal(gameObject)); }
public static T?ToNwObject <T>(this ICGameObject gameObject) where T : NwObject { return((T?)NwObject.CreateInternal(gameObject)); }
/// <summary> /// Attempts to resolve a living active game object from the specified UUID. /// </summary> /// <param name="objectId">The UUID of the object.</param> /// <typeparam name="T">The expected object type. If the object is not this type.</typeparam> /// <returns>The game object with the given UUID and the specified type, otherwise returns null.</returns> public static T?ToNwObjectSafe <T>(this Guid objectId) where T : NwObject { return(NwObject.CreateInternal(objectId) as T); }