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
79d1e2eb
Commit
79d1e2eb
authored
May 12, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升5级加特效
parent
cd947850
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
135 additions
and
137 deletions
+135
-137
BattleUI.cs
BattleMuscle/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
+11
-1
FollowTarget.cs
BattleMuscle/Assets/#A2_Scripts/Camera/FollowTarget.cs
+4
-4
Level 1.unity
BattleMuscle/Assets/Levels/Level 1.unity
+15
-70
AIMove.cs
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
+52
-7
ConfigurationFile.cs
BattleMuscle/Assets/My/Scripts/ConfigurationFile.cs
+8
-47
RandomFood.cs
BattleMuscle/Assets/My/Scripts/Food/RandomFood.cs
+3
-3
AttackTrigger.cs
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
+1
-1
PlayerMove.cs
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
+40
-3
Prop.cs
BattleMuscle/Assets/My/Scripts/Prop/Prop.cs
+1
-1
No files found.
BattleMuscle/Assets/#A2_Scripts/Battle/UI/BattleUI.cs
View file @
79d1e2eb
...
...
@@ -124,6 +124,8 @@ public class BattleUI : MonoBehaviour
// 当前关卡再来一次
void
LoadCurLevel
()
{
LoadSceneLevel1
();
//UI的显示和隐藏
m_loseObj
.
SetActive
(
false
);
m_battleObj
.
SetActive
(
false
);
...
...
@@ -139,6 +141,8 @@ public class BattleUI : MonoBehaviour
//再来一次
void
TryAgainLevel
()
{
LoadSceneLevel1
();
//UI的显示和隐藏
m_loseObj
.
SetActive
(
false
);
m_battleObj
.
SetActive
(
false
);
...
...
@@ -177,7 +181,7 @@ public class BattleUI : MonoBehaviour
//开始游戏
void
StartBtn
()
{
print
(
"点击开始按钮"
);
//
print("点击开始按钮");
onStartBtn
?.
Invoke
();
//m_startBtn.gameObject.SetActive(false);
m_startLogoObj
.
SetActive
(
false
);
...
...
@@ -286,6 +290,10 @@ public class BattleUI : MonoBehaviour
//}
//----------------
}
public
void
LoadSceneLevel1
()
{
SceneManager
.
LoadScene
(
"Level 1"
);
}
//失败
public
void
OnBattleFail
()
{
...
...
@@ -309,6 +317,8 @@ public class BattleUI : MonoBehaviour
/// 加载关卡前调用,隐藏不需要显示的ui
public
void
OnBeforeLoadLevel
()
{
m_selectLevelObj
.
SetActive
(
false
);
m_successObj
.
SetActive
(
false
);
m_startLogoObj
.
SetActive
(
true
);
...
...
BattleMuscle/Assets/#A2_Scripts/Camera/FollowTarget.cs
View file @
79d1e2eb
...
...
@@ -52,13 +52,13 @@ public class FollowTarget : MonoBehaviour
}
private
void
LateUpdate
()
{
rotationVector3
=
ConfigurationFile
.
instance
.
rotationVector3MainCamera
;
//
rotationVector3 = ConfigurationFile.instance.rotationVector3MainCamera;
//读取配置文件数据
backDis
=
ConfigurationFile
.
instance
.
backDis
;
upDis
=
ConfigurationFile
.
instance
.
upDis
;
//
//
读取配置文件数据
//
backDis = ConfigurationFile.instance.backDis;
//
upDis = ConfigurationFile.instance.upDis;
Vector3
followPoint
=
target
.
position
+
Vector3
.
up
*
upDis
-
target
.
forward
*
backDis
;
transform
.
position
=
followPoint
;
...
...
BattleMuscle/Assets/Levels/Level 1.unity
View file @
79d1e2eb
...
...
@@ -317,7 +317,7 @@ MonoBehaviour:
OtherTag
:
Competitor
targetWall
:
{
fileID
:
866649273
}
isCauseDamage
:
0
hitEffects
:
{
fileID
:
198
90288
,
guid
:
775fb3e8f5df827428272416a14d9adf
,
type
:
3
}
hitEffects
:
{
fileID
:
198
09874
,
guid
:
acee4f4e191fea8479aad0b4b8e1dc18
,
type
:
3
}
hitPos
:
{
fileID
:
0
}
---
!u!4
&30458481
stripped
Transform
:
...
...
@@ -452,7 +452,7 @@ PrefabInstance:
-
target
:
{
fileID
:
6395712302446265060
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
propertyPath
:
m_Name
value
:
Ground
(1) Variant (1)
value
:
Ground
3
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
...
...
@@ -492,7 +492,7 @@ PrefabInstance:
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
propertyPath
:
m_RootOrder
value
:
1
value
:
2
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
...
...
@@ -643,7 +643,7 @@ MonoBehaviour:
OtherTag
:
Player
targetWall
:
{
fileID
:
916250627
}
isCauseDamage
:
0
hitEffects
:
{
fileID
:
198
90288
,
guid
:
775fb3e8f5df827428272416a14d9adf
,
type
:
3
}
hitEffects
:
{
fileID
:
198
09874
,
guid
:
acee4f4e191fea8479aad0b4b8e1dc18
,
type
:
3
}
hitPos
:
{
fileID
:
0
}
---
!u!65
&186710582
BoxCollider
:
...
...
@@ -976,8 +976,8 @@ Transform:
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
-
{
fileID
:
6348171781088263582
}
-
{
fileID
:
142519837
}
-
{
fileID
:
1628104038
}
-
{
fileID
:
142519837
}
-
{
fileID
:
2825985020354422453
}
-
{
fileID
:
1432591457
}
-
{
fileID
:
491938003
}
...
...
@@ -1815,6 +1815,8 @@ MonoBehaviour:
targetWall
:
{
fileID
:
916250627
}
pathPos0
:
{
fileID
:
1527153765
}
vertigoEffect
:
{
fileID
:
1026936735
}
CurrentFood
:
0
changeModeEffect
:
{
fileID
:
19844352
,
guid
:
632339e29e2ddd64aab6f9dd68facc82
,
type
:
3
}
MaxFood
:
20
addScale
:
0.1
reduceStep
:
0.023
...
...
@@ -2386,9 +2388,11 @@ MonoBehaviour:
MaxFood
:
20
scale
:
1
addScale
:
0.1
CurrentFood
:
0
targetWall
:
{
fileID
:
866649273
}
children
:
{
fileID
:
287314579
}
vertigoEffect
:
{
fileID
:
1768433288
}
changeModeEffect
:
{
fileID
:
19844352
,
guid
:
632339e29e2ddd64aab6f9dd68facc82
,
type
:
3
}
MoveSpeed
:
0
vertigoTime
:
0
---
!u!4
&883198006
...
...
@@ -2638,24 +2642,6 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
36730f682241d5c45a06bc01fc344b12
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
VSpeed
:
10
SpeedLevel
:
1
AddSpeed
:
2.5
HSpeed
:
8.5
VSpeedAI
:
9
SpeedLevelAI
:
1
AddSpeedAI
:
2.5
HSpeedAI
:
10
backDis
:
7.02
upDis
:
5.61
rotationVector3MainCamera
:
{
x
:
20
,
y
:
0
,
z
:
0
}
VSpeedEnemy_V
:
10
SpeedLevelEnemy_V
:
1
AddSpeedEnemy_V
:
10
VertigoTimeEnemy_V
:
1
disZ
:
50
VertigoTimeGianRock
:
1
deceleration
:
11.95
---
!u!4
&976976312
Transform
:
m_ObjectHideFlags
:
0
...
...
@@ -3603,49 +3589,6 @@ Transform:
type
:
3
}
m_PrefabInstance
:
{
fileID
:
6348171781088263581
}
m_PrefabAsset
:
{
fileID
:
0
}
---
!u!1
&1230511771
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1230511773
}
-
component
:
{
fileID
:
1230511772
}
m_Layer
:
0
m_Name
:
TestLog
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1230511772
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1230511771
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
c5a1d3dac03807b44bdcaf59e7ba4fd6
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!4
&1230511773
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1230511771
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
8
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&1241863952
stripped
Transform
:
m_CorrespondingSourceObject
:
{
fileID
:
5957448837681223802
,
guid
:
15d49ef1e12d35a46b7c6fb953021b43
,
...
...
@@ -4003,6 +3946,8 @@ MonoBehaviour:
targetWall
:
{
fileID
:
952561886
}
pathPos0
:
{
fileID
:
497489066
}
vertigoEffect
:
{
fileID
:
20721754
}
CurrentFood
:
0
changeModeEffect
:
{
fileID
:
19844352
,
guid
:
632339e29e2ddd64aab6f9dd68facc82
,
type
:
3
}
MaxFood
:
20
addScale
:
0.1
reduceStep
:
0.023
...
...
@@ -4211,7 +4156,7 @@ MonoBehaviour:
OtherTag
:
Player
targetWall
:
{
fileID
:
952561886
}
isCauseDamage
:
0
hitEffects
:
{
fileID
:
198
90288
,
guid
:
775fb3e8f5df827428272416a14d9adf
,
type
:
3
}
hitEffects
:
{
fileID
:
198
09874
,
guid
:
acee4f4e191fea8479aad0b4b8e1dc18
,
type
:
3
}
hitPos
:
{
fileID
:
0
}
---
!u!65
&1414299318
BoxCollider
:
...
...
@@ -4856,7 +4801,7 @@ PrefabInstance:
-
target
:
{
fileID
:
6395712302446265060
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
propertyPath
:
m_Name
value
:
Ground
(1) Variant
value
:
Ground
2
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
...
...
@@ -4896,7 +4841,7 @@ PrefabInstance:
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
propertyPath
:
m_RootOrder
value
:
2
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6395712302446265064
,
guid
:
6ca4da84c86dcae4886a685a36ece9c4
,
type
:
3
}
...
...
@@ -6464,7 +6409,7 @@ PrefabInstance:
-
target
:
{
fileID
:
6348171781874739080
,
guid
:
15d49ef1e12d35a46b7c6fb953021b43
,
type
:
3
}
propertyPath
:
m_Name
value
:
Ground
value
:
Ground
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6348171781874739082
,
guid
:
15d49ef1e12d35a46b7c6fb953021b43
,
type
:
3
}
...
...
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
View file @
79d1e2eb
...
...
@@ -13,6 +13,10 @@ public class AIMove : MonoBehaviour
public
GameObject
pathPos0
;
//眩晕特效
public
ParticleSystem
vertigoEffect
;
public
int
CurrentFood
=
0
;
public
ParticleSystem
changeModeEffect
;
[
Header
(
"大小"
)]
public
int
MaxFood
=
20
;
private
float
scale
=
1
;
...
...
@@ -81,9 +85,11 @@ public class AIMove : MonoBehaviour
else
{
scale
+=
addScale
;
//进行食物累计和缩放模型。
AddIsPlayChangeModeEffect
();
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
//
Scale(scale, scale, scale);
Destroy
(
other
.
gameObject
);
}
}
...
...
@@ -100,7 +106,8 @@ public class AIMove : MonoBehaviour
if
(
scale
>
1
)
{
hit
.
gameObject
.
GetComponent
<
Rigidbody
>().
AddForce
(
new
Vector3
(
0
,
0
,
100
));
scale
-=
0.023f
;
scale
-=
reduceStep
;
ReduceIsPlayChangeModeEffect
();
}
else
{
...
...
@@ -112,7 +119,7 @@ public class AIMove : MonoBehaviour
aiState
=
AIState
.
TurnBackToPathPos0
;
//到路径起点,准备去找食物
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
//
Scale(scale, scale, scale);
}
}
//受到伤害
...
...
@@ -125,8 +132,37 @@ public class AIMove : MonoBehaviour
RefreshVertigo
(
hurt
);
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
ReduceIsPlayChangeModeEffect
();
//Scale(scale, scale, scale);
}
//食物增加时,判断是否播放改变模型特效
public
void
AddIsPlayChangeModeEffect
()
{
CurrentFood
++;
if
(
CurrentFood
==
5
||
CurrentFood
==
10
||
CurrentFood
==
15
||
CurrentFood
==
20
)
{
Scale
(
scale
,
scale
,
scale
);
ParticleSystem
ps
=
Instantiate
(
changeModeEffect
,
transform
.
position
,
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
}
}
/// <summary>
/// 减少时,判断是否播放改变模型特效
/// </summary>
public
void
ReduceIsPlayChangeModeEffect
()
{
int
tempFood
=
CurrentFood
;
CurrentFood
=
(
int
)((
scale
-
1.0f
)
/
addScale
);
if
(
tempFood
!=
CurrentFood
&&
(
CurrentFood
==
0
||
CurrentFood
==
5
||
CurrentFood
==
10
||
CurrentFood
==
15
||
CurrentFood
==
20
))
{
Scale
(
scale
,
scale
,
scale
);
ParticleSystem
ps
=
Instantiate
(
changeModeEffect
,
transform
.
position
,
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
}
}
//scale
public
void
ChangeAnimationscaleState
(
float
scale
)
{
...
...
@@ -163,6 +199,7 @@ public class AIMove : MonoBehaviour
SpeedY
+=
-
9.8f
*
5
*
Time
.
deltaTime
;
}
//print("aiState1:" + aiState + "-targetObj:" + targetObj);
//------------------------AI的寻路点切换---------------------------------------------------------------
switch
(
aiState
)
{
...
...
@@ -214,10 +251,15 @@ public class AIMove : MonoBehaviour
}
//-------------------------------------------------------------------------------------
print
(
"aiState:"
+
aiState
+
"-targetObj:"
+
targetObj
+
" 距离:"
+
Vector3
.
Distance
(
transform
.
position
,
pathPos0
.
transform
.
position
)
);
//print("aiState2:" + aiState+ "-targetObj:" + targetObj
);
yDelta
=
SpeedY
*
Time
.
deltaTime
;
Vector3
speed
=(
targetObj
.
transform
.
position
-
transform
.
position
).
normalized
*
VSpeed
;
Vector3
speed
=
Vector3
.
zero
;
if
(
targetObj
!=
null
)
//targetObj==null 可能是没有食物。
{
speed
=
(
targetObj
.
transform
.
position
-
transform
.
position
).
normalized
*
VSpeed
;
}
xDelta
=
speed
.
x
*
Time
.
deltaTime
;
zDelta
=
speed
.
z
*
Time
.
deltaTime
;
if
(
vertigoTime
>
0
)
...
...
@@ -379,7 +421,10 @@ public class AIMove : MonoBehaviour
public
GameObject
GetTargetPos
()
{
GameObject
[]
foods
=
GameObject
.
FindGameObjectsWithTag
(
"Food"
);
//食物
if
(
foods
.
Length
==
0
)
{
return
null
;
}
if
(
foods
.
Length
==
0
)
{
//print("没有食物");
return
null
;
}
//排序,距离从小到大。
foods
=
DoRankingFun
(
foods
,
transform
.
position
);
return
foods
[
0
];
...
...
BattleMuscle/Assets/My/Scripts/ConfigurationFile.cs
View file @
79d1e2eb
...
...
@@ -5,53 +5,14 @@ using UnityEngine;
public
class
ConfigurationFile
:
MonoBehaviour
{
[
Header
(
"主角"
)]
[
Tooltip
(
"控制向前的速度。"
)]
public
float
VSpeed
=
20.0f
;
public
int
SpeedLevel
=
1
;
[
Tooltip
(
"没升一级增加的速度"
)]
public
float
AddSpeed
=
10.0f
;
[
Tooltip
(
"控制左右移动的速度。"
)]
public
float
HSpeed
=
10.0f
;
//########################################
[
Header
(
"AI"
)]
[
Tooltip
(
"控制向前的速度。"
)]
public
float
VSpeedAI
=
20.0f
;
public
int
SpeedLevelAI
=
1
;
[
Tooltip
(
"没升一级增加的速度"
)]
public
float
AddSpeedAI
=
10.0f
;
[
Tooltip
(
"控制左右移动的速度。"
)]
public
float
HSpeedAI
=
10.0f
;
//########################################
[
Header
(
"摄像机"
)]
[
Tooltip
(
"相对主角 向后的距离"
)]
public
float
backDis
=
5.51f
;
[
Tooltip
(
"相对主角 向上的距离"
)]
public
float
upDis
=
8.77f
;
[
Tooltip
(
"控制摄像机的旋转角度"
)]
public
Vector3
rotationVector3MainCamera
;
//########################################
[
Header
(
"打手"
)]
[
Tooltip
(
"基础速度"
)]
public
float
VSpeedEnemy_V
=
20.0f
;
[
Tooltip
(
"速度等级"
)]
public
int
SpeedLevelEnemy_V
=
1
;
[
Tooltip
(
"每升一级增加的速度"
)]
public
float
AddSpeedEnemy_V
=
10.0f
;
[
Tooltip
(
"每个小人眩晕时长"
)]
public
float
VertigoTimeEnemy_V
=
3.0f
;
[
Tooltip
(
"小人出现的位置在目标的前方的距离"
)]
public
float
disZ
=
50
;
//########################################
[
Header
(
"巨石"
)]
[
Tooltip
(
"眩晕时长"
)]
public
float
VertigoTimeGianRock
=
3
;
//########################################
[
Header
(
"游戏结束"
)]
[
Tooltip
(
"每秒减少的速度"
)]
public
float
deceleration
=
11.8f
;
//[Header("主角")]
////########################################
//[Header("AI")]
////########################################
//[Header("摄像机")]
public
static
ConfigurationFile
instance
;
private
void
Awake
()
{
...
...
BattleMuscle/Assets/My/Scripts/Food/RandomFood.cs
View file @
79d1e2eb
...
...
@@ -35,12 +35,12 @@ public class RandomFood : MonoBehaviour
//补全20个食物
complementFood
();
}
gameObject
.
GetComponentsInChildren
<
Food
>();
GameObject
[]
currFoods
=
GameObject
.
FindGameObjectsWithTag
(
"Food"
);
if
(
currFoods
.
Length
==
0
)
{
//
timer = 0;
//
GenerateRandomFood(foodNumber);
timer
=
0
;
GenerateRandomFood
(
foodNumber
);
}
}
...
...
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
View file @
79d1e2eb
...
...
@@ -21,7 +21,7 @@ public class AttackTrigger : MonoBehaviour
// Update is called once per frame
void
Update
()
{
isCauseDamage
=
false
;
//由帧事件改变该值
isCauseDamage
=
false
;
//由
动画
帧事件改变该值
}
private
void
OnTriggerEnter
(
Collider
other
)
{
...
...
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
View file @
79d1e2eb
...
...
@@ -18,11 +18,15 @@ public class PlayerMove : MonoBehaviour
public
float
scale
=
1
;
public
float
addScale
=
0.1f
;
//0.1f
private
float
reduceStep
=
0.023f
;
//0.023f reduceStep = 0.023f / 0.1f * addScale;
public
int
CurrentFood
=
0
;
[
Header
(
"目标墙"
)]
public
GameObject
targetWall
;
public
GameObject
children
;
[
Header
(
"眩晕特效"
)]
public
ParticleSystem
vertigoEffect
;
[
Header
(
"变身特效"
)]
public
ParticleSystem
changeModeEffect
;
private
float
timer
=
0.0f
;
//输入控制player移动的中间变量
...
...
@@ -67,18 +71,23 @@ public class PlayerMove : MonoBehaviour
if
(
scale
>=
(
1
+
MaxFood
*
addScale
))
{
scale
=
1
+
MaxFood
*
addScale
;
CurrentFood
=
MaxFood
;
}
else
{
scale
+=
addScale
;
//进行食物累计和缩放模型。
AddIsPlayChangeModeEffect
();
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
Destroy
(
other
.
gameObject
);
}
//print("1111" + other.gameObject.tag + "+" + other.gameObject.name);
}
private
void
OnControllerColliderHit
(
ControllerColliderHit
hit
)
{
if
(
hit
.
gameObject
==
targetWall
)
...
...
@@ -88,6 +97,7 @@ public class PlayerMove : MonoBehaviour
{
hit
.
gameObject
.
GetComponent
<
Rigidbody
>().
AddForce
(
new
Vector3
(
0
,
0
,
100
));
scale
-=
reduceStep
;
ReduceIsPlayChangeModeEffect
();
}
else
{
...
...
@@ -95,13 +105,13 @@ public class PlayerMove : MonoBehaviour
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
}
//print("22222"+hit.gameObject.tag+"+"+hit.gameObject.name);
}
//受到伤害
public
void
Hurt
(
float
hurt
)
{
//进行判断是否播放特效
scale
-=
hurt
;
if
(
scale
<
1
)
{
...
...
@@ -109,7 +119,32 @@ public class PlayerMove : MonoBehaviour
RefreshVertigo
(
hurt
);
}
ChangeAnimationscaleState
(
scale
);
Scale
(
scale
,
scale
,
scale
);
ReduceIsPlayChangeModeEffect
();
}
//食物增加时,判断是否播放改变模型特效
public
void
AddIsPlayChangeModeEffect
()
{
CurrentFood
++;
if
(
CurrentFood
==
5
||
CurrentFood
==
10
||
CurrentFood
==
15
||
CurrentFood
==
20
)
{
Scale
(
scale
,
scale
,
scale
);
ParticleSystem
ps
=
Instantiate
(
changeModeEffect
,
transform
.
position
,
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
}
}
/// <summary>
/// 减少时,判断是否播放改变模型特效
/// </summary>
public
void
ReduceIsPlayChangeModeEffect
()
{
int
tempFood
=
CurrentFood
;
CurrentFood
=
(
int
)((
scale
-
1.0f
)
/
addScale
);
if
(
tempFood
!=
CurrentFood
&&
(
CurrentFood
==
0
||
CurrentFood
==
5
||
CurrentFood
==
10
||
CurrentFood
==
15
||
CurrentFood
==
20
))
{
Scale
(
scale
,
scale
,
scale
);
ParticleSystem
ps
=
Instantiate
(
changeModeEffect
,
transform
.
position
,
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
}
}
//scale
...
...
@@ -134,6 +169,8 @@ public class PlayerMove : MonoBehaviour
{
transform
.
localScale
=
new
Vector3
(
x
,
y
,
x
);
}
void
RotateInvoke
()
{
...
...
BattleMuscle/Assets/My/Scripts/Prop/Prop.cs
View file @
79d1e2eb
...
...
@@ -47,7 +47,7 @@ public class Prop : MonoBehaviour
private
void
OnTriggerEnter
(
Collider
other
)
{
disZ
=
ConfigurationFile
.
instance
.
disZ
;
//
disZ = ConfigurationFile.instance.disZ;
if
((
other
.
tag
==
"Competitor"
||
other
.
tag
==
"Player"
)
&&
DoRanking
.
_instance
.
rankingList
[
2
]
!=
other
.
gameObject
)
{
switch
(
propType
)
...
...
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