示例#1
0
 /// <summary>
 /// Create an ASL Object
 /// </summary>
 /// <param name="_prefabName">The name of the prefab to be instantiated. Make sure your prefab is located in the Resources/Prefabs folder so it can be found</param>
 /// <param name="_position">The position where the object will be instantiated</param>
 /// <param name="_rotation">The rotation orientation of the object to be instantiated</param>
 /// <param name="_parentID">The id or name of the parent object for this instantiated object</param>
 /// <param name="_componentAssemblyQualifiedName">The full name of the component to be added to this object upon creation.</param>
 /// <param name="_aslGameObjectCreatedCallbackInfo">This is the function that you want to be called after object creation</param>
 /// <param name="_aslClaimCancelledRecoveryFunctionInfo">This is the function that you want to be called whenever a claim is rejected/cancelled</param>
 /// <example><code>
 /// void SomeFunction()
 /// {
 ///     //Where gameObject is the parent of the object that is being created here and "MyNamespace.MyClass" is an example of a component you want to add
 ///     ASL.ASLHelper.InstanitateASLObject("MyPrefab", new Vector3(0, 0, 0), Quaternion.identity, gameobject.GetComponent&lt;ASL.ASLObject&gt;().m_Id,
 ///     "MyNamespace.MyClass",
 ///     MyUponInstantiationFunction,
 ///     MyClaimRejectedFunction);
 ///  }
 /// public static void MyUponInstantiationFunction(GameObject _myGameObject)
 /// {
 ///     Debug.Log("Caller-Object ID: " + _myGameObject.GetComponent&lt;ASL.ASLObject&gt;().m_Id);
 /// }
 ///
 /// public static void MyClaimRejectedFunction(string _id, int _cancelledCallbacks)
 /// {
 ///    Debug.LogWarning("We are going to cancel " + _cancelledCallbacks +
 ///       " callbacks generated by a claim for object: " + _id + " rather than try to recover.");
 /// }
 ///
 /// </code></example>
 static public void InstanitateASLObject(string _prefabName, Vector3 _position, Quaternion _rotation, string _parentID, string _componentAssemblyQualifiedName,
                                         ASLObject.ASLGameObjectCreatedCallback _aslGameObjectCreatedCallbackInfo,
                                         ASLObject.ClaimCancelledRecoveryCallback _aslClaimCancelledRecoveryFunctionInfo)
 {
     SendSpawnPrefab(_prefabName, _position, _rotation, _parentID ?? "", _componentAssemblyQualifiedName ?? "",
                     _aslGameObjectCreatedCallbackInfo?.Method?.ReflectedType?.ToString() ?? "", _aslGameObjectCreatedCallbackInfo?.Method?.Name ?? "",
                     _aslClaimCancelledRecoveryFunctionInfo?.Method?.ReflectedType?.ToString() ?? "", _aslClaimCancelledRecoveryFunctionInfo?.Method?.Name ?? "");
 }
示例#2
0
 /// <summary>
 /// Create an ASL Object
 /// </summary>
 /// <param name="_type">The primitive type to be instantiated</param>
 /// <param name="_position">The position where the object will be instantiated</param>
 /// <param name="_rotation">The rotation orientation of the object to be instantiated</param>
 /// <param name="_parentID">The id or name of the parent object for this instantiated object</param>
 /// <param name="_componentAssemblyQualifiedName">The full name of the component to be added to this object upon creation.</param>
 /// <param name="_aslGameObjectCreatedCallbackInfo">This is the function that you want to be called after object creation</param>
 /// <example><code>
 /// void SomeFunction()
 /// {
 ///     //Where gameObject is the parent of the object that is being created here and "MyNamespace.MyClass" is an example of a component you want to add
 ///     ASL.ASLHelper.InstanitateASLObject(PrimitiveType.Cube, new Vector3(0, 0, 0), Quaternion.identity, gameobject.GetComponent&lt;ASL.ASLObject&gt;().m_Id,
 ///     "MyNamespace.MyClass",
 ///     MyUponInstantiationFunction);
 /// }
 /// public static void MyUponInstantiationFunction(GameObject _myGameObject)
 /// {
 ///     Debug.Log("Caller-Object ID: " + _myGameObject.GetComponent&lt;ASL.ASLObject&gt;().m_Id);
 /// }
 ///
 /// </code></example>
 static public void InstanitateASLObject(PrimitiveType _type, Vector3 _position, Quaternion _rotation, string _parentID, string _componentAssemblyQualifiedName,
                                         ASLObject.ASLGameObjectCreatedCallback _aslGameObjectCreatedCallbackInfo)
 {
     SendSpawnPrimitive(_type, _position, _rotation, _parentID ?? "", _componentAssemblyQualifiedName ?? "",
                        _aslGameObjectCreatedCallbackInfo?.Method?.ReflectedType?.ToString() ?? "", _aslGameObjectCreatedCallbackInfo?.Method?.Name ?? "");
 }