Commit 0e653859 authored by 杨泽宇's avatar 杨泽宇

更新迷宫第一层

parent c2bb341f
...@@ -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 diff is collapsed.
This diff is collapsed.
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:
...@@ -2,16 +2,23 @@ using System.Collections; ...@@ -2,16 +2,23 @@ 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("主摄像机后处理")]
public GameObject MainPostProcessing;
[Tooltip("当前剩余时间")] [Tooltip("当前剩余时间")]
private float currentTime; private float currentTime;
...@@ -26,6 +33,12 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -26,6 +33,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 +108,35 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -95,16 +108,35 @@ public class GameSystem : SingletonBase<GameSystem>
/// </summary> /// </summary>
public void PauseGame() public void PauseGame()
{ {
PausePostProcessing.SetActive(true);
MainPostProcessing.SetActive(false);
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);
MainPostProcessing.SetActive(true);
Time.timeScale = 1f; Time.timeScale = 1f;
isPauseGame = false; isPauseGame = false;
PauseUI.SetActive(false); PauseUI.SetActive(false);
......
...@@ -11,6 +11,8 @@ TagManager: ...@@ -11,6 +11,8 @@ TagManager:
- Water - Water
- Arrow - Arrow
- ArrowTip - 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