예제 #1
0
        protected void FixedUpdate()
        {
            this.client.Update(Time.fixedDeltaTime);

            if (this.start && this.client.Active)
            {
                this.frameCount++;
                ActorMgr.Simulate(this.fd);

                if (this.syncList.Count > 0)
                {
                    this.Simulate();

                    while (this.syncList.Count > SYNCMAX)
                    {
                        this.client.Update(0);
                        this.Simulate();
                    }
                }

                if (this.frameCount % INTERVAL == 0)
                {
                    var msg = new Msg.Input()
                    {
                        snapshotFrameCount = this.snapshotFrameCount,
                        snapshotList       = this.sendList
                    };
                    this.client.Send(MsgId.Input, msg);
                    this.sendList.Clear();
                    this.snapshotFrameCount = 0;
                }
            }
        }
예제 #2
0
        private void Input(byte msgId, NetworkReader reader, IPEndPoint ep)
        {
            var fd = ep.ToString();

            if (!this.unitMap.ContainsKey(fd))
            {
                this.unitMap.Add(fd, new Unit());
            }

            var msg = new Msg.Input()
            {
                snapshotList = this.unitMap[fd].list
            };

            msg.Deserialize(reader);
            this.unitMap[fd].count += msg.snapshotFrameCount;
        }