|
@@ -14,46 +14,46 @@ 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 splitOffsetZ = -20;
|
|
|
public float lerpValue = 3.5f;
|
|
public float lerpValue = 3.5f;
|
|
|
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public float offsetYDown;
|
|
|
|
|
|
|
+ //[HideInInspector]
|
|
|
|
|
+ //public float offsetYDown;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public Vector3 targetPos;
|
|
public Vector3 targetPos;
|
|
|
- [HideInInspector]
|
|
|
|
|
- public Vector3 player0TargetPos;
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public Vector3 player1TargetPos;
|
|
|
|
|
|
|
+ //[HideInInspector]
|
|
|
|
|
+ //public Vector3 player0TargetPos;
|
|
|
|
|
+ //[HideInInspector]
|
|
|
|
|
+ //public Vector3 player1TargetPos;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public Vector3 cameraPos;
|
|
public Vector3 cameraPos;
|
|
|
|
|
|
|
|
public Camera mainCamera;
|
|
public Camera mainCamera;
|
|
|
- public Camera player0Camera;
|
|
|
|
|
- public Camera player1Camera;
|
|
|
|
|
|
|
+ //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 maxView = 20;
|
|
|
|
|
+ //[HideInInspector]
|
|
|
|
|
+ //public float view;
|
|
|
|
|
+ //public float splitDistance = 30;
|
|
|
|
|
+ //public float mergeDistanceX = 16;
|
|
|
|
|
+ //public float mergeDistanceY = 8;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float distanceX;
|
|
public float distanceX;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float distanceY;
|
|
public float distanceY;
|
|
|
- [HideInInspector]
|
|
|
|
|
- public float ratio;
|
|
|
|
|
|
|
+ //[HideInInspector]
|
|
|
|
|
+ //public float ratio;
|
|
|
public float ratioY = 1;
|
|
public float ratioY = 1;
|
|
|
- public float lineMaxScale = 0.5f;
|
|
|
|
|
|
|
+ //public float lineMaxScale = 0.5f;
|
|
|
|
|
|
|
|
- public GameObject lineInCamera;
|
|
|
|
|
|
|
+ //public GameObject lineInCamera;
|
|
|
|
|
|
|
|
- public bool isSplit;
|
|
|
|
|
|
|
+ //public bool isSplit;
|
|
|
//public bool isSplitY;
|
|
//public bool isSplitY;
|
|
|
|
|
|
|
|
- public float minDis;
|
|
|
|
|
|
|
+ //public float minDis;
|
|
|
private int once;
|
|
private int once;
|
|
|
|
|
|
|
|
//[HideInInspector]
|
|
//[HideInInspector]
|
|
@@ -67,9 +67,9 @@ public class CameraController : MonoBehaviour
|
|
|
|
|
|
|
|
private void Start()
|
|
private void Start()
|
|
|
{
|
|
{
|
|
|
- maxView = offsetZ - splitOffsetZ;
|
|
|
|
|
- ratio = maxView / (splitDistance - mergeDistanceX);
|
|
|
|
|
- offsetYDown = totalOffsetYDown;
|
|
|
|
|
|
|
+ //maxView = offsetZ - splitOffsetZ;
|
|
|
|
|
+ //ratio = maxView / (splitDistance - mergeDistanceX);
|
|
|
|
|
+ //offsetYDown = totalOffsetYDown;
|
|
|
}
|
|
}
|
|
|
private void Update()
|
|
private void Update()
|
|
|
{
|
|
{
|
|
@@ -78,152 +78,150 @@ public class CameraController : MonoBehaviour
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
PlayerController player0 = PlayersInput.instance[0];
|
|
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;
|
|
|
- Vector3 player1Pos = player1.transform.position;
|
|
|
|
|
- distanceX = Mathf.Abs(player0Pos.x - player1Pos.x);
|
|
|
|
|
- distanceY = Mathf.Abs(player0Pos.y - player1Pos.y);
|
|
|
|
|
|
|
|
|
|
- //玩家距离接近且都不动时回蓝速度加快
|
|
|
|
|
- if (once < 2 && distanceX <= minDis && distanceY <= minDis)
|
|
|
|
|
- {
|
|
|
|
|
- if (once == 0 && player0.state == CharacterState.Idle && player1.state == CharacterState.Idle)
|
|
|
|
|
- {
|
|
|
|
|
- once = 1;
|
|
|
|
|
- player0.RapidReplyMp();
|
|
|
|
|
- player1.RapidReplyMp();
|
|
|
|
|
- }
|
|
|
|
|
- else if (once == 1 && (player0.state != CharacterState.Idle || player1.state != CharacterState.Idle))
|
|
|
|
|
- {
|
|
|
|
|
- once = 2;
|
|
|
|
|
- player0.NormalReplyMp();
|
|
|
|
|
- player1.NormalReplyMp();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (once != 0 && distanceX <= minDis && distanceY <= minDis)
|
|
|
|
|
- {
|
|
|
|
|
- once = 0;
|
|
|
|
|
- player0.NormalReplyMp();
|
|
|
|
|
- player1.NormalReplyMp();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ////玩家距离接近且都不动时回蓝速度加快
|
|
|
|
|
+ //if (once < 2 && distanceX <= minDis && distanceY <= minDis)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (once == 0 && player0.state == CharacterState.Idle && player1.state == CharacterState.Idle)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // once = 1;
|
|
|
|
|
+ // player0.RapidReplyMp();
|
|
|
|
|
+ // player1.RapidReplyMp();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else if (once == 1 && (player0.state != CharacterState.Idle || player1.state != CharacterState.Idle))
|
|
|
|
|
+ // {
|
|
|
|
|
+ // once = 2;
|
|
|
|
|
+ // player0.NormalReplyMp();
|
|
|
|
|
+ // player1.NormalReplyMp();
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
|
|
+ //else if (once != 0 && distanceX <= minDis && distanceY <= minDis)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // once = 0;
|
|
|
|
|
+ // player0.NormalReplyMp();
|
|
|
|
|
+ // player1.NormalReplyMp();
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
- //根据玩家距离分屏/合屏
|
|
|
|
|
- if (distanceX < mergeDistanceX)
|
|
|
|
|
- {
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- view = 0;
|
|
|
|
|
- CameraSplit(true);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (distanceY > mergeDistanceY)
|
|
|
|
|
- {
|
|
|
|
|
- view = (distanceY - mergeDistanceY) * ratioY;
|
|
|
|
|
- //isSplitY = true;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- //if (isSplitY)
|
|
|
|
|
- //{
|
|
|
|
|
- // isSplitY = false;
|
|
|
|
|
- //}
|
|
|
|
|
- if(player0.isRevive || player1.isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- offsetYDown = 0;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- offsetYDown = Mathf.Clamp(totalOffsetYDown / (2 * mergeDistanceY) * distanceY,
|
|
|
|
|
- totalOffsetYDown, 0);
|
|
|
|
|
|
|
+ ////根据玩家距离分屏/合屏
|
|
|
|
|
+ //if (distanceX < mergeDistanceX)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // view = 0;
|
|
|
|
|
+ // CameraSplit(true);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // if (distanceY > mergeDistanceY)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // view = (distanceY - mergeDistanceY) * ratioY;
|
|
|
|
|
+ // //isSplitY = true;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // //if (isSplitY)
|
|
|
|
|
+ // //{
|
|
|
|
|
+ // // isSplitY = false;
|
|
|
|
|
+ // //}
|
|
|
|
|
+ // if(player0.isRevive || player1.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // offsetYDown = 0;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // offsetYDown = Mathf.Clamp(totalOffsetYDown / (2 * mergeDistanceY) * distanceY,
|
|
|
|
|
+ // totalOffsetYDown, 0);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- else if (distanceX > splitDistance)
|
|
|
|
|
- {
|
|
|
|
|
- if (!isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- if (player0Pos.x < player1Pos.x)
|
|
|
|
|
- {
|
|
|
|
|
- player0Camera.rect = new Rect(0, 0, 0.5f, 1);
|
|
|
|
|
- player1Camera.rect = new Rect(0.5f, 0, 0.5f, 1);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- player0Camera.rect = new Rect(0.5f, 0, 0.5f, 1);
|
|
|
|
|
- player1Camera.rect = new Rect(0, 0, 0.5f, 1);
|
|
|
|
|
- }
|
|
|
|
|
- CameraSplit(false);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
|
|
+ //else if (distanceX > splitDistance)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (!isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // if (player0Pos.x < player1Pos.x)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0Camera.rect = new Rect(0, 0, 0.5f, 1);
|
|
|
|
|
+ // player1Camera.rect = new Rect(0.5f, 0, 0.5f, 1);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0Camera.rect = new Rect(0.5f, 0, 0.5f, 1);
|
|
|
|
|
+ // player1Camera.rect = new Rect(0, 0, 0.5f, 1);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // CameraSplit(false);
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- view = 0;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- float viewX = Mathf.Clamp((distanceX - mergeDistanceX) * ratio, 0, maxView);
|
|
|
|
|
- float viewY = (distanceY - mergeDistanceY) * ratioY;
|
|
|
|
|
- if(viewX > viewY)
|
|
|
|
|
- {
|
|
|
|
|
- view = viewX;
|
|
|
|
|
- //if (isSplitY)
|
|
|
|
|
- //{
|
|
|
|
|
- // isSplitY = false;
|
|
|
|
|
- //}
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- view = viewY;
|
|
|
|
|
- //isSplitY = true;
|
|
|
|
|
|
|
+ //}
|
|
|
|
|
+ //else
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // view = 0;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // float viewX = Mathf.Clamp((distanceX - mergeDistanceX) * ratio, 0, maxView);
|
|
|
|
|
+ // float viewY = (distanceY - mergeDistanceY) * ratioY;
|
|
|
|
|
+ // if(viewX > viewY)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // view = viewX;
|
|
|
|
|
+ // //if (isSplitY)
|
|
|
|
|
+ // //{
|
|
|
|
|
+ // // isSplitY = false;
|
|
|
|
|
+ // //}
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // view = viewY;
|
|
|
|
|
+ // //isSplitY = true;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- if (player0.isRevive || player1.isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- offsetYDown = 0;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- offsetYDown = Mathf.Clamp(totalOffsetYDown / (2 * mergeDistanceY) * distanceY,
|
|
|
|
|
- totalOffsetYDown, 0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (player0.isRevive || player1.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // offsetYDown = 0;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // offsetYDown = Mathf.Clamp(totalOffsetYDown / (2 * mergeDistanceY) * distanceY,
|
|
|
|
|
+ // totalOffsetYDown, 0);
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- lineInCamera.transform.localScale = new Vector3(
|
|
|
|
|
- Mathf.Clamp((distanceX - mergeDistanceX) * 0.01f, 0,
|
|
|
|
|
- lineMaxScale), 20, 1);
|
|
|
|
|
|
|
+ //if (isSplit)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // lineInCamera.transform.localScale = new Vector3(
|
|
|
|
|
+ // Mathf.Clamp((distanceX - mergeDistanceX) * 0.01f, 0,
|
|
|
|
|
+ // lineMaxScale), 20, 1);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
private void FixedUpdate()
|
|
private void FixedUpdate()
|
|
|
{
|
|
{
|
|
|
PlayerController player0 = PlayersInput.instance[0];
|
|
PlayerController player0 = PlayersInput.instance[0];
|
|
|
- PlayerController player1 = PlayersInput.instance[1];
|
|
|
|
|
|
|
+ //PlayerController player1 = PlayersInput.instance[1];
|
|
|
if (player0 == null)
|
|
if (player0 == null)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- else if (player1 == player0)
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
if (player0.isRevive)
|
|
if (player0.isRevive)
|
|
|
{
|
|
{
|
|
@@ -236,105 +234,127 @@ public class CameraController : MonoBehaviour
|
|
|
mainCamera.transform.position =
|
|
mainCamera.transform.position =
|
|
|
Vector3.Lerp(mainCamera.transform.position, targetPos, lerpValue * Time.deltaTime);
|
|
Vector3.Lerp(mainCamera.transform.position, targetPos, lerpValue * Time.deltaTime);
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- player0TargetPos = CameraTargetMove(player0);
|
|
|
|
|
- player1TargetPos = CameraTargetMove(player1);
|
|
|
|
|
- if (player0.isRevive && player1.isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- player0TargetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
- player1TargetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
- view = 0;
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- CameraSplit(true);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (player0.isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- player0TargetPos = CameraTargetMove(player1);
|
|
|
|
|
- view = 0;
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- CameraSplit(true);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (player1.isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- player1TargetPos = CameraTargetMove(player0);
|
|
|
|
|
- view = 0;
|
|
|
|
|
- if (isSplit)
|
|
|
|
|
- {
|
|
|
|
|
- CameraSplit(true);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (player0TargetPos.y > player1TargetPos.y)
|
|
|
|
|
- {
|
|
|
|
|
- player0Camera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
- player0TargetPos + Vector3.up * offsetYDown, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
- player1Camera.transform.position = Vector3.Lerp(player1Camera.transform.position,
|
|
|
|
|
- player1TargetPos, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- player0Camera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
- player0TargetPos, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
- player1Camera.transform.position = Vector3.Lerp(player1Camera.transform.position,
|
|
|
|
|
- player1TargetPos + Vector3.up * offsetYDown, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //else if (player1 == player0)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (player0.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // targetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // targetPos = CameraTargetMove(player0);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // mainCamera.transform.position =
|
|
|
|
|
+ // Vector3.Lerp(mainCamera.transform.position, targetPos, lerpValue * Time.deltaTime);
|
|
|
|
|
+ //}
|
|
|
|
|
+ //else
|
|
|
|
|
+ //{
|
|
|
|
|
+ // player0TargetPos = CameraTargetMove(player0);
|
|
|
|
|
+ // player1TargetPos = CameraTargetMove(player1);
|
|
|
|
|
+ // if (player0.isRevive && player1.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0TargetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
+ // player1TargetPos = new Vector3(140, offsetY, offsetZ);
|
|
|
|
|
+ // view = 0;
|
|
|
|
|
+ // if (isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // CameraSplit(true);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else if (player0.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0TargetPos = CameraTargetMove(player1);
|
|
|
|
|
+ // view = 0;
|
|
|
|
|
+ // if (isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // CameraSplit(true);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else if (player1.isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player1TargetPos = CameraTargetMove(player0);
|
|
|
|
|
+ // view = 0;
|
|
|
|
|
+ // if (isSplit)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // CameraSplit(true);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (player0TargetPos.y > player1TargetPos.y)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0Camera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
+ // player0TargetPos + Vector3.up * offsetYDown, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
+ // player1Camera.transform.position = Vector3.Lerp(player1Camera.transform.position,
|
|
|
|
|
+ // player1TargetPos, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // player0Camera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
+ // player0TargetPos, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
+ // player1Camera.transform.position = Vector3.Lerp(player1Camera.transform.position,
|
|
|
|
|
+ // player1TargetPos + Vector3.up * offsetYDown, lerpValue * 2 * Time.deltaTime);
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
|
- mainCamera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
- player1Camera.transform.position, 0.5f);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // mainCamera.transform.position = Vector3.Lerp(player0Camera.transform.position,
|
|
|
|
|
+ // player1Camera.transform.position, 0.5f);
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void CameraSplit(bool flag)
|
|
|
|
|
- {
|
|
|
|
|
- if (flag)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ //public void CameraSplit(bool flag)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (flag)
|
|
|
|
|
+ // {
|
|
|
|
|
|
|
|
- mainCamera.enabled = true;
|
|
|
|
|
- player0Camera.enabled = false;
|
|
|
|
|
- player1Camera.enabled = false;
|
|
|
|
|
- lineInCamera.SetActive(false);
|
|
|
|
|
- isSplit = false;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if(PlayersInput.instance[0].isRevive || PlayersInput.instance[1].isRevive)
|
|
|
|
|
- {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- offsetYDown = 0;
|
|
|
|
|
- mainCamera.enabled = false;
|
|
|
|
|
- player0Camera.enabled = true;
|
|
|
|
|
- player1Camera.enabled = true;
|
|
|
|
|
- lineInCamera.SetActive(true);
|
|
|
|
|
- isSplit = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // mainCamera.enabled = true;
|
|
|
|
|
+ // player0Camera.enabled = false;
|
|
|
|
|
+ // player1Camera.enabled = false;
|
|
|
|
|
+ // lineInCamera.SetActive(false);
|
|
|
|
|
+ // isSplit = false;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // if(PlayersInput.instance[0].isRevive || PlayersInput.instance[1].isRevive)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // offsetYDown = 0;
|
|
|
|
|
+ // mainCamera.enabled = false;
|
|
|
|
|
+ // player0Camera.enabled = true;
|
|
|
|
|
+ // player1Camera.enabled = true;
|
|
|
|
|
+ // lineInCamera.SetActive(true);
|
|
|
|
|
+ // isSplit = true;
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
Vector3 CameraTargetMove(PlayerController player)
|
|
Vector3 CameraTargetMove(PlayerController player)
|
|
|
{
|
|
{
|
|
|
Vector3 skewPos;
|
|
Vector3 skewPos;
|
|
|
- if (isSplit)
|
|
|
|
|
|
|
+ if (player.bodyTrans.localScale.x > 0)
|
|
|
{
|
|
{
|
|
|
- if (player.bodyTrans.localScale.x > 0)
|
|
|
|
|
- {
|
|
|
|
|
- skewPos = player.transform.position + new Vector3(-offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- skewPos = player.transform.position + new Vector3(offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(-offsetX, offsetY, offsetZ);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- skewPos = player.transform.position + new Vector3(0, offsetY, offsetZ - view);
|
|
|
|
|
|
|
+ skewPos = player.transform.position + new Vector3(offsetX, offsetY, offsetZ);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //if (isSplit)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if (player.bodyTrans.localScale.x > 0)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // skewPos = player.transform.position + new Vector3(-offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
+
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // skewPos = player.transform.position + new Vector3(offsetX / 2, offsetY, splitOffsetZ);
|
|
|
|
|
+
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
|
|
+ //else
|
|
|
|
|
+ //{
|
|
|
|
|
+ // 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);
|
|
|
return skewPos;
|
|
return skewPos;
|