Example #1
0
        public void Init(Vector3 oriDir, float speed, float life, int oriRot, float oriScaleX, float oriScaleY, Color oriColor, Vector2 oriLowerUv, Vector2 oriUVDimension)
        {
            //OriDirection = ClientTrans.TransformDirection(oriDir);
            OriDirection   = oriDir;
            LifeTime       = life;
            OriRotateAngle = oriRot;
            OriScaleX      = oriScaleX;
            OriScaleY      = oriScaleY;

            StartColor = oriColor;

            Color       = oriColor;
            ElapsedTime = 0f;
            // direction is synced to client rotation, except sphere dir
            if (Owner.AlwaysSyncRotation)
            {
                Velocity = Owner.ClientTransform.rotation * OriDirection * speed;
            }
            else
            {
                Velocity = OriDirection * speed;
            }
            LowerLeftUV            = oriLowerUv;
            UVDimensions           = oriUVDimension;
            IsCollisionEventSended = false;
            RenderObj.Initialize(this);
        }
Example #2
0
        public void Init(Vector3 oriDir, float speed, float life, int oriRot, float oriScaleX, float oriScaleY, Color oriColor, Vector2 oriLowerUv, Vector2 oriUVDimension)
        {
            //OriDirection = ClientTrans.TransformDirection(oriDir);
            OriDirection   = oriDir;
            LifeTime       = life;
            OriRotateAngle = oriRot;
            OriScaleX      = oriScaleX;
            OriScaleY      = oriScaleY;

            StartColor = oriColor;

            Color       = oriColor;
            ElapsedTime = 0f;
            // direction is synced to client rotation, except sphere dir
            if (Owner.AlwaysSyncRotation)
            {
                Velocity = Owner.ClientTransform.rotation * OriDirection * speed;
            }
            else
            {
                Velocity = OriDirection * speed;
            }
            LowerLeftUV            = oriLowerUv;
            UVDimensions           = oriUVDimension;
            IsCollisionEventSended = false;
            RenderObj.Initialize(this);

            mOriSpeed = speed;


            if (Owner.EmitType == (int)EMITTYPE.Spline && Owner.DirType == DIRECTION_TYPE.Spline)
            {
                if (Owner.EmitSpline.Spline.mPoints.Count <= 1)
                {
                    Debug.LogWarning("not enough points in spline, maybe you need to build the spline first?" + Owner.Owner.name);
                    Owner.Owner.DeActive();
                    return;
                }

                mSplineIterator = Owner.EmitSpline.Spline.GetIterator();
                mSplineIterator.SetTransform(Owner.EmitSpline.transform);
                mSplineIterator.SetOffset(mSplineOffset);
                //mSplineIterator.SetReverse(true);
            }
        }