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


C# Camera.GetInstanceID方法代码示例

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


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

示例1: CreateMirrorObjects

    // On-demand create any objects we need
    private void CreateMirrorObjects( Camera currentCamera, out Camera reflectionCamera )
    {
        reflectionCamera = null;

        // Reflection render texture

        if( !m_ReflectionTexture || m_OldReflectionTextureSize != m_TextureSize )

        {

        if( m_ReflectionTexture )

        DestroyImmediate( m_ReflectionTexture );

        m_ReflectionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );

        m_ReflectionTexture.name = "__MirrorReflection" + GetInstanceID();

        m_ReflectionTexture.isPowerOfTwo = true;

        m_ReflectionTexture.hideFlags = HideFlags.DontSave;

        m_OldReflectionTextureSize = m_TextureSize;

        }

        // Camera for reflection

        reflectionCamera = m_ReflectionCameras[currentCamera] as Camera;

        if( !reflectionCamera ) // catch both not-in-dictionary and in-dictionary-but-deleted-GO

        {

        GameObject go = new GameObject( "Mirror Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );

        reflectionCamera = go.camera;

        reflectionCamera.enabled = false;

        reflectionCamera.transform.position = transform.position;

        reflectionCamera.transform.rotation = transform.rotation;

        reflectionCamera.gameObject.AddComponent("FlareLay er");

        go.hideFlags = HideFlags.HideAndDontSave;

        m_ReflectionCameras[currentCamera] = reflectionCamera;

        }
    }
开发者ID:topinambur,项目名称:prj2,代码行数:53,代码来源:MirrorReflection.cs

示例2: CreateWaterObjects

	// On-demand create any objects we need for water
	private void CreateWaterObjects( Camera currentCamera, out Camera reflectionCamera, out Camera refractionCamera )
	{
		WaterMode mode = GetWaterMode();
		
		reflectionCamera = null;
		refractionCamera = null;
		
		if( mode >= WaterMode.Reflective )
		{
			// Reflection render texture
			if( !m_ReflectionTexture || m_OldReflectionTextureSize != m_TextureSize )
			{
				if( m_ReflectionTexture )
					DestroyImmediate( m_ReflectionTexture );
				m_ReflectionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );
				m_ReflectionTexture.name = "__WaterReflection" + GetInstanceID();
				m_ReflectionTexture.isPowerOfTwo = true;
				m_ReflectionTexture.hideFlags = HideFlags.DontSave;
				m_OldReflectionTextureSize = m_TextureSize;
			}
			
			// Camera for reflection
			m_ReflectionCameras.TryGetValue(currentCamera, out reflectionCamera);
			if (!reflectionCamera) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
			{
				GameObject go = new GameObject( "Water Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
				reflectionCamera = go.GetComponent<Camera>();
				reflectionCamera.enabled = false;
				reflectionCamera.transform.position = transform.position;
				reflectionCamera.transform.rotation = transform.rotation;
				reflectionCamera.gameObject.AddComponent<FlareLayer>();
				go.hideFlags = HideFlags.HideAndDontSave;
				m_ReflectionCameras[currentCamera] = reflectionCamera;
			}
		}
		
		if( mode >= WaterMode.Refractive )
		{
			// Refraction render texture
			if( !m_RefractionTexture || m_OldRefractionTextureSize != m_TextureSize )
			{
				if( m_RefractionTexture )
					DestroyImmediate( m_RefractionTexture );
				m_RefractionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );
				m_RefractionTexture.name = "__WaterRefraction" + GetInstanceID();
				m_RefractionTexture.isPowerOfTwo = true;
				m_RefractionTexture.hideFlags = HideFlags.DontSave;
				m_OldRefractionTextureSize = m_TextureSize;
			}
			
			// Camera for refraction
			m_RefractionCameras.TryGetValue(currentCamera, out refractionCamera);
			if (!refractionCamera) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
			{
				GameObject go = new GameObject( "Water Refr Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
				refractionCamera = go.GetComponent<Camera>();
				refractionCamera.enabled = false;
				refractionCamera.transform.position = transform.position;
				refractionCamera.transform.rotation = transform.rotation;
				refractionCamera.gameObject.AddComponent<FlareLayer>();
				go.hideFlags = HideFlags.HideAndDontSave;
				m_RefractionCameras[currentCamera] = refractionCamera;
			}
		}
	}
开发者ID:ahvdesign,项目名称:Tower-Defense-Q,代码行数:66,代码来源:Water.cs

示例3: SetActiveCamera

	/**
	 * change which camera is active. Must be done in a way so that there is always 
     * an active camera
	 **/ 
	public void SetActiveCamera(Camera newActiveCamera) {
		Camera oldCamera = masterCamera;
		masterCamera = newActiveCamera;
		//masterCamera.enabled = true;
		masterCamera.camera.active = true;
		
		if(oldCamera != null && oldCamera != masterCamera) {
			oldCamera.camera.active = false;
			//oldCamera.enabled = false;
		}
		
		masterCamera.GetComponent<AudioListener>().enabled = true;
		
		Debug.Log("Camera updated to be "+newActiveCamera.GetInstanceID());
	}
开发者ID:mdeegler,项目名称:xeno,代码行数:19,代码来源:TouchManagerCS.cs

示例4: GetReflectionCamera

	/// <summary>
	/// Get or create the camera used for reflection.
	/// </summary>

	Camera GetReflectionCamera (Camera current, Material mat, int textureSize)
	{
		if (!mTex || mTexSize != textureSize)
		{
			if (mTex) DestroyImmediate(mTex);
			mTex = new RenderTexture(textureSize, textureSize, 16);
			mTex.name = "__MirrorReflection" + GetInstanceID();
			mTex.isPowerOfTwo = true;
			mTex.hideFlags = HideFlags.DontSave;
			mTexSize = textureSize;
		}

		Camera cam = mCameras[current] as Camera;

		if (!cam)
		{
			GameObject go = new GameObject("Mirror Refl Camera id" + GetInstanceID() + " for " + current.GetInstanceID(), typeof(Camera), typeof(Skybox));
			go.hideFlags = HideFlags.HideAndDontSave;

			cam = go.camera;
			cam.enabled = false;

			Transform t = cam.transform;
			t.position = mTrans.position;
			t.rotation = mTrans.rotation;

			cam.gameObject.AddComponent("FlareLayer");
			mCameras[current] = cam;
		}

		// Automatically update the reflection texture
		if (mat.HasProperty("_ReflectionTex")) mat.SetTexture("_ReflectionTex", mTex);
		return cam;
	}
开发者ID:JustSAT,项目名称:Tower-Defence,代码行数:38,代码来源:TasharenWater.cs

示例5: CreateMirrorObjects

    //-----------------------------------------------------
    // On-demand create any objects we need
    private void CreateMirrorObjects( Camera currentCamera, out Camera reflectionCamera )
    {
        reflectionCamera = null;

        // Reflection render texture
        if( !m_ReflectionTexture || m_OldReflectionTextureSize != m_TextureSize )
        {
            if( m_ReflectionTexture )
                DestroyImmediate( m_ReflectionTexture );
            m_ReflectionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );
            m_ReflectionTexture.name = "__MirrorReflection" + GetInstanceID();
            m_ReflectionTexture.isPowerOfTwo = true;
        //            m_ReflectionTexture.hideFlags = HideFlags.DontSave;
            m_ReflectionTexture.wrapMode = TextureWrapMode.Clamp;
            m_OldReflectionTextureSize = m_TextureSize;
        }

        // Camera for reflection
        reflectionCamera = m_ReflectionCameras[currentCamera] as Camera;
        if( !reflectionCamera ) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
        {
            GameObject go = new GameObject( "Mirror Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
        //            go.transform.parent = transform; // TODO vérifier si les caméras sont bien détruites par le gc quand elles ne sont plus référencées
            reflectionCamera = go.GetComponent<Camera>();
            reflectionCamera.enabled = false;
            reflectionCamera.transform.position = transform.position;
            reflectionCamera.transform.rotation = transform.rotation;
            reflectionCamera.gameObject.AddComponent<FlareLayer>();
        //            go.hideFlags = HideFlags.HideAndDontSave;
            m_ReflectionCameras[currentCamera] = reflectionCamera;
        }
    }
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:34,代码来源:MirrorReflection.cs

示例6: CreateMirrorObjects

    // On-demand create any objects we need
    private void CreateMirrorObjects( Camera currentCamera, out Camera reflectionCamera )
    {
        if( !m_ReflectionTexture ){
                m_ReflectionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );
                m_ReflectionTexture.name = "__MirrorReflection" + GetInstanceID();
                m_ReflectionTexture.isPowerOfTwo = true;
                m_ReflectionTexture.hideFlags = HideFlags.DontSave;
            }

        // Camera for reflection
        reflectionCamera = m_ReflectionCamera;
        if( !reflectionCamera ) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
        {
            GameObject go = new GameObject( "Mirror Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
            reflectionCamera = go.GetComponent<Camera>();
            reflectionCamera.enabled = true;
            go.hideFlags = HideFlags.DontSave;
            m_ReflectionCamera = reflectionCamera;
        //			reflectionCamera.gameObject.AddComponent("ReflectionCameraControl");
                reflectionCamera.gameObject.AddComponent<ReflectionCameraControl>();
        }

        reflectionCamera.depth = currentCamera.depth-1;
        reflectionCamera.fieldOfView = currentCamera.fieldOfView;
        reflectionCamera.transform.position = transform.position;
        reflectionCamera.transform.rotation = transform.rotation;
    }
开发者ID:quentin1of1,项目名称:Pirate-Game,代码行数:28,代码来源:MirrorReflection.cs

示例7: CreateWaterObjects

    // On-demand create any objects we need for water
    private void CreateWaterObjects( Camera currentCamera, out Camera reflectionCamera )
    {
        //WaterMode mode = GetWaterMode();
        GetWaterMode();

        reflectionCamera = null;
        // Reflection render texture
        if( !m_ReflectionTexture || m_OldReflectionTextureSize != m_TextureSize )
        {
            if( m_ReflectionTexture )
                DestroyImmediate( m_ReflectionTexture );
            m_ReflectionTexture = new RenderTexture( Screen.width, Screen.height, 16 );
            m_ReflectionTexture.name = "__WaterReflection" + GetInstanceID();
            m_ReflectionTexture.isPowerOfTwo = false;
            m_ReflectionTexture.hideFlags = HideFlags.DontSave;
            m_OldReflectionTextureSize = m_TextureSize;
        }

        // Camera for reflection
        reflectionCamera = m_ReflectionCameras[currentCamera] as Camera;
        if( !reflectionCamera ) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
        {
            GameObject go = new GameObject( "Water Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
            reflectionCamera = go.GetComponent<Camera>();
            reflectionCamera.enabled = false;
            reflectionCamera.transform.position = transform.position;
            reflectionCamera.transform.rotation = transform.rotation;
            reflectionCamera.gameObject.AddComponent<FlareLayer>();
            reflectionCamera.GetComponent<Camera>().useOcclusionCulling = false;
            reflectionCamera.GetComponent<Camera>().renderingPath = RenderingPath.VertexLit;
            go.hideFlags = HideFlags.HideAndDontSave;
            m_ReflectionCameras[currentCamera] = reflectionCamera;
        }
    }
开发者ID:merveilles,项目名称:WaitingForHorus,代码行数:35,代码来源:Water.cs

示例8: CreatePortalObjects

    // On-demand create any objects we need
    private void CreatePortalObjects(Camera currentCamera, out Camera portalCamera)
    {
        portalCamera = null;

        // Portal render texture
        if (!m_PortalTexture || m_OldPortalTextureSize != m_TextureSize)
        {
            if (m_PortalTexture)
                DestroyImmediate(m_PortalTexture);
            m_PortalTexture = new RenderTexture(m_TextureSize, m_TextureSize, 16);
            m_PortalTexture.name = "__PortalView" + GetInstanceID();
            m_PortalTexture.isPowerOfTwo = true;
            m_PortalTexture.hideFlags = HideFlags.DontSave;
            m_OldPortalTextureSize = m_TextureSize;
        }

        // Camera for reflection
        portalCamera = m_PortalCameras[currentCamera] as Camera;
        if (!portalCamera) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
        {
            GameObject go = new GameObject("Portal Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox));
            portalCamera = go.GetComponent<Camera>();
            portalCamera.enabled = false;
            portalCamera.transform.position = otherPortal.transform.position;
            portalCamera.transform.rotation = otherPortal.transform.rotation;
            portalCamera.gameObject.AddComponent<FlareLayer>();
            go.hideFlags = HideFlags.HideAndDontSave;
            m_PortalCameras[currentCamera] = portalCamera;
        }
    }
开发者ID:SPCoffey,项目名称:UnityPortalScript,代码行数:31,代码来源:Portal.cs


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