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 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Pause",
"type": "Button",
"id": "b8a4b9a5-092f-4e12-b46b-9a08034975b3",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
......@@ -581,6 +590,17 @@
"action": "MINIMAP",
"isComposite": 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:
value: 2.64
keyValue:
overrideState: 1
value: 1.6
value: 1.45
eyeAdaptation:
overrideState: 1
value: 0
......
This diff is collapsed.
fileFormatVersion: 2
guid: 85225e3e22375564f9aa9879a1be6eea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@ public class ArrowController : MonoBehaviour
// Start is called before the first frame update
public GameObject arrowPrefab;
public GameObject arrowPlace;
//public GameObject arrowPlace;
public GameObject arrowTrigger;
public GameObject arrowBack;
public Vector3 arrowHeading;
......@@ -16,9 +16,7 @@ public class ArrowController : MonoBehaviour
public bool waitingToShoot = false;
void Start()
{
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");
//arrowPlace = GameObject.Find("XR Interaction Setup/XR Origin (XR Rig)/Camera Offset/Main Camera/ArrowPlace");
}
// Update is called once per frame
......@@ -35,9 +33,8 @@ public class ArrowController : MonoBehaviour
public void GrabArrow()
{
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;
//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;
}
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
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.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0);
stringMiddlePoint.GetComponent<Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
......
......@@ -2,16 +2,21 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using TMPro;
using UnityEngine.InputSystem;
public class GameSystem : SingletonBase<GameSystem>
{
[SerializeField] private float totalTime = 60f; // 倒计时总时间
[Tooltip("时间文本")]
public TMP_Text text_Time;
[Tooltip("暂停")]
public InputActionReference Pause;
[Tooltip("暂停UI")]
public GameObject PauseUI;
[Tooltip("暂停后处理")]
public GameObject PausePostProcessing;
[Tooltip("当前剩余时间")]
private float currentTime;
......@@ -26,6 +31,12 @@ public class GameSystem : SingletonBase<GameSystem>
private void Start()
{
if (Pause != null)
{
Pause.action.Enable();
Pause.action.performed += PauseGame;
}
currentTime = totalTime;
StartGame();
}
......@@ -95,16 +106,41 @@ public class GameSystem : SingletonBase<GameSystem>
/// </summary>
public void PauseGame()
{
StartCoroutine(PauseGameCoroutine());
}
private IEnumerator PauseGameCoroutine()
{
PausePostProcessing.SetActive(true);
yield return new WaitForSeconds(1f);
Time.timeScale = 0f;
isPauseGame = true;
PauseUI.SetActive(true);
}
/// <summary>
/// 暂停游戏
/// </summary>
public void PauseGame(InputAction.CallbackContext context)
{
if (isPauseGame)
{
ResumeGame();
}
else
{
PauseGame();
}
}
/// <summary>
/// 恢复游戏
/// </summary>
public void ResumeGame()
{
PausePostProcessing.SetActive(false);
Time.timeScale = 1f;
isPauseGame = false;
PauseUI.SetActive(false);
......
......@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable
// 计算新的拉伸程度,并返回它在空间中的位置
PullAmount = CalculatePull(interactorPosition);
}
private float CalculatePull(Vector3 pullPosition)
......
......@@ -9,6 +9,10 @@ TagManager:
- Destroyer
- MiniWorldCamera
- Water
- Arrow
- ArrowTip
- Target
- ArrowOn
layers:
- Default
- 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