Browse Source

视角限制修改

pull/75/head
45 1 year ago
parent
commit
b1baa48bb2
  1. 14
      ColorlessWorld-2024-4-2/Assets/Prefab/CardPrefab/CardSmall/CardSmall_v02.prefab
  2. 2
      ColorlessWorld-2024-4-2/Assets/Prefab/CardPrefab/Card_v04-Common.prefab
  3. 12
      ColorlessWorld-2024-4-2/Assets/Prefab/ParticleSystem/Card/UseingCard.prefab
  4. 24
      ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity
  5. 102
      ColorlessWorld-2024-4-2/Assets/Scripts/CameraControl/CameraControl.cs
  6. 4
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardEntity.cs
  7. 10
      ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardSmall/CardSmall.cs
  8. BIN
      ColorlessWorld-2024-4-2/obj/Debug/Assembly-CSharp-Editor.csproj.AssemblyReference.cache

14
ColorlessWorld-2024-4-2/Assets/Prefab/CardPrefab/CardSmall/CardSmall_v02.prefab

@ -28,7 +28,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.2399993} m_LocalPosition: {x: 0, y: 0, z: 0.2399993}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
m_Father: {fileID: 7741983774095100766} m_Father: {fileID: 7741983774095100766}
@ -4823,8 +4823,8 @@ ParticleSystemRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 269777783
m_SortingLayer: 0 m_SortingLayer: 9
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 0 m_RenderMode: 0
m_MeshDistribution: 0 m_MeshDistribution: 0
@ -4887,7 +4887,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.88, y: 2.814, z: -2.25} m_LocalPosition: {x: 1.88, y: 2.814, z: -2.25}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.099999994, y: 0.099999994, z: 0.099999994}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 4180012044600342932} - {fileID: 4180012044600342932}
@ -5186,7 +5186,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.70710677, y: 0, z: 0, w: 0.70710677} m_LocalRotation: {x: 0.70710677, y: 0, z: 0, w: 0.70710677}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 3120153481628766344} - {fileID: 3120153481628766344}
@ -9982,8 +9982,8 @@ ParticleSystemRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 269777783
m_SortingLayer: 0 m_SortingLayer: 9
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 0 m_RenderMode: 0
m_MeshDistribution: 0 m_MeshDistribution: 0

2
ColorlessWorld-2024-4-2/Assets/Prefab/CardPrefab/Card_v04-Common.prefab

@ -458,7 +458,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
cardEntity: {fileID: 8400832028529023394} cardEntity: {fileID: 8400832028529023394}
inforBar: {fileID: 0} inforBar: {fileID: 0}
offSet: {x: 0.48, y: 0, z: -0.22} offSet: {x: 0, y: 0, z: 0}
--- !u!114 &2875900341032032975 --- !u!114 &2875900341032032975
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

12
ColorlessWorld-2024-4-2/Assets/Prefab/ParticleSystem/Card/UseingCard.prefab

@ -4866,7 +4866,7 @@ ParticleSystemRenderer:
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1195383285 m_SortingLayerID: -1195383285
m_SortingLayer: 7 m_SortingLayer: 8
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 4 m_RenderMode: 4
m_MeshDistribution: 0 m_MeshDistribution: 0
@ -5123,7 +5123,7 @@ ParticleSystem:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
minColor: {r: 1, g: 1, b: 1, a: 1} minColor: {r: 1, g: 1, b: 1, a: 1}
maxColor: {r: 1, g: 0.96023405, b: 0.8254717, a: 0.09803922} maxColor: {r: 1, g: 0.96023405, b: 0.8254717, a: 0.05882353}
maxGradient: maxGradient:
serializedVersion: 2 serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1} key0: {r: 1, g: 1, b: 1, a: 1}
@ -9766,7 +9766,7 @@ ParticleSystemRenderer:
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1195383285 m_SortingLayerID: -1195383285
m_SortingLayer: 7 m_SortingLayer: 8
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 4 m_RenderMode: 4
m_MeshDistribution: 0 m_MeshDistribution: 0
@ -9830,7 +9830,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 2.12, z: 1.88} m_LocalPosition: {x: 0, y: 2.12, z: 1.88}
m_LocalScale: {x: 0.7, y: 0.7, z: 0.7} m_LocalScale: {x: 0.6, y: 0.6, z: 0.6}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 8852517451189528295} - {fileID: 8852517451189528295}
@ -9879,7 +9879,7 @@ ParticleSystemRenderer:
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1195383285 m_SortingLayerID: -1195383285
m_SortingLayer: 7 m_SortingLayer: 8
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 4 m_RenderMode: 4
m_MeshDistribution: 0 m_MeshDistribution: 0
@ -19793,7 +19793,7 @@ ParticleSystemRenderer:
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1195383285 m_SortingLayerID: -1195383285
m_SortingLayer: 7 m_SortingLayer: 8
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 4 m_RenderMode: 4
m_MeshDistribution: 0 m_MeshDistribution: 0

24
ColorlessWorld-2024-4-2/Assets/Scenes/SampleScene.unity

@ -15763,17 +15763,17 @@ RectTransform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 569168380} m_GameObject: {fileID: 569168380}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0.0000040025} m_LocalPosition: {x: 0, y: 0, z: -0.0010689519}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.4, y: 0.4, z: 0.4}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
m_Father: {fileID: 2140661235} m_Father: {fileID: 2140661235}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -115.93756, y: 14.21344} m_AnchoredPosition: {x: -198.96837, y: 2.6563165}
m_SizeDelta: {x: 200, y: 200} m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: -0.06969196, y: 0.56556535} m_Pivot: {x: -0.9, y: 0.45}
--- !u!114 &569168384 --- !u!114 &569168384
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -18400,17 +18400,17 @@ MonoBehaviour:
keyBoardMoveY: 0 keyBoardMoveY: 0
rotationSpeed: 3 rotationSpeed: 3
moveSpeed: 40 moveSpeed: 40
fovSpeed: 200 fovSpeed: 2000
xMimAngle: -25 xMimAngle: -25
xMaxAngle: 25 xMaxAngle: 25
yMimAngle: -35 yMimAngle: -35
yMaxAngle: 5 yMaxAngle: 5
yMinDistance: 20 yMinDistance: 20
yMaxDistance: 50 yMaxDistance: 50
xMaxMove: 10 xMaxMove: 5
xMinMove: -10 xMinMove: -5
yMaxMove: 0 yMaxMove: 7
yMinMove: 0 yMinMove: -2
--- !u!1 &703194056 --- !u!1 &703194056
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -44019,7 +44019,7 @@ Canvas:
serializedVersion: 3 serializedVersion: 3
m_RenderMode: 1 m_RenderMode: 1
m_Camera: {fileID: 330585545} m_Camera: {fileID: 330585545}
m_PlaneDistance: 1.1 m_PlaneDistance: 4.1
m_PixelPerfect: 0 m_PixelPerfect: 0
m_ReceivesEvents: 1 m_ReceivesEvents: 1
m_OverrideSorting: 0 m_OverrideSorting: 0
@ -53059,7 +53059,7 @@ Canvas:
serializedVersion: 3 serializedVersion: 3
m_RenderMode: 1 m_RenderMode: 1
m_Camera: {fileID: 330585545} m_Camera: {fileID: 330585545}
m_PlaneDistance: 1 m_PlaneDistance: 4
m_PixelPerfect: 0 m_PixelPerfect: 0
m_ReceivesEvents: 1 m_ReceivesEvents: 1
m_OverrideSorting: 0 m_OverrideSorting: 0

102
ColorlessWorld-2024-4-2/Assets/Scripts/CameraControl/CameraControl.cs

@ -37,12 +37,21 @@ public class CameraControl : MonoBehaviour
public float xMinMove; public float xMinMove;
public float yMaxMove; public float yMaxMove;
public float yMinMove; public float yMinMove;
Vector3 xMaxPos;
Vector3 xMinPos;
Vector3 yMaxPos;
Vector3 yMinPos;
void Start() void Start()
{ {
rotationX = transform.localEulerAngles.y; rotationX = transform.localEulerAngles.y;
rotationY = -transform .localEulerAngles.x; rotationY = -transform .localEulerAngles.x;
startRotation = transform.localEulerAngles; startRotation = transform.localEulerAngles;
startPos = transform.position; startPos = transform.position;
xMaxPos = transform.position + new Vector3(xMaxMove, 0, 0);
xMinPos = transform .position + new Vector3 (xMinMove, 0, 0);
yMaxPos = transform.position + new Vector3(0, 0, yMaxMove);
yMinPos = transform .position + new Vector3 ( 0, 0, yMinMove);
} }
private void LateUpdate() private void LateUpdate()
@ -56,23 +65,88 @@ public class CameraControl : MonoBehaviour
//平面向量 //平面向量
Quaternion rotation = Quaternion.AngleAxis(90 - transform.localEulerAngles.x, transform.right); Quaternion rotation = Quaternion.AngleAxis(90 - transform.localEulerAngles.x, transform.right);
Vector3 dir = rotation * transform.up; Vector3 dir = rotation * transform.up;
if (transform.position.x > xMaxPos.x)
{
if (moveX < 0)
{
moveX = 0;
}
}
if (transform.position.x < xMinPos.x)
{
if (moveX > 0)
{
moveX = 0;
}
}
if (transform.position.z > yMaxPos.z)
{
if (moveY < 0)
{
moveY = 0;
}
}
if (transform.position.z < yMinPos.z)
{
if (moveY > 0)
{
moveY = 0;
}
}
Vector3 x = Vector3.right * -moveX * Time.deltaTime;
if (Mathf.Abs(x.x) > 0.2f)
{
x.x = 0f;
}
transform.Translate(x);
transform.Translate(dir * -moveY * Time.deltaTime, Space.World); Vector3 z = dir * -moveY * Time.deltaTime;
transform.Translate(Vector3.right * -moveX * Time.deltaTime); if(Mathf .Abs (z.z)>0.2f)
{
z.z = 0f;
}
transform.Translate(z, Space.World);
} }
else else
{ {
keyBoardMoveX = Input.GetAxis("Vertical") * moveSpeed / 2.0f; keyBoardMoveY = Input.GetAxis("Vertical") * moveSpeed / 2.0f;
keyBoardMoveY = Input.GetAxis("Horizontal") * moveSpeed / 2.0f; keyBoardMoveX = Input.GetAxis("Horizontal") * moveSpeed / 2.0f;
//平面向量 //平面向量
Quaternion rotation = Quaternion.AngleAxis(90 - transform.localEulerAngles.x, transform.right); Quaternion rotation = Quaternion.AngleAxis(90 - transform.localEulerAngles.x, transform.right);
Vector3 dir = rotation * transform.up; Vector3 dir = rotation * transform.up;
if (transform.position.x > xMaxPos.x)
{
if (keyBoardMoveX > 0)
{
keyBoardMoveX = 0;
}
}
if (transform.position.x < xMinPos.x)
{
if (keyBoardMoveX < 0)
{
keyBoardMoveX = 0;
}
}
if (transform.position.z > yMaxPos.z)
{
if (keyBoardMoveY > 0)
{
keyBoardMoveY = 0;
}
}
if (transform.position.z < yMinPos.z)
{
if (keyBoardMoveY < 0)
{
keyBoardMoveY = 0;
}
}
transform.Translate(Vector3.right * keyBoardMoveX * Time.deltaTime);
transform.Translate(dir * keyBoardMoveY * Time.deltaTime, Space.World);
transform.Translate(dir * keyBoardMoveX * Time.deltaTime, Space.World);
transform.Translate(Vector3.right * keyBoardMoveY * Time.deltaTime);
} }
//按下鼠标右键-旋转 //按下鼠标右键-旋转
if (Input.GetMouseButton(1)) if (Input.GetMouseButton(1))
@ -90,13 +164,23 @@ public class CameraControl : MonoBehaviour
if (scrollWheelInput > 0f && virtualCamera.m_Lens.FieldOfView < yMaxDistance) if (scrollWheelInput > 0f && virtualCamera.m_Lens.FieldOfView < yMaxDistance)
{ {
// Debug.Log("向上滚动鼠标滚轮"); // Debug.Log("向上滚动鼠标滚轮");
virtualCamera.m_Lens.FieldOfView += Time.deltaTime * fovSpeed * scrollWheelInput; float fovMove = Time.deltaTime * fovSpeed * scrollWheelInput;
if (fovMove > 2)
{
fovMove = 0;
}
virtualCamera.m_Lens.FieldOfView += fovMove;
//transform.position += new Vector3(0, Time.deltaTime * fovSpeed * scrollWheelInput, 0); //transform.position += new Vector3(0, Time.deltaTime * fovSpeed * scrollWheelInput, 0);
} }
else if (scrollWheelInput < 0f && virtualCamera.m_Lens.FieldOfView > yMinDistance) else if (scrollWheelInput < 0f && virtualCamera.m_Lens.FieldOfView > yMinDistance)
{ {
// Debug.Log("向下滚动鼠标滚轮"); // Debug.Log("向下滚动鼠标滚轮");
virtualCamera.m_Lens.FieldOfView += Time.deltaTime * fovSpeed * scrollWheelInput; float fovMove = Time.deltaTime * fovSpeed * scrollWheelInput;
if (fovMove > 2)
{
fovMove = 0;
}
virtualCamera.m_Lens.FieldOfView += fovMove;
// transform.position += new Vector3(0, Time.deltaTime * fovSpeed * scrollWheelInput, 0); // transform.position += new Vector3(0, Time.deltaTime * fovSpeed * scrollWheelInput, 0);
} }
} }

4
ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardEntity.cs

@ -179,6 +179,7 @@ public class CardEntity : MonoBehaviour
{ {
//生成小卡 //生成小卡
var cardPrefab = Instantiate(smallCardPrefab, transform.position, transform.localRotation); var cardPrefab = Instantiate(smallCardPrefab, transform.position, transform.localRotation);
// cardPrefab.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
cardPrefab.GetComponent<CardSmall>().SetDestination(TurnMaster.Instance.usedCardNumberText.gameObject, cardId); cardPrefab.GetComponent<CardSmall>().SetDestination(TurnMaster.Instance.usedCardNumberText.gameObject, cardId);
//生成原本卡 //生成原本卡
/* /*
@ -192,7 +193,8 @@ public class CardEntity : MonoBehaviour
*/ */
//生成粒子特效 //生成粒子特效
var light = Instantiate(ParticalManager.Instance.usingCardParticleEffect, cardPrefab.transform.position, cardPrefab.transform.rotation); var light = Instantiate(ParticalManager.Instance.usingCardParticleEffect, cardPrefab.transform.position, cardPrefab.transform.rotation);
light.transform.position += new Vector3(0, 0.6f, 0); //light.transform.position += new Vector3(0, 0.6f, 0);
// light.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
Destroy(this.gameObject); Destroy(this.gameObject);
} }
//获取卡牌图片 //获取卡牌图片

10
ColorlessWorld-2024-4-2/Assets/Scripts/Card/CardSmall/CardSmall.cs

@ -42,7 +42,7 @@ public class CardSmall : MonoBehaviour
float angle = Vector3.SignedAngle(CardActiveSort .Instance .transform .InverseTransformDirection( transform.up), direction, CardActiveSort.Instance.transform.InverseTransformDirection (- transform.forward)); float angle = Vector3.SignedAngle(CardActiveSort .Instance .transform .InverseTransformDirection( transform.up), direction, CardActiveSort.Instance.transform.InverseTransformDirection (- transform.forward));
transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, new Vector3(0, 0, angle), Time.deltaTime * rotationSpeed); transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, new Vector3(0, 0, angle), Time.deltaTime * rotationSpeed);
if (Vector3.Distance(this.transform.position, linePath[i + 1]) < 0.05) if (time >=1)
{ {
isMove = false; isMove = false;
@ -115,11 +115,11 @@ public class CardSmall : MonoBehaviour
lineRender = GetComponent<LineRenderer>(); lineRender = GetComponent<LineRenderer>();
mainCaera = GameManager.Instance.mainCamera; mainCaera = GameManager.Instance.mainCamera;
lineStart =transform.position + new Vector3(0, 0, -0.05f); lineStart =transform.position + new Vector3(0, 0, 0f);
lineEnd = gameObject.transform.position + new Vector3(0, 0, -0.05f); lineEnd = gameObject.transform.position + new Vector3(0, 0, 0f);
lineMiddel = lineStart + new Vector3(-1f, 3f, 3f); lineMiddel = lineStart + new Vector3(-0.5f, 1.5f, 0f);
CalculatePath(); CalculatePath();
//speed = 12f;
StartCoroutine(moveCardFollowLineWithToUsedCard()); StartCoroutine(moveCardFollowLineWithToUsedCard());
} }
public void SetDestinationWithDrawCard(Vector3 endPoint) public void SetDestinationWithDrawCard(Vector3 endPoint)

BIN
ColorlessWorld-2024-4-2/obj/Debug/Assembly-CSharp-Editor.csproj.AssemblyReference.cache

Binary file not shown.
Loading…
Cancel
Save