示例#1
0
        public override void OnReceiveData(ref NetworkState.NETWORK_STATE_TYPE state)
        {
            _operationList.Clear();
            int opCount = BufferedNetworkUtilsClient.ReadInt(ref state);

            for (int i = 0; i < opCount; ++i)
            {
                FduParticleSystemOP.Operation operationType = (FduParticleSystemOP.Operation)BufferedNetworkUtilsClient.ReadByte(ref state);
                int paraCount          = BufferedNetworkUtilsClient.ReadInt(ref state);
                FduParticleSystemOP op = new FduParticleSystemOP();
                op.operation = operationType;
                if (paraCount > 0)
                {
                    op.paras = new object[paraCount];
                }
                for (int j = 0; j < paraCount; ++j)
                {
                    op.paras[j] = FduSupportClass.deserializeOneParameter(ref state);
                }
                _operationList.Add(op);
            }
            //反序列化结束 执行每一项粒子系统的操作
            foreach (FduParticleSystemOP op in _operationList)
            {
                op.executeOpOnSlave(particleSys);
            }
            _operationList.Clear();
        }
示例#2
0
        public static void ClusterClear(this UnityEngine.ParticleSystem ps)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Clear();
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.clear;
            observer.addOperation(op);
        }
示例#3
0
        public static void ClusterSetRandomSeed(this UnityEngine.ParticleSystem ps, uint randomSeed)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.randomSeed = randomSeed;
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.setRandomSeed;
            op.paras     = new object[1];
            op.paras[0]  = (int)randomSeed;
            observer.addOperation(op);
        }
示例#4
0
        public static void ClusterSimulate(this UnityEngine.ParticleSystem ps, float t)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Simulate(t);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.simulate;
            op.paras     = new object[1];
            op.paras[0]  = t;
            observer.addOperation(op);
        }
示例#5
0
        public static void ClusterEmit(this UnityEngine.ParticleSystem ps, int count)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Emit(count);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.emit;
            op.paras     = new object[1];
            op.paras[0]  = count;
            observer.addOperation(op);
        }
示例#6
0
        public static void ClusterClear(this UnityEngine.ParticleSystem ps, bool withChildren)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Clear(withChildren);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.clear;
            op.paras     = new object[1];
            op.paras[0]  = withChildren;
            observer.addOperation(op);
        }
示例#7
0
        public static void ClusterStop(this UnityEngine.ParticleSystem ps, bool withChildren, ParticleSystemStopBehavior stopBehavior)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Stop(withChildren, stopBehavior);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.stop;
            op.paras     = new object[2];
            op.paras[0]  = withChildren;
            op.paras[1]  = (byte)stopBehavior;
            observer.addOperation(op);
        }
示例#8
0
        public static void ClusterSimulate(this UnityEngine.ParticleSystem ps, float t, bool withChildren, bool restart, bool fixedTimeStep)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Simulate(t, withChildren, restart, fixedTimeStep);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.simulate;
            op.paras     = new object[4];
            op.paras[0]  = t;
            op.paras[1]  = withChildren;
            op.paras[2]  = restart;
            op.paras[3]  = fixedTimeStep;
            observer.addOperation(op);
        }
示例#9
0
 public void addOperation(FduParticleSystemOP op)
 {
     _operationList.Add(op);
 }