Commit 367128f2 authored by 张英美's avatar 张英美

Merge branch 'main' of git@gitlab.sd-zeus.com:yangzeyu/ShunZhiMazeVR.git

parents addaeed0 f2bfc70a
...@@ -359,6 +359,15 @@ ...@@ -359,6 +359,15 @@
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
},
{
"name": "Pause",
"type": "Button",
"id": "b8a4b9a5-092f-4e12-b46b-9a08034975b3",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
} }
], ],
"bindings": [ "bindings": [
...@@ -581,6 +590,17 @@ ...@@ -581,6 +590,17 @@
"action": "MINIMAP", "action": "MINIMAP",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "a70c1390-c532-4ad7-97ab-ac90fc071ffc",
"path": "<XRController>{LeftHand}/menuButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
}, },
......
...@@ -1481,7 +1481,7 @@ MonoBehaviour: ...@@ -1481,7 +1481,7 @@ MonoBehaviour:
value: 2.64 value: 2.64
keyValue: keyValue:
overrideState: 1 overrideState: 1
value: 1.6 value: 1.45
eyeAdaptation: eyeAdaptation:
overrideState: 1 overrideState: 1
value: 0 value: 0
......
This diff is collapsed.
fileFormatVersion: 2
guid: 85225e3e22375564f9aa9879a1be6eea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour ...@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
public GameObject arrowPrefab; public GameObject arrowPrefab;
public GameObject arrowPlace; //public GameObject arrowPlace;
public GameObject arrowTrigger; public GameObject arrowTrigger;
public GameObject arrowBack; public GameObject arrowBack;
public Vector3 arrowHeading; public Vector3 arrowHeading;
...@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour ...@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour
public bool waitingToShoot = false; public bool waitingToShoot = false;
void Start() void Start()
{ {
arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace"); //arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace");
arrowTrigger = GameObject.Find("Bow/ArrowTrigger");
arrowBack = GameObject.Find("Bow/String/Notch");
} }
// Update is called once per frame // Update is called once per frame
...@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour ...@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour
public void GrabArrow() public void GrabArrow()
{ {
//GameObject arrow = Instantiate(arrowPrefab, arrowPlace.transform.position, arrowPlace.transform.rotation);
GameObject arrow = Instantiate(arrowPrefab, arrowPlace.transform.position, arrowPlace.transform.rotation); //arrow.transform.parent = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera").transform;
arrow.transform.parent = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera").transform;
} }
public void ReleaseArrow() public void ReleaseArrow()
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class ArrowScore : MonoBehaviour
{
[Tooltip("提示文本")]
public TMP_Text text_Tip;
// Start is called before the first frame update
public GameObject targetCenter;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter(Collider collider)
{
if (collider.tag == "Arrow")
{
float distance = 10 - (new Vector3(0, collider.transform.position.y, collider.transform.position.z) -
new Vector3(0, targetCenter.transform.position.y, targetCenter.transform.position.z)).magnitude * 10;
if (distance < 0)
{
text_Tip.text = "Miss";
}
else
{
text_Tip.text = Mathf.CeilToInt(distance).ToString();
}
collider.tag = "ArrowOn";
}
}
}
fileFormatVersion: 2
guid: f267821b3b5ee724a924ba512a161c7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -28,7 +28,7 @@ public class BowController : MonoBehaviour ...@@ -28,7 +28,7 @@ public class BowController : MonoBehaviour
public void ReleaseString() public void ReleaseString()
{ {
Debug.Log("ReleaseString"); //Debug.Log("ReleaseString");
stringMiddlePoint.transform.position = (stringStartPoint.transform.position + stringEndPoint.transform.position + new Vector3(0, 0.07f, 0)) / 2; stringMiddlePoint.transform.position = (stringStartPoint.transform.position + stringEndPoint.transform.position + new Vector3(0, 0.07f, 0)) / 2;
stringMiddlePoint.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0); stringMiddlePoint.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0);
stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0); stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
......
...@@ -2,16 +2,21 @@ using System.Collections; ...@@ -2,16 +2,21 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.UI;
using TMPro; using TMPro;
using UnityEngine.InputSystem;
public class GameSystem : SingletonBase<GameSystem> public class GameSystem : SingletonBase<GameSystem>
{ {
[SerializeField] private float totalTime = 60f; // 倒计时总时间 [SerializeField] private float totalTime = 60f; // 倒计时总时间
[Tooltip("时间文本")] [Tooltip("时间文本")]
public TMP_Text text_Time; public TMP_Text text_Time;
[Tooltip("暂停")]
public InputActionReference Pause;
[Tooltip("暂停UI")] [Tooltip("暂停UI")]
public GameObject PauseUI; public GameObject PauseUI;
[Tooltip("暂停后处理")]
public GameObject PausePostProcessing;
[Tooltip("当前剩余时间")] [Tooltip("当前剩余时间")]
private float currentTime; private float currentTime;
...@@ -26,6 +31,12 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -26,6 +31,12 @@ public class GameSystem : SingletonBase<GameSystem>
private void Start() private void Start()
{ {
if (Pause != null)
{
Pause.action.Enable();
Pause.action.performed += PauseGame;
}
currentTime = totalTime; currentTime = totalTime;
StartGame(); StartGame();
} }
...@@ -95,16 +106,41 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -95,16 +106,41 @@ public class GameSystem : SingletonBase<GameSystem>
/// </summary> /// </summary>
public void PauseGame() public void PauseGame()
{ {
StartCoroutine(PauseGameCoroutine());
}
private IEnumerator PauseGameCoroutine()
{
PausePostProcessing.SetActive(true);
yield return new WaitForSeconds(1f);
Time.timeScale = 0f; Time.timeScale = 0f;
isPauseGame = true; isPauseGame = true;
PauseUI.SetActive(true); PauseUI.SetActive(true);
} }
/// <summary>
/// 暂停游戏
/// </summary>
public void PauseGame(InputAction.CallbackContext context)
{
if (isPauseGame)
{
ResumeGame();
}
else
{
PauseGame();
}
}
/// <summary> /// <summary>
/// 恢复游戏 /// 恢复游戏
/// </summary> /// </summary>
public void ResumeGame() public void ResumeGame()
{ {
PausePostProcessing.SetActive(false);
Time.timeScale = 1f; Time.timeScale = 1f;
isPauseGame = false; isPauseGame = false;
PauseUI.SetActive(false); PauseUI.SetActive(false);
......
...@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable ...@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable
// 计算新的拉伸程度,并返回它在空间中的位置 // 计算新的拉伸程度,并返回它在空间中的位置
PullAmount = CalculatePull(interactorPosition); PullAmount = CalculatePull(interactorPosition);
} }
private float CalculatePull(Vector3 pullPosition) private float CalculatePull(Vector3 pullPosition)
......
...@@ -9,6 +9,10 @@ TagManager: ...@@ -9,6 +9,10 @@ TagManager:
- Destroyer - Destroyer
- MiniWorldCamera - MiniWorldCamera
- Water - Water
- Arrow
- ArrowTip
- Target
- ArrowOn
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment