|
@@ -14,6 +14,7 @@ using UnityEngine;
|
|
|
public class CameraController : MonoBehaviour
|
|
public class CameraController : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
public float offsetX = 2, offsetY = 2, offsetZ = -17,totalOffsetYDown = -10;
|
|
public float offsetX = 2, offsetY = 2, offsetZ = -17,totalOffsetYDown = -10;
|
|
|
|
|
+ public float splitOffsetZ = -20;
|
|
|
public float lerpValue = 3.5f;
|
|
public float lerpValue = 3.5f;
|
|
|
|
|
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
@@ -31,6 +32,7 @@ public class CameraController : MonoBehaviour
|
|
|
public Camera player0Camera;
|
|
public Camera player0Camera;
|
|
|
public Camera player1Camera;
|
|
public Camera player1Camera;
|
|
|
|
|
|
|
|
|
|
+ [HideInInspector]
|
|
|
public float maxView = 20;
|
|
public float maxView = 20;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float view;
|
|
public float view;
|
|
@@ -65,6 +67,7 @@ public class CameraController : MonoBehaviour
|
|
|
|
|
|
|
|
private void Start()
|
|
private void Start()
|
|
|
{
|
|
{
|
|
|
|
|
+ maxView = offsetZ - splitOffsetZ;
|
|
|
ratio = maxView / (splitDistance - mergeDistanceX);
|
|
ratio = maxView / (splitDistance - mergeDistanceX);
|
|
|
offsetYDown = totalOffsetYDown;
|
|
offsetYDown = totalOffsetYDown;
|
|
|
}
|
|
}
|
|
@@ -282,7 +285,7 @@ public class CameraController : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
|
mainCamera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
mainCamera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
- player1Camera.transform.position, 0.5f) + Vector3.back * view;
|
|
|
|
|
|
|
+ player1Camera.transform.position, 0.5f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -319,18 +322,18 @@ public class CameraController : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
if (player.bodyTrans.localScale.x > 0)
|
|
if (player.bodyTrans.localScale.x > 0)
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(-offsetX / 2, offsetY, offsetZ);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(-offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(offsetX / 2, offsetY, offsetZ);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(0, offsetY, offsetZ);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(0, offsetY, offsetZ - view);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//skewPos = player.transform.position + new Vector3(0, offsetY, offsetZ);
|
|
//skewPos = player.transform.position + new Vector3(0, offsetY, offsetZ);
|