添加态势画面 移动 缩放功能
This commit is contained in:
parent
66274c1bc0
commit
1445fb76e0
|
@ -38,7 +38,7 @@ RenderSettings:
|
||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 1113159741}
|
m_Sun: {fileID: 1113159741}
|
||||||
m_IndirectSpecularColor: {r: 0.030100383, g: 0.03369107, b: 0.03534769, a: 1}
|
m_IndirectSpecularColor: {r: 0.017637905, g: 0.031211179, b: 0.06785975, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
|
@ -53144,7 +53144,7 @@ Camera:
|
||||||
y: 0
|
y: 0
|
||||||
width: 1
|
width: 1
|
||||||
height: 1
|
height: 1
|
||||||
near clip plane: 0.3
|
near clip plane: 0
|
||||||
far clip plane: 1000
|
far clip plane: 1000
|
||||||
field of view: 60
|
field of view: 60
|
||||||
orthographic: 1
|
orthographic: 1
|
||||||
|
@ -67831,9 +67831,11 @@ MonoBehaviour:
|
||||||
type: 3}
|
type: 3}
|
||||||
redShowImage: {fileID: 628155341}
|
redShowImage: {fileID: 628155341}
|
||||||
blueShowImage: {fileID: 338894529}
|
blueShowImage: {fileID: 338894529}
|
||||||
upBtn: {fileID: 0}
|
upBtn: {fileID: 6368481658342163396}
|
||||||
downBtn: {fileID: 0}
|
downBtn: {fileID: 6368481659336096937}
|
||||||
satelliteImagery: {fileID: 0}
|
distance: 0
|
||||||
|
isScale: 0
|
||||||
|
satelliteImagery: {fileID: 1378295488}
|
||||||
--- !u!1 &1720385560
|
--- !u!1 &1720385560
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -69796,7 +69798,7 @@ MonoBehaviour:
|
||||||
m_PreInfinity: 2
|
m_PreInfinity: 2
|
||||||
m_PostInfinity: 2
|
m_PostInfinity: 2
|
||||||
m_RotationOrder: 4
|
m_RotationOrder: 4
|
||||||
randSeed: 309072093
|
randSeed: 401617593
|
||||||
isDoingTransition: 0
|
isDoingTransition: 0
|
||||||
minimumHeight: 0
|
minimumHeight: 0
|
||||||
--- !u!114 &1820978574
|
--- !u!114 &1820978574
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class PostureController : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Camera satelliteImagery;
|
public Camera satelliteImagery;
|
||||||
|
|
||||||
private Coroutine currentCoroutine;
|
public Coroutine currentCoroutine;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Awake()
|
void Awake()
|
||||||
|
@ -39,36 +39,48 @@ public class PostureController : MonoBehaviour
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (Input.GetMouseButton(0))
|
||||||
|
{
|
||||||
|
float mouseX = Input.GetAxis("Mouse X") * 10f * Time.deltaTime;
|
||||||
|
float mouseY = Input.GetAxis("Mouse Y") * 10f * Time.deltaTime;
|
||||||
|
satelliteImagery.transform.Translate(Vector3.down * mouseY * 60f);
|
||||||
|
satelliteImagery.transform.Translate(Vector3.left * mouseX * 60f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUp()
|
private void OnUp()
|
||||||
{
|
{
|
||||||
satelliteImagery.orthographicSize += 10;
|
distance = satelliteImagery.orthographicSize;
|
||||||
if (satelliteImagery.orthographicSize >= 1120)
|
distance += 100;
|
||||||
|
if (distance >= 1120)
|
||||||
{
|
{
|
||||||
satelliteImagery.orthographicSize = 1120;
|
distance = 1120;
|
||||||
|
currentCoroutine = null;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentCoroutine == null)
|
if (currentCoroutine == null)
|
||||||
{
|
{
|
||||||
currentCoroutine = StartCoroutine(Merge(satelliteImagery.orthographicSize));
|
|
||||||
isScale = true;
|
isScale = true;
|
||||||
|
currentCoroutine = StartCoroutine(Merge(distance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDown()
|
private void OnDown()
|
||||||
{
|
{
|
||||||
satelliteImagery.orthographicSize -= 10;
|
distance = satelliteImagery.orthographicSize;
|
||||||
if (satelliteImagery.orthographicSize <= 200f)
|
distance -= 100;
|
||||||
|
if (distance <= 200f)
|
||||||
{
|
{
|
||||||
satelliteImagery.orthographicSize = 200f;
|
distance = 200f;
|
||||||
|
currentCoroutine = null;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentCoroutine == null)
|
if (currentCoroutine == null)
|
||||||
{
|
{
|
||||||
currentCoroutine = StartCoroutine(Merge(satelliteImagery.orthographicSize));
|
|
||||||
isScale = true;
|
isScale = true;
|
||||||
|
currentCoroutine = StartCoroutine(Merge(distance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +88,14 @@ public class PostureController : MonoBehaviour
|
||||||
{
|
{
|
||||||
while (isScale)
|
while (isScale)
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(0.01f);
|
Debug.Log("update");
|
||||||
satelliteImagery.orthographicSize = Mathf.Lerp(satelliteImagery.orthographicSize, targetPoint, 1f);
|
satelliteImagery.orthographicSize = Mathf.Lerp(satelliteImagery.orthographicSize, targetPoint, Time.deltaTime * 20f);
|
||||||
if (Mathf.Abs(targetPoint - satelliteImagery.orthographicSize) < 0.1)
|
if (Mathf.Abs(targetPoint - satelliteImagery.orthographicSize) < 0.1)
|
||||||
{
|
{
|
||||||
isScale = false;
|
isScale = false;
|
||||||
currentCoroutine = null;
|
currentCoroutine = null;
|
||||||
}
|
}
|
||||||
|
yield return new WaitForSeconds(0.01f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +105,10 @@ public class PostureController : MonoBehaviour
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
|
if (currentCoroutine != null)
|
||||||
|
{
|
||||||
|
currentCoroutine = null;
|
||||||
|
}
|
||||||
redShowImage.transform.parent.gameObject.SetActive(false);
|
redShowImage.transform.parent.gameObject.SetActive(false);
|
||||||
blueShowImage.transform.parent.gameObject.SetActive(false);
|
blueShowImage.transform.parent.gameObject.SetActive(false);
|
||||||
GetSceneInfo();
|
GetSceneInfo();
|
||||||
|
|
Loading…
Reference in New Issue