コード例 #1
0
    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();
        }
    }
コード例 #2
0
 public override void PareseFrom(FS_ENTITY_DATA e)
 {
     //this.e = e;
     //s.setBuffer(e.datas);
     //fp_1 = s.readFP();
     //fp_2 = s.readFP();
 }
コード例 #3
0
        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();
            //}
        }
コード例 #4
0
        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);
            //}
        }
コード例 #5
0
    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;
        }
    }
コード例 #6
0
    // 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();
            }
        }
    }
コード例 #7
0
        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);
        }
コード例 #8
0
    // 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();
            }
        }
    }
コード例 #9
0
 public override void PareseFrom(FS_ENTITY_DATA e)
 {
     //this.e = e;
     //s.setBuffer(e.datas);
     //point = s.readTSVector();
 }
コード例 #10
0
 public abstract void PareseFrom(FS_ENTITY_DATA e);
コード例 #11
0
    public void AnalyseDataFromJoystick(FS_ENTITY_DATA data, FP speedRate)
    {
        FrameJoystick msg = FrameProto.decode(data) as FrameJoystick;

        TriggerEvent <FP, FP>(msg.OperationType, speedRate, msg.Angle);
    }
コード例 #12
0
 public abstract void InstructionParse(FS_ENTITY_DATA data, FP speedRate);