コード例 #1
0
        public void RecordObjectInFrame()
        {
            int index = 0;

            foreach (Rigidbody val in _objectsToRecord)
            {
                RecordableObjectModel model = new RecordableObjectModel();
                model.RecordedPosition   = val.transform.position;
                model.RecordedPosition.z = -2;
                model.RecordedRotation   = val.transform.rotation;

                RecordableObjectModel PreviousFrameModel = ObjectsRecordInfoPreviousFrame[index];
                if (PreviousFrameModel != null)
                {
                    if (val.transform.position == PreviousFrameModel.RecordedPosition &&
                        val.transform.rotation == PreviousFrameModel.RecordedRotation)
                    {
                        index++;
                        continue;
                    }
                }
                ObjectsRecordInfo[index].Add(CurrentFrameIndex, model);
                offset += 28;
                ObjectsRecordInfoPreviousFrame[index] = model;
                index++;
            }
            CurrentFrameIndex++;
        }
コード例 #2
0
        public void SetObjectTransformDict(List <Vector4> _replayData)
        {
            RecordableObjectModel PreviosTransform;

            for (int j = 0; j < ObjectsReplayInfo.Keys.Count; j++)
            {
                PreviosTransform = new RecordableObjectModel(_objectsToReplay[j].transform.position,
                                                             _objectsToReplay[j].transform.rotation);
                for (int i = 0; i < _replayData.Count; i++)
                {
                    if (ObjectsReplayInfo[j].ContainsKey(i))
                    {
                        PreviosTransform = ObjectsReplayInfo[j][i];
                        continue;
                    }

                    ObjectsReplayInfo[j].Add(i, PreviosTransform);
                }
            }
        }