添加放大缩小逻辑

This commit is contained in:
YangHua 2024-02-02 12:13:15 +08:00
parent 2eb28ee5af
commit 12e0809d4d
4 changed files with 113 additions and 14 deletions

View File

@ -48,7 +48,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _GIntensity: 0.1
- _GIntensity: 0
- _Intensity: 0
- _SIntensity: 1
- _perturbation: 0.405

View File

@ -33,7 +33,7 @@ Material:
- _overBright: 1
m_Colors:
- _AmbientTint: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0.5, g: 0.49803922, b: 0.49215686, a: 0.2}
- _GlowColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
- _PrimaryTint: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 1113159741}
m_IndirectSpecularColor: {r: 0.16232353, g: 0.30599368, b: 0.66842777, a: 1}
m_IndirectSpecularColor: {r: 0.030100383, g: 0.03369107, b: 0.03534769, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@ -48488,7 +48488,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.000030517578}
m_SizeDelta: {x: 0, y: 50}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &996536657
MonoBehaviour:
@ -53148,7 +53148,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 1179
orthographic size: 1120
m_Depth: 0
m_CullingMask:
serializedVersion: 2
@ -65517,6 +65517,16 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1561597386300646505, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1690237338199029568, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1693121673111326432, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_AnchorMax.x
@ -65537,6 +65547,16 @@ PrefabInstance:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2927603212027581197, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3410451424682802294, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3691389793902075663, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_Name
@ -65547,6 +65567,11 @@ PrefabInstance:
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4239324281361100925, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4655910692261985928, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
@ -65692,6 +65717,16 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8101603123472128701, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8297275301161124839, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8589009349407657109, guid: c3d92615a09597d46aa740923029c15d,
type: 3}
propertyPath: m_IsActive
@ -67752,7 +67787,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &1719983406
RectTransform:
m_ObjectHideFlags: 0
@ -67796,6 +67831,9 @@ MonoBehaviour:
type: 3}
redShowImage: {fileID: 628155341}
blueShowImage: {fileID: 338894529}
upBtn: {fileID: 0}
downBtn: {fileID: 0}
satelliteImagery: {fileID: 0}
--- !u!1 &1720385560
GameObject:
m_ObjectHideFlags: 0
@ -67831,7 +67869,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.000030517578}
m_SizeDelta: {x: 0, y: 50}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1720385562
MonoBehaviour:
@ -69758,7 +69796,7 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
randSeed: 473439734
randSeed: 309072093
isDoingTransition: 0
minimumHeight: 0
--- !u!114 &1820978574
@ -97919,7 +97957,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -948, y: 10}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &6368481658076565719
MonoBehaviour:
@ -98062,7 +98100,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &6368481658342163399
RectTransform:
m_ObjectHideFlags: 0
@ -99056,7 +99094,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &6368481659336096942
MonoBehaviour:
m_ObjectHideFlags: 0
@ -99475,7 +99513,7 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
@ -99784,9 +99822,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -7, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &6368481659665436127
MonoBehaviour:

View File

@ -16,11 +16,24 @@ public class PostureController : MonoBehaviour
public RawImage blueShowImage;
private DroneViewDisplay droneViewDisplay;
public Button upBtn;
public Button downBtn;
public float distance;
public bool isScale = false;
/// <summary>
/// 卫星影像
/// </summary>
public Camera satelliteImagery;
private Coroutine currentCoroutine;
// Start is called before the first frame update
void Awake()
{
deviceManager = DeviceManager.Instance;
droneViewDisplay = DroneViewDisplay.Instance;
upBtn.onClick.AddListener(OnUp);
downBtn.onClick.AddListener(OnDown);
}
// Update is called once per frame
@ -29,6 +42,54 @@ public class PostureController : MonoBehaviour
}
private void OnUp()
{
satelliteImagery.orthographicSize += 10;
if (satelliteImagery.orthographicSize >= 1120)
{
satelliteImagery.orthographicSize = 1120;
}
if (currentCoroutine == null)
{
currentCoroutine = StartCoroutine(Merge(satelliteImagery.orthographicSize));
isScale = true;
}
}
private void OnDown()
{
satelliteImagery.orthographicSize -= 10;
if (satelliteImagery.orthographicSize <= 200f)
{
satelliteImagery.orthographicSize = 200f;
}
if (currentCoroutine == null)
{
currentCoroutine = StartCoroutine(Merge(satelliteImagery.orthographicSize));
isScale = true;
}
}
private IEnumerator Merge(float targetPoint)
{
while (isScale)
{
yield return new WaitForSeconds(0.01f);
satelliteImagery.orthographicSize = Mathf.Lerp(satelliteImagery.orthographicSize, targetPoint, 1f);
if (Mathf.Abs(targetPoint - satelliteImagery.orthographicSize) < 0.1)
{
isScale = false;
currentCoroutine = null;
}
}
}
private void OnEnable()
{
redShowImage.transform.parent.gameObject.SetActive(false);