void LogicUpdate() { if (SpaceData.Instance.frameList.Count > 0) { currFrame = SpaceData.Instance.frameList.Dequeue(); Dictionary <int, InputDataBase> dicInputData = new Dictionary <int, InputDataBase>(); for (int i = 0; i < SpaceData.Instance.SpacePlayers.Count; i++) { InputData data = new InputData(); data.ownerID = SpaceData.Instance.SpacePlayers[i].ownerID; dicInputData[data.ownerID] = data; } for (int i = 0; i < currFrame.operation.Count; i++) { FS_ENTITY_DATA e = currFrame.operation[i]; InputData data = new InputData(); data.Deserialize(e); dicInputData[data.ownerID] = data; } CheckQueuedBehaviours(); OnStepUpdate(dicInputData.Values.ToList()); PhysicsManager.instance.UpdateStep(); } }
public override void PareseFrom(FS_ENTITY_DATA e) { //this.e = e; //s.setBuffer(e.datas); //fp_1 = s.readFP(); //fp_2 = s.readFP(); }
public override void PareseFrom(FS_ENTITY_DATA e) { //this.e = e; //s.setBuffer(e.datas); //OperationType = s.readUint16(); //if (s.rpos != e.datas.Length) //{ // Angle = s.readFP(); //} }
public override void PareseFrom(FS_ENTITY_DATA e) { //this.e = e; //s.setBuffer(e.datas); //KeyCode k = KeyCode.None; //while ((k = (KeyCode)s.readUint16()) != 0) //{ // keys.Add(k); //} }
public override void InstructionParse(FS_ENTITY_DATA data, FP speedRate) { switch (data.cmd_type) { case (Byte)CMD.MOUSE: break; case (Byte)CMD.KEYBOARD: break; case (Byte)CMD.JOYSTICK: AnalyseDataFromJoystick(data, speedRate); break; } }
// Update is called once per frame void Update() { renderTime += Time.deltaTime; if (renderTime >= timeSlice) { renderTime = 0; if (SpaceData.Instance.frameList.Count > 0) { int count = SpaceData.Instance.frameList.Count; timeSlice = DeltaTime / (count <= ThresholdFrame ? 1 : count / ThresholdFrame); FS_FRAME_DATA framedata = SpaceData.Instance.frameList.Dequeue(); List <InputDataBase> allInputData = new List <InputDataBase>(); if (framedata.operation.Count <= 1 && framedata.operation[0].cmd_type == 0) { for (int i = 0; i < SpaceData.Instance.SpacePlayers.Count; i++) { InputData data = new InputData(); data.ownerID = SpaceData.Instance.SpacePlayers[i].ownerID; allInputData.Add(data); } } else { for (int i = 0; i < framedata.operation.Count; i++) { FS_ENTITY_DATA e = framedata.operation[i]; InputData data = new InputData(); data.Deserialize(e); allInputData.Add(data); } } OnStepUpdate(allInputData); PhysicsManager.instance.UpdateStep(); } } }
static public FrameBase decode(FS_ENTITY_DATA readMsg) { FrameBase f; switch ((CMD)readMsg.cmd_type) { case CMD.MOUSE: { f = new FrameMouse(); } break; case CMD.KEYBOARD: { f = new FrameKeyboard(); } break; case CMD.USER: { f = new FrameUser(); } break; case CMD.TEST: { f = new FrameTest(); } break; default: { f = null; } return(f); } f.PareseFrom(readMsg); return(f); }
// Update is called once per frame void Update() { renderTime += Time.deltaTime; if (renderTime >= timeSlice) { renderTime = 0; if (SpaceData.Instance.frameList.Count > 0) { int count = SpaceData.Instance.frameList.Count; timeSlice = DeltaTime / (count <= ThresholdFrame ? 1 : count / ThresholdFrame); currFrame = SpaceData.Instance.frameList.Dequeue(); Dictionary <int, InputDataBase> dicInputData = new Dictionary <int, InputDataBase>(); for (int i = 0; i < SpaceData.Instance.SpacePlayers.Count; i++) { InputData data = new InputData(); data.ownerID = SpaceData.Instance.SpacePlayers[i].ownerID; dicInputData[data.ownerID] = data; } for (int i = 0; i < currFrame.operation.Count; i++) { FS_ENTITY_DATA e = currFrame.operation[i]; InputData data = new InputData(); data.Deserialize(e); dicInputData[data.ownerID] = data; } CheckQueuedBehaviours(); OnStepUpdate(dicInputData.Values.ToList()); PhysicsManager.instance.UpdateStep(); } } }
public override void PareseFrom(FS_ENTITY_DATA e) { //this.e = e; //s.setBuffer(e.datas); //point = s.readTSVector(); }
public abstract void PareseFrom(FS_ENTITY_DATA e);
public void AnalyseDataFromJoystick(FS_ENTITY_DATA data, FP speedRate) { FrameJoystick msg = FrameProto.decode(data) as FrameJoystick; TriggerEvent <FP, FP>(msg.OperationType, speedRate, msg.Angle); }
public abstract void InstructionParse(FS_ENTITY_DATA data, FP speedRate);