本文整理汇总了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) );
}
示例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);
}
示例3: ResetBlock
void ResetBlock(BuildingBlock block)
{
if (block == null) return;
block.constructionCollision.UpdateLayer(false);
GameObject.Destroy(block.GetComponentInChildren<TriggerBase>());
}