当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.AddComponent方法代码示例

本文整理汇总了C#中UnityEngine.AddComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UnityEngine.AddComponent方法的具体用法?C# UnityEngine.AddComponent怎么用?C# UnityEngine.AddComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine的用法示例。


在下文中一共展示了UnityEngine.AddComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DynamicSequenceOpen

  public static uint DynamicSequenceOpen(UnityEngine.GameObject in_gameObjectID, uint in_uFlags, AkCallbackManager.EventCallback in_pfnCallback, object in_pCookie) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
		in_pCookie = new AkCallbackManager.EventCallbackPackage(in_pfnCallback, in_pCookie);
    {
      uint ret = AkSoundEnginePINVOKE.CSharp_DynamicSequenceOpen__SWIG_1(tempin_gameObjectID, in_uFlags, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:25,代码来源:AkSoundEngine_Windows.cs

示例2: HandleCustomProperties

    public void HandleCustomProperties(UnityEngine.GameObject gameObject,
	                                   IDictionary<string, string> props)
    {
        // Simply add a component to our GameObject
        if (props.ContainsKey ("PrefabPath")) {
            string path = props["PrefabPath"];
            UnityEngine.Object spawn =
                AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
            if (spawn != null)
            {
                GameObject spawnInstance =
                    (GameObject)GameObject.Instantiate(spawn);
                spawnInstance.name = spawn.name;

                // Use the position of the game object we're attached to
                spawnInstance.transform.parent = gameObject.transform;
                spawnInstance.transform.localPosition = Vector3.zero;
                gameObject.transform.localScale = Vector3.one * 100;
            }
        }
        if (props.ContainsKey ("Platform")) {
            gameObject.GetComponent<Collider2D>().usedByEffector = true;
            gameObject.AddComponent<PlatformEffector2D>().surfaceArc = 170f;
        }
        if(props.ContainsKey("ColliderMaterial"))
        {
            foreach(Collider2D collider in gameObject.GetComponentsInChildren<Collider2D>())
            {
                string path = props["ColliderMaterial"];
                collider.sharedMaterial = (PhysicsMaterial2D)AssetDatabase.LoadAssetAtPath(path, typeof(PhysicsMaterial2D));
            }
        }
    }
开发者ID:LUDUSLab,项目名称:Dinopixel,代码行数:33,代码来源:ICustomTiledImporter.cs

示例3: HandleCustomProperties

    public void HandleCustomProperties(UnityEngine.GameObject gameObject,
        IDictionary<string, string> props)
    {
        if (props.ContainsKey("TargetDoor")) {
            gameObject.AddComponent<MurderMystery.DoorwayScript>();
            gameObject.GetComponent<MurderMystery.DoorwayScript>().targetDoor = props["TargetDoor"];
        }

        if (props.ContainsKey("Room")) {
            gameObject.AddComponent<MurderMystery.ContainerScript>();
            gameObject.GetComponent<MurderMystery.ContainerScript>().roomName = props["Room"];
            gameObject.tag = "Container";
            gameObject.layer = LayerMask.NameToLayer("Containers");
        }

        if (props.ContainsKey("Ceiling")) {
            gameObject.layer = LayerMask.NameToLayer("Ceilings");
            gameObject.tag = "Ceiling";
            Ceiling ceiling = gameObject.AddComponent<Ceiling>();
            ceiling.roomName = props["Ceiling"];
        }
    }
开发者ID:Warcrea,项目名称:Procedural-Murder-Mystery,代码行数:22,代码来源:DoorwayImporter.cs

示例4: DynamicSequenceOpen

  public static uint DynamicSequenceOpen(UnityEngine.GameObject in_gameObjectID, uint in_uFlags, AkCallbackManager.EventCallback in_pfnCallback, object in_pCookie) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();

				// Note: We have missed AkGameObject.Awake() of this run to register. 
				// So we take over its work by inlining it here.
				AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
			
				//Set the original position
				AkSoundEngine.SetObjectPosition(
		            in_gameObjectID, 
		            in_gameObjectID.transform.position.x, 
		            in_gameObjectID.transform.position.y, 
		            in_gameObjectID.transform.position.z, 
		            in_gameObjectID.transform.forward.x,
		            in_gameObjectID.transform.forward.y, 
		            in_gameObjectID.transform.forward.z
		        	);
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
		in_pCookie = new AkCallbackManager.EventCallbackPackage(in_pfnCallback, in_pCookie);
    {
      uint ret = AkSoundEnginePINVOKE.CSharp_DynamicSequenceOpen__SWIG_1(tempin_gameObjectID, in_uFlags, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    }
  }
开发者ID:juliendeville,项目名称:Lunatic,代码行数:40,代码来源:AkSoundEngine_iOS.cs

示例5: HandleCustomProperties

    public void HandleCustomProperties(UnityEngine.GameObject gameObject,
        IDictionary<string, string> props)
    {
        // Simply add a component to our GameObject
        // BETTER STYLE
        if (props.ContainsKey("side"))
        {
            gameObject.name = "TileConnector";
            TileConnector tileConnector = gameObject.AddComponent<TileConnector>();
            tileConnector.side = props["side"];
            tileConnector.connected = false;

            if(props.ContainsKey("type")) {
                tileConnector.type = Convert.ToInt32(props["type"]);
            }

        }

        // OLD STYLE
        //		if (props.ContainsKey("side"))
        //		{
        //			string prefabPath = "Assets/Prefabs/TileConnector.prefab";
        //			UnityEngine.Object connector = UnityEditor.AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject));
        //			if (connector != null)
        //			{
        //				GameObject connectorInstance = (GameObject)GameObject.Instantiate(connector);
        //				connectorInstance.name = connector.name;
        //				TileConnector tileConnector = connectorInstance.GetComponent("TileConnector") as TileConnector;
        //				tileConnector.side = props["side"];
        //
        //				if(props.ContainsKey("type")) {
        //					tileConnector.type = Convert.ToInt32(props["type"]);
        //				}
        //
        //				// Use the position of the game object we're attached to
        //				connectorInstance.transform.parent = gameObject.transform;
        //				connectorInstance.transform.localPosition = Vector3.zero;
        //			}
        //		}
    }
开发者ID:Fenrir08,项目名称:Lost-Sector-Unity,代码行数:40,代码来源:ICustomTiledImporter.cs

示例6: SeekOnEvent

  public static AKRESULT SeekOnEvent(string in_pszEventName, UnityEngine.GameObject in_gameObjectID, int in_iPosition, bool in_bSeekToNearestMarker) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_SeekOnEvent__SWIG_2(in_pszEventName, tempin_gameObjectID, in_iPosition, in_bSeekToNearestMarker);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例7: ExecuteActionOnEvent

  public static AKRESULT ExecuteActionOnEvent(string in_pszEventName, AkActionOnEventType in_ActionType, UnityEngine.GameObject in_gameObjectID) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_ExecuteActionOnEvent__SWIG_8(in_pszEventName, (int)in_ActionType, tempin_gameObjectID);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例8: GetRTPCValue

  public static AKRESULT GetRTPCValue(string in_pszRtpcName, UnityEngine.GameObject in_gameObjectID, out float out_rValue, ref int io_rValueType) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetRTPCValue__SWIG_1(in_pszRtpcName, tempin_gameObjectID, out out_rValue, ref io_rValueType);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例9: SetObjectPosition

  public static AKRESULT SetObjectPosition(UnityEngine.GameObject in_GameObjectID, float PosX, float PosY, float PosZ, float OrientationX, float OrientationY, float OrientationZ) {
    
		uint tempin_GameObjectID;
		if ( in_GameObjectID != null )
		{
			tempin_GameObjectID = (uint)in_GameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_GameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_GameObjectID.AddComponent<AkGameObject>();

				// Note: We have missed AkGameObject.Awake() of this run to register. 
				// So we take over its work by inlining it here.
				AkSoundEngine.RegisterGameObj(in_GameObjectID, in_GameObjectID.name);
			
				//Set the original position
				AkSoundEngine.SetObjectPosition(
		            in_GameObjectID, 
		            in_GameObjectID.transform.position.x, 
		            in_GameObjectID.transform.position.y, 
		            in_GameObjectID.transform.position.z, 
		            in_GameObjectID.transform.forward.x,
		            in_GameObjectID.transform.forward.y, 
		            in_GameObjectID.transform.forward.z
		        	);
			}
		}
		else
		{
			tempin_GameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_SetObjectPosition(tempin_GameObjectID, PosX, PosY, PosZ, OrientationX, OrientationY, OrientationZ);

      return ret;
    }
  }
开发者ID:juliendeville,项目名称:Lunatic,代码行数:39,代码来源:AkSoundEngine_iOS.cs

示例10: GetGameObjectAuxSendValues

  public static AKRESULT GetGameObjectAuxSendValues(UnityEngine.GameObject in_gameObjectID, AkAuxSendArray out_paAuxSendValues, ref uint io_ruNumSendValues) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();

				// Note: We have missed AkGameObject.Awake() of this run to register. 
				// So we take over its work by inlining it here.
				AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
			
				//Set the original position
				AkSoundEngine.SetObjectPosition(
		            in_gameObjectID, 
		            in_gameObjectID.transform.position.x, 
		            in_gameObjectID.transform.position.y, 
		            in_gameObjectID.transform.position.z, 
		            in_gameObjectID.transform.forward.x,
		            in_gameObjectID.transform.forward.y, 
		            in_gameObjectID.transform.forward.z
		        	);
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetGameObjectAuxSendValues(tempin_gameObjectID, out_paAuxSendValues.m_Buffer, ref io_ruNumSendValues);

      return ret;
    }
  }
开发者ID:juliendeville,项目名称:Lunatic,代码行数:39,代码来源:AkSoundEngine_iOS.cs

示例11: ResetRTPCValue

  public static AKRESULT ResetRTPCValue(string in_pszRtpcName, UnityEngine.GameObject in_gameObjectID, int in_uValueChangeDuration, AkCurveInterpolation in_eFadeCurve) {
    
		uint tempin_gameObjectID;
		if ( in_gameObjectID != null )
		{
			tempin_gameObjectID = (uint)in_gameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_gameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_gameObjectID.AddComponent<AkGameObject>();

				// Note: We have missed AkGameObject.Awake() of this run to register. 
				// So we take over its work by inlining it here.
				AkSoundEngine.RegisterGameObj(in_gameObjectID, in_gameObjectID.name);
			
				//Set the original position
				AkSoundEngine.SetObjectPosition(
		            in_gameObjectID, 
		            in_gameObjectID.transform.position.x, 
		            in_gameObjectID.transform.position.y, 
		            in_gameObjectID.transform.position.z, 
		            in_gameObjectID.transform.forward.x,
		            in_gameObjectID.transform.forward.y, 
		            in_gameObjectID.transform.forward.z
		        	);
			}
		}
		else
		{
			tempin_gameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_ResetRTPCValue__SWIG_4(in_pszRtpcName, tempin_gameObjectID, in_uValueChangeDuration, (int)in_eFadeCurve);

      return ret;
    }
  }
开发者ID:juliendeville,项目名称:Lunatic,代码行数:39,代码来源:AkSoundEngine_iOS.cs

示例12: SetObjectPosition

  public static AKRESULT SetObjectPosition(UnityEngine.GameObject in_GameObjectID, float PosX, float PosY, float PosZ, float OrientationX, float OrientationY, float OrientationZ) {
    
		uint tempin_GameObjectID;
		if ( in_GameObjectID != null )
		{
			tempin_GameObjectID = (uint)in_GameObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_GameObjectID.GetComponent<AkGameObject>() == null)
			{
				in_GameObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_GameObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_SetObjectPosition(tempin_GameObjectID, PosX, PosY, PosZ, OrientationX, OrientationY, OrientationZ);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例13: GetPlayingIDsFromGameObject

  public static AKRESULT GetPlayingIDsFromGameObject(UnityEngine.GameObject in_GameObjId, ref uint io_ruNumIDs, uint[] out_aPlayingIDs) {
    
		uint tempin_GameObjId;
		if ( in_GameObjId != null )
		{
			tempin_GameObjId = (uint)in_GameObjId.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_GameObjId.GetComponent<AkGameObject>() == null)
			{
				in_GameObjId.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_GameObjId = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetPlayingIDsFromGameObject(tempin_GameObjId, ref io_ruNumIDs, out_aPlayingIDs);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例14: GetMaxRadius

  public static float GetMaxRadius(UnityEngine.GameObject in_GameObjId) {
    
		uint tempin_GameObjId;
		if ( in_GameObjId != null )
		{
			tempin_GameObjId = (uint)in_GameObjId.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_GameObjId.GetComponent<AkGameObject>() == null)
			{
				in_GameObjId.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_GameObjId = unchecked((uint)-1);
		}
		
		
    {
      float ret = AkSoundEnginePINVOKE.CSharp_GetMaxRadius(tempin_GameObjId);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs

示例15: GetObjectObstructionAndOcclusion

  public static AKRESULT GetObjectObstructionAndOcclusion(UnityEngine.GameObject in_ObjectID, uint in_uListener, out float out_rfObstructionLevel, out float out_rfOcclusionLevel) {
    
		uint tempin_ObjectID;
		if ( in_ObjectID != null )
		{
			tempin_ObjectID = (uint)in_ObjectID.GetInstanceID();
			// Note: if AkGameObjectTracker is already attached, the following code will be bypassed.
			if (in_ObjectID.GetComponent<AkGameObject>() == null)
			{
				in_ObjectID.AddComponent<AkGameObject>();
			}
		}
		else
		{
			tempin_ObjectID = unchecked((uint)-1);
		}
		
		
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_GetObjectObstructionAndOcclusion(tempin_ObjectID, in_uListener, out out_rfObstructionLevel, out out_rfOcclusionLevel);

      return ret;
    }
  }
开发者ID:Arpit0492,项目名称:Unity,代码行数:24,代码来源:AkSoundEngine_Windows.cs


注:本文中的UnityEngine.AddComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。