本文整理汇总了C#中UnityEngine.ParticleSystem.GetComponentsInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.GetComponentsInChildren方法的具体用法?C# ParticleSystem.GetComponentsInChildren怎么用?C# ParticleSystem.GetComponentsInChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.ParticleSystem
的用法示例。
在下文中一共展示了ParticleSystem.GetComponentsInChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Scale
public static void Scale(ParticleSystem particles, float scale, bool includeChildren = true, ParticleScalerOptions options = null) {
ScaleSystem(particles, scale, false, options);
if (includeChildren) {
var children = particles.GetComponentsInChildren<ParticleSystem>(includeInactive: true); // my includeInactive addition
for (var i = children.Length; i-- > 0;) {
if (children[i] == particles) { continue; }
ScaleSystem(children[i], scale, true, options);
}
}
}
示例2: Initialize
public void Initialize(Diggable diggable)
{
this.diggable = diggable;
if (diggable.DigFX != null) {
parentFX = Instantiate(diggable.DigFX).GetComponent<ParticleSystem>();
parentFX.transform.parent = transform;
parentFX.enableEmission = false;
FXs = parentFX.GetComponentsInChildren<ParticleSystem>();
initialized = true;
}
}
示例3: ScaleByTransform
public static void ScaleByTransform(ParticleSystem particles, float scale, bool includeChildren = true) {
var mainModule = particles.main; // particles.scalingMode = ParticleSystemScalingMode.Local; Deprecated in Unity 5.5
mainModule.scalingMode = ParticleSystemScalingMode.Local;
particles.transform.localScale = particles.transform.localScale * scale;
mainModule.gravityModifierMultiplier *= scale; //particles.gravityModifier *= scale; Deprecated in Unity 5.5
if (includeChildren) {
var children = particles.GetComponentsInChildren<ParticleSystem>(includeInactive: true); // my includeInactive addition
for (var i = children.Length; i-- > 0;) {
if (children[i] == particles) {
continue;
}
var childMainModule = children[i].main;
childMainModule.scalingMode = ParticleSystemScalingMode.Local; //children[i].scalingMode = ParticleSystemScalingMode.Local; Deprecated in Unity 5.5
children[i].transform.localScale = children[i].transform.localScale * scale;
childMainModule.gravityModifierMultiplier *= scale; // children[i].gravityModifier *= scale; Deprecated in Unity 5.5
}
}
}