上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.0 KiB

1 year ago
using UniRx;
using UnityEngine;
public class CameraLocationData
{
/// <summary>
///位置
/// <summary>
public Vector3 Position{get;set;}
/// <summary>
///旋转
/// <summary>
public Vector3 Rotation{get;set;}
/// <summary>
///距离
/// <summary>
public float Distance{get;set;}
/// <summary>
///XY
/// <summary>
public Vector2 Xy{get;set;}
/// <summary>
///Pivot
/// <summary>
public Vector3 Pivot{get;set;}
}
public class CameraLocationDataReactive
{
/// <summary>
///Data
/// <summary>
private CameraLocationData Data{get;set;}= new CameraLocationData();
/// <summary>
///位置
/// <summary>
public ReactiveProperty<Vector3> Position{get;set;}= new ReactiveProperty<Vector3>();
/// <summary>
///旋转
/// <summary>
public ReactiveProperty<Vector3> Rotation{get;set;}= new ReactiveProperty<Vector3>();
/// <summary>
///距离
/// <summary>
public ReactiveProperty<float> Distance{get;set;}= new ReactiveProperty<float>();
/// <summary>
///XY
/// <summary>
public ReactiveProperty<Vector2> Xy{get;set;}= new ReactiveProperty<Vector2>();
/// <summary>
///Pivot
/// <summary>
public ReactiveProperty<Vector3> Pivot{get;set;}= new ReactiveProperty<Vector3>();
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;
}
}