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


C# BuildingBlock.GetComponentInChildren方法代码示例

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


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

示例1: OnEntityBuilt

 void OnEntityBuilt(Planner planner, GameObject gameObject)
 {
     cachedBlock = gameObject.GetComponent<BuildingBlock>();
     if (cachedBlock == null) return;
     if (cachedBlock.blockDefinition == null) return;
     if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") return;
     cachedBlock.GetComponentInChildren<MeshCollider>().gameObject.AddComponent<TriggerBase>();
     cachedBlock.GetComponentInChildren<TriggerBase>().gameObject.layer = triggerLayer;
     cachedBlock.GetComponentInChildren<TriggerBase>().interestLayers = playerMask;
     timer.Once(0.1f, () => ResetBlock(cachedBlock) );
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:11,代码来源:BlockBlockElevators.cs

示例2: SetInfo

 public void SetInfo(ElevatorInfo info)
 {
     this.info = info;
     var cwaypoints = Interface.CallHook("GetWaypointsList", this.info.WaypointsName);
     if (cwaypoints == null)
     {
         Debug.Log(string.Format("{0} was destroyed, informations are invalid. Did you set waypoints? or a PrefabName?", info.Name));
         GameObject.Destroy(this);
         return;
     }
     this.waypoints = new List<WaypointInfo>();
     foreach (var cwaypoint in (List<object>)cwaypoints)
     {
         foreach (KeyValuePair<Vector3, float> pair in (Dictionary<Vector3,float>)cwaypoint)
         {
             this.waypoints.Add(new WaypointInfo(pair.Key, pair.Value));
         }
     }
     if (this.waypoints.Count < 2)
     {
         Debug.Log(string.Format("{0} waypoints were detected for {1}. Needs at least 2 waypoints. Destroying.", this.waypoints.Count.ToString(), info.Name));
         GameObject.Destroy(this);
         return;
     }
     this.rotation = new UnityEngine.Quaternion(Convert.ToSingle(info.rx), Convert.ToSingle(info.ry), Convert.ToSingle(info.rz), Convert.ToSingle(info.rw));
     this.block = CreateBuildingBlock(this.info.PrefabName, this.waypoints[0].GetPosition(), this.rotation, Convert.ToInt32(this.info.Grade));
     if(this.block == null)
     {
         Debug.Log(string.Format("Something went wrong, couldn't create the BuildingBlock for {0}", info.Name));
         GameObject.Destroy(this);
         return;
     }
     protectedBlock.Add(this.block.GetComponent<BaseCombatEntity>());
     trigger = block.GetComponentInChildren<MeshCollider>().gameObject.AddComponent<TriggerBase>();
     trigger.gameObject.name = "Elevator";
     var newlayermask = new UnityEngine.LayerMask();
     newlayermask.value = 133120;
     trigger.interestLayers = newlayermask;
     trigger.gameObject.layer = UnityEngine.LayerMask.NameToLayer("Trigger");
     spawnedElevators.Add(this);
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:41,代码来源:Elevators.cs

示例3: ResetBlock

 void ResetBlock(BuildingBlock block)
 {
     if (block == null) return;
     block.constructionCollision.UpdateLayer(false);
     GameObject.Destroy(block.GetComponentInChildren<TriggerBase>());
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:6,代码来源:BlockBlockElevators.cs


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