Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
顺
顺职VR迷宫游戏教学
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨泽宇
顺职VR迷宫游戏教学
Commits
367128f2
Commit
367128f2
authored
Mar 01, 2024
by
张英美
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of git@gitlab.sd-zeus.com:yangzeyu/ShunZhiMazeVR.git
parents
addaeed0
f2bfc70a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
3749 additions
and
703 deletions
+3749
-703
XRI Default Input Actions.inputactions
...3.2/Starter Assets/XRI Default Input Actions.inputactions
+20
-0
Main Camera (1) Profile.asset
...Scenes/Demo/Scene1_Profiles/Main Camera (1) Profile.asset
+1
-1
暂停.asset
Assets/Scenes/Demo/Scene1_Profiles/暂停.asset
+0
-0
暂停.asset.meta
Assets/Scenes/Demo/Scene1_Profiles/暂停.asset.meta
+8
-0
1_Maze1.unity
Assets/_Scenes/1_Maze1.unity
+2204
-579
2_Maze2.unity
Assets/_Scenes/2_Maze2.unity
+1414
-114
ArrowController.cs
Assets/_Scripts/ArrowController.cs
+4
-7
ArrowScore.cs
Assets/_Scripts/ArrowScore.cs
+44
-0
ArrowScore.cs.meta
Assets/_Scripts/ArrowScore.cs.meta
+11
-0
BowController.cs
Assets/_Scripts/BowController.cs
+1
-1
GameSystem.cs
Assets/_Scripts/GameSystem.cs
+37
-1
PullMeasurer.cs
Assets/_Scripts/PullMeasurer.cs
+1
-0
TagManager.asset
ProjectSettings/TagManager.asset
+4
-0
No files found.
Assets/Samples/XR Interaction Toolkit/2.3.2/Starter Assets/XRI Default Input Actions.inputactions
View file @
367128f2
...
...
@@ -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
}
]
},
...
...
Assets/Scenes/Demo/Scene1_Profiles/Main Camera (1) Profile.asset
View file @
367128f2
...
...
@@ -1481,7 +1481,7 @@ MonoBehaviour:
value
:
2.64
keyValue
:
overrideState
:
1
value
:
1.
6
value
:
1.
45
eyeAdaptation
:
overrideState
:
1
value
:
0
...
...
Assets/Scenes/Demo/Scene1_Profiles/暂停.asset
0 → 100644
View file @
367128f2
This diff is collapsed.
Click to expand it.
Assets/Scenes/Demo/Scene1_Profiles/暂停.asset.meta
0 → 100644
View file @
367128f2
fileFormatVersion: 2
guid: 85225e3e22375564f9aa9879a1be6eea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Assets/_Scenes/1_Maze1.unity
View file @
367128f2
This diff is collapsed.
Click to expand it.
Assets/_Scenes/2_Maze2.unity
View file @
367128f2
This diff is collapsed.
Click to expand it.
Assets/_Scripts/ArrowController.cs
View file @
367128f2
...
...
@@ -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
()
...
...
Assets/_Scripts/ArrowScore.cs
0 → 100644
View file @
367128f2
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"
;
}
}
}
Assets/_Scripts/ArrowScore.cs.meta
0 → 100644
View file @
367128f2
fileFormatVersion: 2
guid: f267821b3b5ee724a924ba512a161c7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/_Scripts/BowController.cs
View file @
367128f2
...
...
@@ -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
);
...
...
Assets/_Scripts/GameSystem.cs
View file @
367128f2
...
...
@@ -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
);
...
...
Assets/_Scripts/PullMeasurer.cs
View file @
367128f2
...
...
@@ -36,6 +36,7 @@ public class PullMeasurer : XRBaseInteractable
// 计算新的拉伸程度,并返回它在空间中的位置
PullAmount
=
CalculatePull
(
interactorPosition
);
}
private
float
CalculatePull
(
Vector3
pullPosition
)
...
...
ProjectSettings/TagManager.asset
View file @
367128f2
...
...
@@ -9,6 +9,10 @@ TagManager:
-
Destroyer
-
MiniWorldCamera
-
Water
-
Arrow
-
ArrowTip
-
Target
-
ArrowOn
layers
:
-
Default
-
TransparentFX
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment