Commit a4349d42 authored by 杨泽宇's avatar 杨泽宇

更新

parent 00cab958
...@@ -359,6 +359,15 @@ ...@@ -359,6 +359,15 @@
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
},
{
"name": "Menu",
"type": "Button",
"id": "da813910-0185-4191-a68e-761c4db7fe71",
"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": "f89887f7-f467-4f08-9c5a-e87c443d79f6",
"path": "<XRController>{LeftHand}/menu",
"interactions": "",
"processors": "",
"groups": "",
"action": "Menu",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,20 +4,27 @@ using UnityEngine; ...@@ -4,20 +4,27 @@ using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.UI; 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;
[Tooltip("是否正在倒计时")] [Tooltip("是否正在倒计时")]
private bool isPauseGame = false; private bool isPauseGame = false;
public GameObject onGameEndUI;
[Tooltip("游戏开始时的事件")] [Tooltip("游戏开始时的事件")]
public UnityEvent onGameStart; public UnityEvent onGameStart;
...@@ -26,6 +33,11 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -26,6 +33,11 @@ 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();
} }
...@@ -67,8 +79,10 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -67,8 +79,10 @@ public class GameSystem : SingletonBase<GameSystem>
{ {
if (currentTime <= 0) if (currentTime <= 0)
{ {
Time.timeScale = 0f;
currentTime = 0; currentTime = 0;
isPauseGame = false; isPauseGame = false;
onGameEndUI.SetActive(true);
onGameEnd.Invoke(); onGameEnd.Invoke();
} }
} }
...@@ -95,6 +109,25 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -95,6 +109,25 @@ public class GameSystem : SingletonBase<GameSystem>
/// </summary> /// </summary>
public void PauseGame() public void PauseGame()
{ {
StartCoroutine(PauseGameCoroutine());
}
public void PauseGame(InputAction.CallbackContext context)
{
if (isPauseGame)
{
ResumeGame();
}
else
{
PauseGame();
}
}
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);
...@@ -105,8 +138,10 @@ public class GameSystem : SingletonBase<GameSystem> ...@@ -105,8 +138,10 @@ public class GameSystem : SingletonBase<GameSystem>
/// </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);
} }
} }
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
/// <summary>
/// 滑动验证
/// </summary>
public class SlidingVerification : MonoBehaviour public class SlidingVerification : MonoBehaviour
{ {
[Tooltip("滑动条")]
public Slider slider;
[Tooltip("验证中心点位置")]
public float triggerPosition;
[Tooltip("验证前后范围")]
public float triggerThreshold = 0.5f;
public UnityEvent SuccessEvent;
[Tooltip("正确反馈UI")]
public GameObject SuccessUI;
private bool isDragging = false;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
if (slider == null)
{
Debug.LogError("没有设置Slider");
enabled = false;
}
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (isDragging)
{
return;
}
else
{
if (slider.value >= triggerPosition - triggerThreshold && slider.value <= triggerPosition + triggerThreshold)
{
SuccessUI.SetActive(true);
SuccessEvent.Invoke();
}
}
}
public void OnSliderDragStart()
{
isDragging = true;
}
public void OnSliderDragEnd()
{
isDragging = false;
} }
} }
...@@ -33,7 +33,10 @@ AnimatorStateMachine: ...@@ -33,7 +33,10 @@ AnimatorStateMachine:
m_ChildStates: m_ChildStates:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 8687181047316162206} m_State: {fileID: 8687181047316162206}
m_Position: {x: 200, y: 0, z: 0} m_Position: {x: 330, y: 150, z: 0}
- serializedVersion: 1
m_State: {fileID: 6226603698969438560}
m_Position: {x: 377.91882, y: -34.3528, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
...@@ -43,7 +46,33 @@ AnimatorStateMachine: ...@@ -43,7 +46,33 @@ AnimatorStateMachine:
m_EntryPosition: {x: 50, y: 120, z: 0} m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 8687181047316162206} m_DefaultState: {fileID: 6226603698969438560}
--- !u!1102 &6226603698969438560
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New State
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &8687181047316162206 --- !u!1102 &8687181047316162206
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
......
...@@ -59,7 +59,10 @@ AnimatorStateMachine: ...@@ -59,7 +59,10 @@ AnimatorStateMachine:
m_ChildStates: m_ChildStates:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 1342997852910071057} m_State: {fileID: 1342997852910071057}
m_Position: {x: 200, y: 0, z: 0} m_Position: {x: 280, y: 10, z: 0}
- serializedVersion: 1
m_State: {fileID: 8356128917497193178}
m_Position: {x: 305.5838, y: 97.05585, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
...@@ -69,4 +72,30 @@ AnimatorStateMachine: ...@@ -69,4 +72,30 @@ AnimatorStateMachine:
m_EntryPosition: {x: 50, y: 120, z: 0} m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1342997852910071057} m_DefaultState: {fileID: 8356128917497193178}
--- !u!1102 &8356128917497193178
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New State
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
...@@ -68,7 +68,7 @@ AnimationClip: ...@@ -68,7 +68,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0
......
...@@ -68,7 +68,7 @@ AnimationClip: ...@@ -68,7 +68,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0
......
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