Example #1
0
        public void SetRenderType(int type)
        {
            Type = type;

            if (type == 0)
            {
                RenderObj = Owner.GetVertexPool().AddSprite(Owner.SpriteWidth, Owner.SpriteHeight,
                                                            (STYPE)Owner.SpriteType, (ORIPOINT)Owner.OriPoint, 60f, IsSimpleSprite());
            }
            else if (type == 1)
            {
                float rwidth = Owner.RibbonWidth;
                float rlen   = Owner.RibbonLen;
                if (Owner.UseRandomRibbon)
                {
                    rwidth = UnityEngine.Random.Range(Owner.RibbonWidthMin, Owner.RibbonWidthMax);
                    rlen   = UnityEngine.Random.Range(Owner.RibbonLenMin, Owner.RibbonLenMax);
                }
                RenderObj = Owner.GetVertexPool().AddRibbonTrail(Owner.FaceToObject, Owner.FaceObject,
                                                                 rwidth, Owner.MaxRibbonElements, rlen, Owner.ClientTransform.position + Owner.EmitPoint, 60f);
            }
            else if (type == 2)
            {
                RenderObj = Owner.GetVertexPool().AddCone(Owner.ConeSize, Owner.ConeSegment,
                                                          Owner.ConeAngle, Owner.OriVelocityAxis, 0, 60f, Owner.UseConeAngleChange, Owner.ConeDeltaAngle);
            }
            else if (type == 3)
            {
                if (Owner.CMesh == null)
                {
                    Debug.LogError("custom mesh layer has no mesh to display!", Owner.gameObject);
                }
                Vector3 dir = Vector3.zero;
                if (Owner.OriVelocityAxis == Vector3.zero)
                {
                    Owner.OriVelocityAxis = Vector3.up;
                }

                dir = Owner.OriVelocityAxis;

                RenderObj = Owner.GetVertexPool().AddCustomMesh(Owner.CMesh, dir, 60f);
            }

            else if (type == 4)
            {
                RenderObj = Owner.GetVertexPool().AddRope();
            }
            else if (type == 5)
            {
                RenderObj = Owner.GetVertexPool().AddSphericalBillboard();
            }
            else if (type == 6)
            {
                XSplineComponent spcomp = Owner.STBezierSpline;
                int elemCount           = spcomp.CachedElements.Count;
                RenderObj = Owner.GetVertexPool().AddSplineTrail(elemCount);
            }
            else
            {
                RenderObj = Owner.GetVertexPool().AddDecal();
            }

            RenderObj.Node = this;
        }