using UniRx; using UnityEngine; public class CameraLocationData { /// ///位置 /// public Vector3 Position{get;set;} /// ///旋转 /// public Vector3 Rotation{get;set;} /// ///距离 /// public float Distance{get;set;} /// ///XY /// public Vector2 Xy{get;set;} /// ///Pivot /// public Vector3 Pivot{get;set;} } public class CameraLocationDataReactive { /// ///Data /// private CameraLocationData Data{get;set;}= new CameraLocationData(); /// ///位置 /// public ReactiveProperty Position{get;set;}= new ReactiveProperty(); /// ///旋转 /// public ReactiveProperty Rotation{get;set;}= new ReactiveProperty(); /// ///距离 /// public ReactiveProperty Distance{get;set;}= new ReactiveProperty(); /// ///XY /// public ReactiveProperty Xy{get;set;}= new ReactiveProperty(); /// ///Pivot /// public ReactiveProperty Pivot{get;set;}= new ReactiveProperty(); public CameraLocationDataReactive() { Position.Subscribe(value => Data.Position= value); Rotation.Subscribe(value => Data.Rotation= value); Distance.Subscribe(value => Data.Distance= value); Xy.Subscribe(value => Data.Xy= value); Pivot.Subscribe(value => Data.Pivot= value); } public void SetData(CameraLocationData data) { Data = data; Position.Value = data.Position; Rotation.Value = data.Rotation; Distance.Value = data.Distance; Xy.Value = data.Xy; Pivot.Value = data.Pivot; } public CameraLocationData GetData() { return Data; } }