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


C# EffectNode.SetLocalPosition方法代码示例

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


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

示例1: SetEmitPosition

 public void SetEmitPosition(EffectNode node)
 {
     Vector3 retPos  = Vector3.zero;
     if (Layer.EmitType == (int)EMITTYPE.BOX)
     {
         Vector3 center = Layer.EmitPoint;
         float x = Random.Range(center.x - Layer.BoxSize.x / 2, center.x + Layer.BoxSize.x / 2);
         float y = Random.Range(center.y - Layer.BoxSize.y / 2, center.y + Layer.BoxSize.y / 2);
         float z = Random.Range(center.z - Layer.BoxSize.z / 2, center.z + Layer.BoxSize.z / 2);
         retPos.x = x; retPos.y = y; retPos.z = z;
         if (!Layer.SyncClient)
             retPos = Layer.ClientTransform.position + retPos;
     }
     else if (Layer.EmitType == (int)EMITTYPE.POINT)
     {
         retPos = Layer.EmitPoint;
         if (!Layer.SyncClient)
         {
             retPos = Layer.ClientTransform.position + Layer.EmitPoint;
         }
     }
     else if (Layer.EmitType == (int)EMITTYPE.SPHERE)
     {
         retPos = Layer.EmitPoint;
         if (!Layer.SyncClient)
         {//ͬ���Ļ���NodeUpdate������λ��
             retPos = Layer.ClientTransform.position + Layer.EmitPoint;
         }
         Vector3 r = Vector3.up * Layer.Radius;
         Quaternion rot = Quaternion.Euler(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360));
         retPos = rot * r + retPos;
     }
     //NOTICE LINE Direction currently is based on ClientTransform's forward
     else if (Layer.EmitType == (int)EMITTYPE.LINE)
     {
         Vector3 left = Layer.EmitPoint + Layer.ClientTransform.localRotation * Vector3.forward * Layer.LineLengthLeft;
         Vector3 right = Layer.EmitPoint + Layer.ClientTransform.localRotation * Vector3.forward * Layer.LineLengthRight;
         Vector3 dir = right - left;
         float p = (float)(node.Index + 1) / Layer.MaxENodes;
         float length = dir.magnitude * p;
         retPos = left + dir.normalized * length;
         if (!Layer.SyncClient)
             retPos = Layer.ClientTransform.TransformPoint(retPos);
     }
     else if (Layer.EmitType == (int)EMITTYPE.CIRCLE)
     {
         float p = (float)(node.Index + 1) / Layer.MaxENodes;
         float rangle;
         rangle = 360 * p;
         Quaternion rotY = Quaternion.Euler(0, rangle, 0);
         Vector3 v = rotY * (Vector3.right * Layer.Radius);
         Quaternion rotTo = Quaternion.FromToRotation(Vector3.up, Layer.CircleDir);
         retPos = rotTo * v;
         if (!Layer.SyncClient)
             retPos = Layer.ClientTransform.position + retPos + Layer.EmitPoint;
         else
             retPos = retPos + Layer.EmitPoint;
     }
     node.SetLocalPosition(retPos);
 }
开发者ID:wskidmore,项目名称:mdc,代码行数:60,代码来源:Emitter.cs


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