Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StockRunning
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czy
StockRunning
Commits
28ace866
Commit
28ace866
authored
Apr 22, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
胜利失败选关ui的逻辑判断
parent
4083632e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
3 deletions
+74
-3
BattleUI.cs
StockRunning/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
+16
-1
EndPoint.cs
StockRunning/Assets/My/Scripts/EndPoint.cs
+32
-0
EndPoint.cs.meta
StockRunning/Assets/My/Scripts/EndPoint.cs.meta
+11
-0
PlayerMove.cs
StockRunning/Assets/My/Scripts/Player/PlayerMove.cs
+2
-2
Level2My.prefab
StockRunning/Assets/Prefabs/Level2My.prefab
+13
-0
No files found.
StockRunning/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
View file @
28ace866
...
...
@@ -42,6 +42,7 @@ public class BattleUI : MonoBehaviour
public
Slider
sliderScore
;
public
Text
ScoreTex
;
public
Text
Timer
;
private
float
timerT1
;
[
Header
(
"排行榜"
)]
public
Text
text1
;
public
Text
text2
;
...
...
@@ -93,7 +94,18 @@ public class BattleUI : MonoBehaviour
}
private
void
Update
()
{
Timer
.
text
=
Time
.
time
.
ToString
(
"F1"
);
if
(
BattleCtrl
.
instance
.
isStartBattle
&&
!
BattleCtrl
.
instance
.
isEndBattle
)
{
timerT1
+=
Time
.
deltaTime
;
}
if
(!
BattleCtrl
.
instance
.
isStartBattle
&&
!
BattleCtrl
.
instance
.
isEndBattle
)
{
timerT1
=
0.0f
;
}
Timer
.
text
=
timerT1
.
ToString
(
"F1"
);
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
}
void
SetDragMode
()
{
...
...
@@ -134,6 +146,7 @@ public class BattleUI : MonoBehaviour
public
void
NextLevel
()
{
m_successObj
.
SetActive
(
false
);
m_startLogoObj
.
SetActive
(
true
);
BattleCtrl
.
instance
.
levelManager
.
LoadNextLevel
();
}
//选择关卡
...
...
@@ -142,6 +155,7 @@ public class BattleUI : MonoBehaviour
m_loseObj
.
SetActive
(
false
);
m_successObj
.
SetActive
(
false
);
m_selectLevelObj
.
SetActive
(
true
);
}
//开始游戏
void
StartBtn
()
...
...
@@ -265,6 +279,7 @@ public class BattleUI : MonoBehaviour
{
m_selectLevelObj
.
SetActive
(
false
);
m_successObj
.
SetActive
(
false
);
m_startLogoObj
.
SetActive
(
true
);
}
/// 加载关卡后调用
...
...
StockRunning/Assets/My/Scripts/EndPoint.cs
0 → 100644
View file @
28ace866
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
EndPoint
:
MonoBehaviour
{
// Start is called before the first frame update
void
Start
()
{
}
// Update is called once per frame
void
Update
()
{
}
private
void
OnTriggerEnter
(
Collider
other
)
{
if
(
other
.
tag
==
"Player"
)
{
//游戏胜利
BattleCtrl
.
instance
.
OnBattleWin
();
}
else
if
(
other
.
tag
==
"Competitor"
)
{
//游戏失败
BattleCtrl
.
instance
.
OnBattleFail
();
}
}
}
StockRunning/Assets/My/Scripts/EndPoint.cs.meta
0 → 100644
View file @
28ace866
fileFormatVersion: 2
guid: d6bfb8894332cf945a8ef8d81e3e0b35
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
StockRunning/Assets/My/Scripts/Player/PlayerMove.cs
View file @
28ace866
...
...
@@ -184,8 +184,8 @@ public class PlayerMove : MonoBehaviour
private
void
FixedUpdate
()
{
//
print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//
print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
print
(
"游戏是否开始:"
+
BattleCtrl
.
instance
.
isStartBattle
);
print
(
"游戏是否结束:"
+
BattleCtrl
.
instance
.
isEndBattle
);
//从配置文件ConfigurationFile中获取数据
VSpeed
=
ConfigurationFile
.
instance
.
VSpeed
;
...
...
StockRunning/Assets/Prefabs/Level2My.prefab
View file @
28ace866
...
...
@@ -2276,6 +2276,7 @@ GameObject:
m_Component
:
-
component
:
{
fileID
:
841476288361334016
}
-
component
:
{
fileID
:
7761488040176970909
}
-
component
:
{
fileID
:
378525161605608181
}
m_Layer
:
1
m_Name
:
"
\u7EC8\u70B9
"
m_TagString
:
Untagged
...
...
@@ -2314,6 +2315,18 @@ BoxCollider:
serializedVersion
:
2
m_Size
:
{
x
:
9.643402
,
y
:
9.290367
,
z
:
1
}
m_Center
:
{
x
:
-0.007873535
,
y
:
4.1451836
,
z
:
0
}
---
!u!114
&378525161605608181
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
4133318964413300092
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
d6bfb8894332cf945a8ef8d81e3e0b35
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!1
&4610562344204679920
GameObject
:
m_ObjectHideFlags
:
0
...
...
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