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


C# RawImage.GetComponent方法代码示例

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


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

示例1: SetupImages

	void SetupImages() {
		//MyPlayer1.GetComponent<CustomController>().m_Camera = MyPlayer1.gameObject.transform.GetChild(0).GetComponent<Camera>();
		//MyPlayer2.GetComponent<CustomController>().m_Camera = MyPlayer2.gameObject.transform.GetChild(0).GetComponent<Camera>();
		
		GameObject MyImage1Object = new GameObject ();
		MyImage1Object.AddComponent<RawImage> ();
		MyImage1 = MyImage1Object.GetComponent<RawImage>();
		MyImage1.GetComponent<RawImage> ().texture = MyRenderTexture1;
		RectTransform MyRectTransform1 = MyImage1Object.GetComponent<RectTransform> ();
		MyRectTransform1.anchorMin = new Vector2 (0, 0);
		MyRectTransform1.anchorMax = new  Vector2 (1, 1);
		MyRectTransform1.sizeDelta = new Vector2(0, 0);
		MyRectTransform1.localPosition = new Vector2 (0, 0);
		MyImage1Object.layer = MyUILayer;
		MyImage1Object.name = "MyImage1";
		MyImage1Object.transform.SetParent (MyCanvas.transform, false);
		
		GameObject MyImage2Object = new GameObject ();
		MyImage2Object.AddComponent<RawImage> ();
		MyImage2 = MyImage2Object.GetComponent<RawImage>();
		MyImage2.GetComponent<RawImage> ().texture = MyRenderTexture2;
		RectTransform MyRectTransform2 = MyImage2Object.GetComponent<RectTransform> ();
		MyRectTransform2.anchorMin = new Vector2 (0, 0);
		MyRectTransform2.anchorMax = new  Vector2 (1, 1);
		MyImage2Object.transform.SetParent (MyCanvas.transform, false);
		MyImage2Object.name = "MyImage2";
		MyImage2Object.layer = MyUILayer;
		
		MyImage1Object.SetActive (false);
		MyImage2Object.SetActive (false);
		SpawnedMainCamera = new GameObject ();
		SpawnedMainCamera.AddComponent<Camera> ();
		SpawnedMainCamera.tag = "MainCamera";
		SpawnedMainCamera.SetActive (false);
	}
开发者ID:Deus0,项目名称:Zeltex,代码行数:35,代码来源:FadeCamera.cs

示例2: Initialize

    public void Initialize()
    {
        GameObject ob = GameObject.Find("COLLECT_PLACE");
        if (ob != null)
        {
            RawImage rawimage = ob.transform.GetChild(0).GetComponent<RawImage>();
            rawimage.gameObject.SetActive(true);

            Image = Instantiate<RawImage>(rawimage);
            Image.transform.parent = ob.gameObject.transform;
            Image.name += "-" + gameObject.name;
            Image.transform.localScale = new Vector3(1, 1, 1);

            RectTransform rect = Image.GetComponent<RectTransform>();
            RectTransform rectorgi = rawimage.GetComponent<RectTransform>();

            this.rect = rect;

            rect.offsetMin = new Vector2(rectorgi.offsetMin.x, rectorgi.offsetMin.y);
            rect.offsetMax = new Vector2(rectorgi.offsetMax.x, rectorgi.offsetMax.y);

            Image.texture = GetComponent<Building>().ResourceProduction.getSprite().texture;
            rawimage.gameObject.SetActive(false);

        }
        else Debug.LogError("Cant Find TIMER_TEXT");
    }
开发者ID:Lukasz199312,项目名称:ClickCraft,代码行数:27,代码来源:MoveItemCollect.cs

示例3: cloneBlockId

	private void cloneBlockId (RawImage rawImage)
	{
		DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
		if (cell.blockIdTop > 0) {
			Global.selectedBlockId = cell.blockIdTop;
			Global.showNotyMessage ("Block copied.");
			ToolsController.deactivateCloneBucket ();
		}else if(cell.blockIdBottom > 0){
			Global.selectedBlockId = cell.blockIdBottom;
			Global.showNotyMessage ("Block copied.");
			ToolsController.deactivateCloneBucket ();
		}else{
			// Ignore. Do nothing.
		}
	}
开发者ID:balamsoft,项目名称:PaintCraft,代码行数:15,代码来源:DrawingCellController.cs

示例4: placeSelectedBlock

	// If the clicked cell is empty then place the selected block in it.
	private void placeSelectedBlock (RawImage rawImage){
		DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
		cell.placeBlockOnCell (rawImage);
	}
开发者ID:balamsoft,项目名称:PaintCraft,代码行数:5,代码来源:DrawingCellController.cs

示例5: clearCellBlock

	private void clearCellBlock (RawImage rawImage)
	{
		DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
		cell.removeBlockOnCell (rawImage);
	}
开发者ID:balamsoft,项目名称:PaintCraft,代码行数:5,代码来源:DrawingCellController.cs


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