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


C# Renderer.GetComponent方法代码示例

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


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

示例1: RemoveRenderer

		public void RemoveRenderer(Renderer rend) {
			if(AffectedRenderers.Contains(rend)) {
				AffectedRenderers.Remove(rend);
				mset.SkyAnchor anchor = rend.GetComponent<mset.SkyAnchor>();
				if(anchor && anchor.CurrentApplicator == this) anchor.CurrentApplicator = null;
			}
		}
开发者ID:keyward,项目名称:EnemyOfMyEnemy,代码行数:7,代码来源:SkyApplicator.cs

示例2: AddRenderer

		public void AddRenderer(Renderer rend) {
			mset.SkyAnchor anchor = rend.GetComponent<mset.SkyAnchor>();
			if(anchor != null) {
				if(anchor.CurrentApplicator != null) anchor.CurrentApplicator.RemoveRenderer(rend);
				anchor.CurrentApplicator = this;
			}
			AffectedRenderers.Add(rend);
		}
开发者ID:keyward,项目名称:EnemyOfMyEnemy,代码行数:8,代码来源:SkyApplicator.cs

示例3: DrawHierachy

 private void DrawHierachy(TreeData treeData, Renderer renderer, Rect sizeRect)
 {
     if (styles == null)
     {
         styles = new Styles();
     }
     this.hierachySpread = this.hierachyNodeSize + this.hierachyNodeSpace;
     this.hierachyView = sizeRect;
     Event event2 = new Event(Event.current);
     List<HierachyNode> nodes = new List<HierachyNode>();
     this.BuildHierachyNodes(treeData, nodes, treeData.root, 0);
     this.LayoutHierachyNodes(nodes, sizeRect);
     float num = 16f;
     Vector2 zero = Vector2.zero;
     if (sizeRect.width < this.hierachyRect.width)
     {
         zero.y -= 16f;
     }
     bool changed = GUI.changed;
     this.hierachyDisplayRect = GUILayoutUtility.GetRect(sizeRect.width, this.hierachyRect.height + num);
     this.hierachyDisplayRect.width = sizeRect.width;
     GUI.Box(this.hierachyDisplayRect, GUIContent.none, styles.nodeBackground);
     this.hierachyScroll = GUI.BeginScrollView(this.hierachyDisplayRect, this.hierachyScroll, this.hierachyRect, false, false);
     GUI.changed = changed;
     this.HandleDragHierachyNodes(treeData, nodes);
     this.DrawHierachyNodes(treeData, nodes, treeData.root, (Vector2) (zero / 2f), 1f, 1f);
     if ((this.dragNode != null) && this.isDragging)
     {
         Vector2 vector2 = Event.current.mousePosition - this.dragClickPos;
         this.DrawHierachyNodes(treeData, nodes, this.dragNode.group, vector2 + ((Vector2) (zero / 2f)), 0.5f, 0.5f);
     }
     GUI.EndScrollView();
     MeshFilter component = renderer.GetComponent<MeshFilter>();
     if (((component != null) && (component.sharedMesh != null)) && (renderer != null))
     {
         int length = component.sharedMesh.vertices.Length;
         int num3 = component.sharedMesh.triangles.Length / 3;
         int num4 = renderer.sharedMaterials.Length;
         Rect position = new Rect((this.hierachyDisplayRect.xMax - 80f) - 4f, ((this.hierachyDisplayRect.yMax + zero.y) - 40f) - 4f, 80f, 40f);
         string text = TreeEditorHelper.GetGUIContent("Hierachy Stats").text.Replace("[v]", length.ToString()).Replace("[t]", num3.ToString()).Replace("[m]", num4.ToString()).Replace(" / ", "\n");
         GUI.Label(position, text, EditorStyles.helpBox);
     }
     if ((event2.type == EventType.ScrollWheel) && (Event.current.type == EventType.Used))
     {
         Event.current = event2;
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:47,代码来源:TreeEditor.cs

示例4: HasNormals

 private static bool HasNormals(Renderer renderer)
 {
   Mesh mesh = (Mesh) null;
   if (renderer is MeshRenderer)
   {
     MeshFilter component = renderer.GetComponent<MeshFilter>();
     if ((UnityEngine.Object) component != (UnityEngine.Object) null)
       mesh = component.sharedMesh;
   }
   else if (renderer is SkinnedMeshRenderer)
     mesh = (renderer as SkinnedMeshRenderer).sharedMesh;
   return InternalMeshUtil.HasNormals(mesh);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:13,代码来源:LightingWindowObjectTab.cs

示例5: ApplyCorrectSky

		public void ApplyCorrectSky(Renderer rend) {
			//filter by ignored layers
			bool localCube = false;

			//if the anchor is a direct link to a sky, ignore applicators all together
			mset.SkyAnchor anchor = rend.GetComponent<SkyAnchor>();
			if(anchor && anchor.BindType == SkyAnchor.AnchorBindType.TargetSky) {
				anchor.Apply();
				localCube = true;	
			}

			//look for localized applicators to bind this renderer to
			foreach(mset.SkyApplicator app in skyApplicators) {
				if(localCube) app.RemoveRenderer(rend);
				else if(app.RendererInside(rend)) localCube = true;
			}

			//no local applicator found, but we have a global sky
			if(!localCube && _GlobalSky != null) {
				if(anchor != null) {
					if(anchor.CurrentApplicator != null) {
						anchor.CurrentApplicator.RemoveRenderer(rend);
						anchor.CurrentApplicator = null;
					}
					//start last blend to global sky and tell the anchor it's gone global
					anchor.BlendToGlobalSky(_GlobalSky);
				} else {
					//HACK: no applying to renderers outside of a sky anchor! it leaks memory.
					//_GlobalSky.Apply(rend,0);
				}

				if(!globalSkyChildren.Contains(rend)) globalSkyChildren.Add(rend);
			}

			//if a local cube was found or there is no global sky, remove rend
			if(localCube || _GlobalSky == null) { 
				if(globalSkyChildren.Contains(rend)) {
					globalSkyChildren.Remove(rend);
				}
			}
		}
开发者ID:keyward,项目名称:EnemyOfMyEnemy,代码行数:41,代码来源:SkyManager.cs

示例6: RegisterNewRenderer

		public void RegisterNewRenderer(Renderer rend) {
			//filter by active
			if(!rend.gameObject.activeInHierarchy) return;

			//filter by ignored layers
			int layerFlag = 1 << rend.gameObject.layer;
			if((IgnoredLayerMask & layerFlag) != 0) return;

			//sort by static/dynamic
			if(rend.gameObject.isStatic) {
				if(!staticRenderers.Contains(rend)) {
					staticRenderers.Add(rend);
					ApplyCorrectSky(rend);
				}
			} else if(!dynamicRenderers.Contains(rend)) {
				dynamicRenderers.Add(rend);
				if(rend.GetComponent<mset.SkyAnchor>() == null) {
					rend.gameObject.AddComponent(typeof(mset.SkyAnchor));
				}
			}
		}
开发者ID:keyward,项目名称:EnemyOfMyEnemy,代码行数:21,代码来源:SkyManager.cs

示例7: HasNormals

 private static bool HasNormals(Renderer renderer)
 {
     Mesh sharedMesh = null;
     if (renderer is MeshRenderer)
     {
         MeshFilter component = renderer.GetComponent<MeshFilter>();
         if (component != null)
         {
             sharedMesh = component.sharedMesh;
         }
     }
     else if (renderer is SkinnedMeshRenderer)
     {
         sharedMesh = (renderer as SkinnedMeshRenderer).sharedMesh;
     }
     return InternalMeshUtil.HasNormals(sharedMesh);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:17,代码来源:LightingWindowObjectTab.cs


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