Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BattleMuscle
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
BattleMuscle
Commits
062757c0
Commit
062757c0
authored
May 13, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加得分
parent
ac35d6d6
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16288 additions
and
930 deletions
+16288
-930
BattleUI.cs
BattleMuscle/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
+28
-1
Level 1.unity
BattleMuscle/Assets/Levels/Level 1.unity
+16219
-918
AIMove.cs
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
+7
-0
BossMove.cs
BattleMuscle/Assets/My/Scripts/AI/BossMove.cs
+13
-7
AttackTrigger.cs
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
+11
-1
PlayerMove.cs
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
+10
-3
No files found.
BattleMuscle/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
View file @
062757c0
...
...
@@ -51,6 +51,12 @@ public class BattleUI : MonoBehaviour
public
GameObject
Text100C
;
public
Text
PurseText
;
[
Header
(
"得分2"
)]
public
Text
PlayerText
;
public
Text
Competitor1Text
;
public
Text
Competitor2Text
;
public
Action
onStartBtn
;
public
Action
onPosUpBtn
;
public
Action
onPosDownBtn
;
...
...
@@ -59,6 +65,8 @@ public class BattleUI : MonoBehaviour
public
Action
onClawMoveSpeedAddBtn
;
public
Action
onClawMoveSpeedDownBtn
;
//private Text m_ShowOrHideMouseText;//显示或隐藏手指text
...
...
@@ -183,7 +191,7 @@ public class BattleUI : MonoBehaviour
//开始游戏
void
StartBtn
()
{
//
print("点击开始按钮");
print
(
"点击开始按钮"
);
onStartBtn
?.
Invoke
();
//m_startBtn.gameObject.SetActive(false);
m_startLogoObj
.
SetActive
(
false
);
...
...
@@ -360,6 +368,7 @@ public class BattleUI : MonoBehaviour
//设置战斗UI状态
public
void
SetBattleObjState
(
bool
bool_
)
{
print
(
"显示m_battleObj:"
+
bool_
);
m_battleObj
.
SetActive
(
bool_
);
//m_successResultObj.SetActive(bool_);
//m_successResultMaskObj.SetActive(!bool_);
...
...
@@ -491,6 +500,24 @@ public class BattleUI : MonoBehaviour
}
}
public
void
UpdateScore2
(
string
name
,
string
text
)
{
print
(
"name:"
+
name
+
",text"
+
text
);
switch
(
name
)
{
case
"Player"
:
PlayerText
.
text
=
text
;
break
;
case
"Competitor1"
:
Competitor1Text
.
text
=
text
;
break
;
case
"Competitor2"
:
Competitor2Text
.
text
=
text
;
break
;
default
:
break
;
}
}
void
OnDestroy
()
{
...
...
BattleMuscle/Assets/Levels/Level 1.unity
View file @
062757c0
This diff is collapsed.
Click to expand it.
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
View file @
062757c0
...
...
@@ -51,6 +51,7 @@ public class AIMove : MonoBehaviour
public
AIState
aiState
;
private
float
vertigoTime
=
0.0f
;
private
AnimationManager
animationManager
;
public
int
Score
=
0
;
// Start is called before the first frame update
void
Start
()
...
...
@@ -76,6 +77,7 @@ public class AIMove : MonoBehaviour
//Destroy(other.gameObject);
//print("吃到食物。");
UpdateScore
(
1
);
HaveFoodNumber
++;
if
(
RandomFoodNumberToPush
<=
HaveFoodNumber
&&
targetWall
!=
null
)
{
...
...
@@ -102,6 +104,11 @@ public class AIMove : MonoBehaviour
Destroy
(
other
.
gameObject
);
}
}
public
void
UpdateScore
(
int
addNumber
)
{
Score
+=
addNumber
;
BattleUI
.
instance
.
UpdateScore2
(
gameObject
.
name
,
gameObject
.
name
+
":"
+
Score
);
}
private
void
Scale
(
float
x
,
float
y
,
float
z
)
{
...
...
BattleMuscle/Assets/My/Scripts/AI/BossMove.cs
View file @
062757c0
...
...
@@ -34,6 +34,7 @@ public class BossMove : MonoBehaviour
public
float
Timer1
=
5
;
public
bool
isDeltaTime
=
false
;
private
bool
isAttacking
=
false
;
public
enum
BossState
{
...
...
@@ -43,6 +44,8 @@ public class BossMove : MonoBehaviour
}
public
BossState
bossState
=
BossState
.
Sleep
;
void
Start
()
{
...
...
@@ -162,7 +165,7 @@ public class BossMove : MonoBehaviour
if
(
Vector3
.
Distance
(
pos1
,
pos2
)
<
10f
)
{
isAttacking
=
true
;
//print("boss附近敌人个数:"+ EnemyNumber+"技能是否不能使用:"+ isDeltaTime);
if
(
EnemyNumber
>=
2
&&
!
isDeltaTime
)
{
...
...
@@ -176,6 +179,7 @@ public class BossMove : MonoBehaviour
else
{
//print("2222222222222");
isAttacking
=
true
;
animator
.
SetBool
(
"HurricaneKick"
,
false
);
animator
.
SetBool
(
"LegSweep"
,
true
);
bossAttack
.
attackType
=
AttackType
.
LegSweep
;
...
...
@@ -214,17 +218,19 @@ public class BossMove : MonoBehaviour
if
(
isAttacking
)
{
xDelta
=
0
;
zDelta
=
0
;
//yDelta = 0;
}
//print("isAttacking:" + isAttacking+"Boss开始移动:" + new Vector3(xDelta, yDelta, zDelta));
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
else
{
//print("isAttacking:" + isAttacking+"Boss开始移动:" + new Vector3(xDelta, yDelta, zDelta));
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
}
//移动
MoveSpeed
=
Vector3
.
Distance
(
Vector3
.
zero
,
characterController
.
velocity
)
;
MoveSpeed
=
new
Vector3
(
xDelta
,
0
,
zDelta
).
magnitude
;
//是否在地面
Grounded
=
characterController
.
isGrounded
;
animator
.
SetFloat
(
"MoveSpeed"
,
MoveSpeed
);
...
...
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
View file @
062757c0
...
...
@@ -4,6 +4,7 @@ using UnityEngine;
public
class
AttackTrigger
:
MonoBehaviour
{
public
GameObject
Root
;
public
Animator
animator
;
public
List
<
string
>
OtherTagList
=
new
List
<
string
>
{
"Competitor"
,
"Boss"
};
public
GameObject
targetWall
;
...
...
@@ -51,7 +52,7 @@ public class AttackTrigger : MonoBehaviour
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
Handheld
.
Vibrate
();
//手机震动
}
else
if
(
other
.
tag
==
"Competitor"
)
{
...
...
@@ -59,6 +60,7 @@ public class AttackTrigger : MonoBehaviour
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
Handheld
.
Vibrate
();
//手机震动
}
else
if
(
other
.
tag
==
"Boss"
)
{
...
...
@@ -66,6 +68,14 @@ public class AttackTrigger : MonoBehaviour
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
Handheld
.
Vibrate
();
//手机震动
if
(
Root
.
name
==
"Player"
)
{
Root
.
GetComponentInChildren
<
PlayerMove
>().
UpdateScore
(
2
);
}
else
if
(
Root
.
name
==
"Competitor"
)
{
Root
.
GetComponentInChildren
<
AIMove
>().
UpdateScore
(
2
);
}
}
}
}
...
...
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
View file @
062757c0
...
...
@@ -49,7 +49,8 @@ public class PlayerMove : MonoBehaviour
private
AnimationManager
animationManager
;
public
RiseBridge
riseBridge
;
public
int
Score
=
0
;
...
...
@@ -73,6 +74,7 @@ public class PlayerMove : MonoBehaviour
if
(
other
.
tag
==
"Food"
)
{
//print("吃到食物。");
UpdateScore
(
1
);
if
(
scale
>=
(
1
+
MaxFood
*
addScale
))
{
scale
=
1
+
MaxFood
*
addScale
;
...
...
@@ -90,17 +92,22 @@ public class PlayerMove : MonoBehaviour
//print("1111" + other.gameObject.tag + "+" + other.gameObject.name);
}
public
void
UpdateScore
(
int
addNumber
)
{
Score
+=
addNumber
;
BattleUI
.
instance
.
UpdateScore2
(
gameObject
.
name
,
gameObject
.
name
+
":"
+
Score
);
}
private
void
OnControllerColliderHit
(
ControllerColliderHit
hit
)
{
if
(
hit
.
gameObject
==
targetWall
)
{
//print("碰到墙"
);
print
(
"Player碰到墙:"
+
scale
);
if
(
scale
>
1
)
{
print
(
"推墙"
);
hit
.
gameObject
.
GetComponent
<
Rigidbody
>().
AddForce
(
new
Vector3
(
0
,
0
,
100
));
scale
-=
reduceStep
;
ReduceIsPlayChangeModeEffect
();
...
...
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