|
@@ -2,68 +2,16 @@ using System;
|
|
|
using System.Collections;
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
-[Serializable]
|
|
|
|
|
-//public struct CameraRect
|
|
|
|
|
-//{
|
|
|
|
|
-// public Rect Up;
|
|
|
|
|
-// public Rect Down;
|
|
|
|
|
-// public Rect Left;
|
|
|
|
|
-// public Rect Right;
|
|
|
|
|
-//}
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public class CameraController : MonoBehaviour
|
|
public class CameraController : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
- public float offsetX = 2, offsetY = 2, offsetZ = -17,totalOffsetYDown = -10;
|
|
|
|
|
- //public float splitOffsetZ = -20;
|
|
|
|
|
|
|
+ public Vector3 offset = new Vector3(2.8f,2f,-17f);
|
|
|
|
|
+ public Vector3 offset_air = new Vector3(2.8f,-2.5f,-17f);
|
|
|
public float lerpValue = 3.5f;
|
|
public float lerpValue = 3.5f;
|
|
|
-
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public float offsetYDown;
|
|
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public Vector3 targetPos;
|
|
public Vector3 targetPos;
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public Vector3 player0TargetPos;
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public Vector3 player1TargetPos;
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public Vector3 cameraPos;
|
|
|
|
|
-
|
|
|
|
|
public Camera mainCamera;
|
|
public Camera mainCamera;
|
|
|
- //public Camera player0Camera;
|
|
|
|
|
- //public Camera player1Camera;
|
|
|
|
|
-
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public float maxView = 20;
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public float view;
|
|
|
|
|
- //public float splitDistance = 30;
|
|
|
|
|
- //public float mergeDistanceX = 16;
|
|
|
|
|
- //public float mergeDistanceY = 8;
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public float distanceX;
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public float distanceY;
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public float ratio;
|
|
|
|
|
- public float ratioY = 1;
|
|
|
|
|
- //public float lineMaxScale = 0.5f;
|
|
|
|
|
-
|
|
|
|
|
- //public GameObject lineInCamera;
|
|
|
|
|
-
|
|
|
|
|
- //public bool isSplit;
|
|
|
|
|
- //public bool isSplitY;
|
|
|
|
|
-
|
|
|
|
|
- //public float minDis;
|
|
|
|
|
- private int once;
|
|
|
|
|
-
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public Quaternion targetRotation;
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public Rect targetViewport0;
|
|
|
|
|
- //[HideInInspector]
|
|
|
|
|
- //public Rect targetViewport1;
|
|
|
|
|
-
|
|
|
|
|
- //public CameraRect cameraRect;
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
private void Start()
|
|
|
{
|
|
{
|
|
@@ -76,17 +24,12 @@ public class CameraController : MonoBehaviour
|
|
|
//调参用
|
|
//调参用
|
|
|
//ratio = maxView / (splitDistance - minDistance);
|
|
//ratio = maxView / (splitDistance - minDistance);
|
|
|
//
|
|
//
|
|
|
-
|
|
|
|
|
- PlayerController player0 = PlayersInput.instance[0];
|
|
|
|
|
//PlayerController player1 = PlayersInput.instance[1];
|
|
//PlayerController player1 = PlayersInput.instance[1];
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//if (player0!= null && player0!=player1)
|
|
//if (player0!= null && player0!=player1)
|
|
|
- if (player0 != null)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ //{
|
|
|
|
|
|
|
|
- Vector3 player0Pos = player0.transform.position;
|
|
|
|
|
|
|
+ //Vector3 player0Pos = player0.transform.position;
|
|
|
|
|
|
|
|
////玩家距离接近且都不动时回蓝速度加快
|
|
////玩家距离接近且都不动时回蓝速度加快
|
|
|
//if (once < 2 && distanceX <= minDis && distanceY <= minDis)
|
|
//if (once < 2 && distanceX <= minDis && distanceY <= minDis)
|
|
@@ -211,7 +154,7 @@ public class CameraController : MonoBehaviour
|
|
|
// lineMaxScale), 20, 1);
|
|
// lineMaxScale), 20, 1);
|
|
|
|
|
|
|
|
//}
|
|
//}
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
}
|
|
}
|
|
|
private void FixedUpdate()
|
|
private void FixedUpdate()
|
|
|
{
|
|
{
|
|
@@ -225,7 +168,7 @@ public class CameraController : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
if (player0.isRevive)
|
|
if (player0.isRevive)
|
|
|
{
|
|
{
|
|
|
- targetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
|
|
+ targetPos = new Vector3(140, offset.y, offset.z);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -333,13 +276,24 @@ public class CameraController : MonoBehaviour
|
|
|
Vector3 CameraTargetMove(PlayerController player)
|
|
Vector3 CameraTargetMove(PlayerController player)
|
|
|
{
|
|
{
|
|
|
Vector3 skewPos;
|
|
Vector3 skewPos;
|
|
|
|
|
+ float height = offset.y - offset_air.y;
|
|
|
|
|
+ if(player.transform.position.y >= height)
|
|
|
|
|
+ {
|
|
|
|
|
+ skewPos = offset_air;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ skewPos = offset;
|
|
|
|
|
+ skewPos.y -= player.transform.position.y;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (player.bodyTrans.localScale.x > 0)
|
|
if (player.bodyTrans.localScale.x > 0)
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(-offsetX, offsetY, offsetZ);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(-skewPos.x, skewPos.y, skewPos.z);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(offsetX, offsetY, offsetZ);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(skewPos.x, skewPos.y, skewPos.z);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//if (isSplit)
|
|
//if (isSplit)
|