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
baadb64f
Commit
baadb64f
authored
May 19, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物理模拟击退效果,
parent
362a1dd4
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
439 additions
and
34 deletions
+439
-34
Hurricane Kick.anim
...s/Art_Assets/Animation/Animation/Boss/Hurricane Kick.anim
+7
-0
HurricaneKickBefor.anim
...t_Assets/Animation/Animation/Boss/HurricaneKickBefor.anim
+11
-4
HurricaneKickBefor.anim.meta
...ets/Animation/Animation/Boss/HurricaneKickBefor.anim.meta
+1
-1
Leg Sweep.anim
...Assets/Art_Assets/Animation/Animation/Boss/Leg Sweep.anim
+8
-1
RunningBoss2.anim
...ets/Art_Assets/Animation/Animation/Boss/RunningBoss2.anim
+1
-1
RunningBoss2.anim.meta
...rt_Assets/Animation/Animation/Boss/RunningBoss2.anim.meta
+0
-0
Running2.controller
..._Assets/Animation/AnimationController/Running2.controller
+5
-5
Level 1.unity
BattleMuscle/Assets/Levels/Level 1.unity
+294
-6
HurricaneKickTrigger.prefab
BattleMuscle/Assets/My/Model/HurricaneKickTrigger.prefab
+1
-1
LegSweepTrigger.prefab
BattleMuscle/Assets/My/Model/LegSweepTrigger.prefab
+1
-1
AIMove.cs
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
+36
-0
BossAttack.cs
BattleMuscle/Assets/My/Scripts/AI/BossAttack.cs
+1
-0
BossMove.cs
BattleMuscle/Assets/My/Scripts/AI/BossMove.cs
+3
-3
AttackTrigger.cs
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
+7
-4
PlayerMove.cs
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
+63
-7
No files found.
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Hurricane Kick.anim
View file @
baadb64f
...
...
@@ -8466,3 +8466,10 @@ AnimationClip:
floatParameter
:
0
intParameter
:
2
messageOptions
:
0
-
time
:
1.8333334
functionName
:
ChangeAttackType
data
:
objectReferenceParameter
:
{
fileID
:
0
}
floatParameter
:
0
intParameter
:
0
messageOptions
:
0
BattleMuscle/Assets/
My
/HurricaneKickBefor.anim
→
BattleMuscle/Assets/
Art_Assets/Animation/Animation/Boss
/HurricaneKickBefor.anim
View file @
baadb64f
...
...
@@ -31,12 +31,12 @@ AnimationClip:
m_AdditiveReferencePoseClip
:
{
fileID
:
0
}
m_AdditiveReferencePoseTime
:
0
m_StartTime
:
0
m_StopTime
:
0.98333335
m_StopTime
:
1
m_OrientationOffsetY
:
0
m_Level
:
0
m_CycleOffset
:
0
m_HasAdditiveReferencePose
:
0
m_LoopTime
:
1
m_LoopTime
:
0
m_LoopBlend
:
0
m_LoopBlendOrientation
:
0
m_LoopBlendPositionY
:
0
...
...
@@ -51,8 +51,15 @@ AnimationClip:
m_HasGenericRootTransform
:
0
m_HasMotionFloatCurves
:
0
m_Events
:
-
time
:
0.98333335
functionName
:
HurricaneKickBeforEnd
-
time
:
0
functionName
:
ChangeAttackType
data
:
objectReferenceParameter
:
{
fileID
:
0
}
floatParameter
:
0
intParameter
:
0
messageOptions
:
0
-
time
:
1
functionName
:
ChangeAttackType
data
:
objectReferenceParameter
:
{
fileID
:
0
}
floatParameter
:
0
...
...
BattleMuscle/Assets/
My
/HurricaneKickBefor.anim.meta
→
BattleMuscle/Assets/
Art_Assets/Animation/Animation/Boss
/HurricaneKickBefor.anim.meta
View file @
baadb64f
fileFormatVersion: 2
guid:
d266a3801edfb2d4ebf814eeea93f5d2
guid:
1e8ba1c691d0bb6409b39a59d55e5c4b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
...
...
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Leg Sweep.anim
View file @
baadb64f
...
...
@@ -37079,10 +37079,17 @@ AnimationClip:
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events:
- time: 0
- time: 0
.6
functionName: ChangeAttackType
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 1
messageOptions: 0
- time: 1.4666667
functionName: ChangeAttackType
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Running2.anim
→
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Running
Boss
2.anim
View file @
baadb64f
...
...
@@ -6,7 +6,7 @@ AnimationClip:
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_Name
:
Running2
m_Name
:
Running
Boss
2
serializedVersion
:
6
m_Legacy
:
0
m_Compressed
:
0
...
...
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Running2.anim.meta
→
BattleMuscle/Assets/Art_Assets/Animation/Animation/Boss/Running
Boss
2.anim.meta
View file @
baadb64f
File moved
BattleMuscle/Assets/Art_Assets/Animation/AnimationController/Running2.controller
View file @
baadb64f
...
...
@@ -161,9 +161,9 @@ AnimatorStateTransition:
m_Mute
:
0
m_IsExit
:
0
serializedVersion
:
3
m_TransitionDuration
:
0.
25
m_TransitionDuration
:
0.
048737466
m_TransitionOffset
:
0
m_ExitTime
:
0.
75
m_ExitTime
:
0.
9825936
m_HasExitTime
:
1
m_HasFixedDuration
:
1
m_InterruptionSource
:
0
...
...
@@ -313,9 +313,9 @@ AnimatorStateTransition:
m_Mute
:
0
m_IsExit
:
0
serializedVersion
:
3
m_TransitionDuration
:
0.
25
m_TransitionDuration
:
0.
06047981
m_TransitionOffset
:
0
m_ExitTime
:
0.
75
m_ExitTime
:
0.
011724846
m_HasExitTime
:
1
m_HasFixedDuration
:
1
m_InterruptionSource
:
0
...
...
@@ -419,7 +419,7 @@ AnimatorState:
m_MirrorParameterActive
:
0
m_CycleOffsetParameterActive
:
0
m_TimeParameterActive
:
0
m_Motion
:
{
fileID
:
7400000
,
guid
:
d266a3801edfb2d4ebf814eeea93f5d2
,
type
:
2
}
m_Motion
:
{
fileID
:
7400000
,
guid
:
1e8ba1c691d0bb6409b39a59d55e5c4b
,
type
:
2
}
m_Tag
:
m_SpeedParameter
:
MoveSpeed
m_MirrorParameter
:
...
...
BattleMuscle/Assets/Levels/Level 1.unity
View file @
baadb64f
This diff is collapsed.
Click to expand it.
BattleMuscle/Assets/My/Model/HurricaneKickTrigger.prefab
View file @
baadb64f
...
...
@@ -50,7 +50,7 @@ MeshRenderer:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7483224581113721909
}
m_Enabled
:
1
m_Enabled
:
0
m_CastShadows
:
1
m_ReceiveShadows
:
1
m_DynamicOccludee
:
1
...
...
BattleMuscle/Assets/My/Model/LegSweepTrigger.prefab
View file @
baadb64f
...
...
@@ -50,7 +50,7 @@ MeshRenderer:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6039842180593449807
}
m_Enabled
:
1
m_Enabled
:
0
m_CastShadows
:
1
m_ReceiveShadows
:
1
m_DynamicOccludee
:
1
...
...
BattleMuscle/Assets/My/Scripts/AI/AIMove.cs
View file @
baadb64f
...
...
@@ -61,6 +61,8 @@ public class AIMove : MonoBehaviour
public
GameObject
topPOS
;
public
int
Count
=
0
;
public
int
tempFoodNumber
=
0
;
public
Rigidbody
rig
;
private
Vector3
DistanceByForce
=
new
Vector3
(
0
,
0
,
0
);
//在各个方向上的位移(模拟力)
// Start is called before the first frame update
void
Start
()
...
...
@@ -73,6 +75,7 @@ public class AIMove : MonoBehaviour
aiState
=
AIState
.
FindFood
;
animationManager
=
GetComponentInChildren
<
AnimationManager
>();
tempFoodNumber
=
CurrentFood
;
rig
=
GetComponentInChildren
<
Rigidbody
>();
}
...
...
@@ -496,6 +499,22 @@ public class AIMove : MonoBehaviour
//animator.SetBool("Push", false);
//animator.SetBool("Punch", false);
animationManager
.
ChangeAnimatorState
(
AnimationState
.
Vertigo
);
//眩晕状态也会被击退
xDelta
=
0
;
yDelta
=
0
;
zDelta
=
0
;
//------------模拟力-----------------------
Vector3
tempDis
=
DistanceByForce
;
DistanceByForce
=
Vector3
.
Lerp
(
DistanceByForce
,
new
Vector3
(
0
,
0
,
0
),
0.1f
);
tempDis
-=
DistanceByForce
;
//print("DistanceByForce:"+ DistanceByForce+ "tempDis:" + tempDis);
xDelta
+=
tempDis
.
x
;
yDelta
+=
tempDis
.
y
;
zDelta
+=
tempDis
.
z
;
//-----------------------------------------
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
}
else
{
...
...
@@ -570,6 +589,16 @@ public class AIMove : MonoBehaviour
angle
=
-
Mathf
.
Abs
(
angle
);
}
transform
.
localEulerAngles
=
new
Vector3
(
0
,
angle
,
0
);
//------------模拟力-----------------------
Vector3
tempDis
=
DistanceByForce
;
DistanceByForce
=
Vector3
.
Lerp
(
DistanceByForce
,
new
Vector3
(
0
,
0
,
0
),
0.1f
);
tempDis
-=
DistanceByForce
;
//print("DistanceByForce:"+ DistanceByForce+ "tempDis:" + tempDis);
xDelta
+=
tempDis
.
x
;
yDelta
+=
tempDis
.
y
;
zDelta
+=
tempDis
.
z
;
//-----------------------------------------
//print(targetObj+"AI开始移动:"+ new Vector3(xDelta, yDelta, zDelta));
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
...
...
@@ -649,6 +678,13 @@ public class AIMove : MonoBehaviour
rig
.
AddForce
(
Quaternion
.
Euler
(
new
Vector3
(-
45
,
randomAngle
+
i
*
360.0f
/
number
,
0
))
*
Vector3
.
forward
*
Force
);
}
}
public
void
GetHitToBack
(
Vector3
OtherPostion
)
{
Vector3
dic
=
(
transform
.
position
-
OtherPostion
).
normalized
*
5
;
dic
.
y
=
0
;
DistanceByForce
=
dic
;
}
private
void
OnDestroy
()
{
...
...
BattleMuscle/Assets/My/Scripts/AI/BossAttack.cs
View file @
baadb64f
...
...
@@ -34,6 +34,7 @@ public class BossAttack : MonoBehaviour
// Update is called once per frame
void
Update
()
{
print
(
attackType
);
switch
(
attackType
)
{
case
AttackType
.
Null
:
...
...
BattleMuscle/Assets/My/Scripts/AI/BossMove.cs
View file @
baadb64f
...
...
@@ -164,7 +164,7 @@ public class BossMove : MonoBehaviour
{
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
print
(
bossState
);
//
print(bossState);
//----技能冷却--------------------------------------------------------------
if
(
isDeltaTime
)
...
...
@@ -256,7 +256,7 @@ public class BossMove : MonoBehaviour
}
else
{
print
(
"LegSweepIsFinsh:"
+
LegSweepIsFinsh
+
"HurricaneKickIsFinsh:"
+
HurricaneKickIsFinsh
+
"dic >= 10:"
+
(
dic
>=
10
)+
"dic:"
+
dic
);
//
print("LegSweepIsFinsh:" + LegSweepIsFinsh+ "HurricaneKickIsFinsh:"+ HurricaneKickIsFinsh+ "dic >= 10:" + (dic >= 10)+ "dic:" + dic);
print
(
"攻击动画未完成,或者目标在攻击范围"
);
}
...
...
@@ -290,7 +290,7 @@ public class BossMove : MonoBehaviour
// isHurricaneKick = false;
//}
bossAnimationManager
.
ChangeAnimatorState
(
BossAnimationState
.
HurricaneKick
);
bossAttack
.
attackType
=
AttackType
.
HurricaneKick
;
//bossAttack.attackType = AttackType.HurricaneKick; //由帧事件开启。
}
else
if
(
dic
<
10
&&
!
isDeltaTime2
)
{
...
...
BattleMuscle/Assets/My/Scripts/Player/AttackTrigger.cs
View file @
baadb64f
...
...
@@ -53,16 +53,19 @@ public class AttackTrigger : MonoBehaviour
//print(other.name+"受到伤害:");
if
(
other
.
tag
==
"Player"
)
{
other
.
gameObject
.
GetComponentInChildren
<
PlayerMove
>().
Hurt
(
5
);
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
other
.
gameObject
.
GetComponentInChildren
<
PlayerMove
>().
Hurt
(
3
);
other
.
gameObject
.
GetComponentInChildren
<
PlayerMove
>().
GetHitToBack
(
Root
.
transform
.
position
);
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
//Handheld.Vibrate();//手机震动
}
else
if
(
other
.
tag
==
"Competitor"
)
{
other
.
gameObject
.
GetComponentInChildren
<
AIMove
>().
Hurt
(
5
);
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
print
(
Root
.
name
+
"攻击了:"
+
other
.
name
);
other
.
gameObject
.
GetComponentInChildren
<
AIMove
>().
Hurt
(
3
);
other
.
gameObject
.
GetComponentInChildren
<
AIMove
>().
GetHitToBack
(
Root
.
transform
.
position
);
ps
=
Instantiate
(
hitEffects
,
hitPos
.
transform
.
position
,
hitPos
.
transform
.
rotation
);
ps
.
gameObject
.
AddComponent
<
DestroyMySel
>();
if
(
Root
.
tag
==
"Player"
)
{
...
...
BattleMuscle/Assets/My/Scripts/Player/PlayerMove.cs
View file @
baadb64f
...
...
@@ -56,7 +56,9 @@ public class PlayerMove : MonoBehaviour
public
int
tempFoodNumber
=
0
;
public
int
Count
=
0
;
public
Rigidbody
rig
;
private
Vector3
DistanceByForce
=
new
Vector3
(
0
,
0
,
0
);
//在各个方向上的位移(模拟力)
// Start is called before the first frame update
void
Start
()
...
...
@@ -70,6 +72,7 @@ public class PlayerMove : MonoBehaviour
characterController
=
GetComponentInChildren
<
CharacterController
>();
animationManager
=
GetComponentInChildren
<
AnimationManager
>();
tempFoodNumber
=
CurrentFood
;
rig
=
GetComponentInChildren
<
Rigidbody
>();
}
private
void
OnTriggerEnter
(
Collider
other
)
...
...
@@ -164,6 +167,9 @@ public class PlayerMove : MonoBehaviour
ChangeAnimationscaleState
(
scale
);
}
}
//受到伤害
public
void
Hurt
(
int
hurt
)
{
...
...
@@ -289,13 +295,29 @@ public class PlayerMove : MonoBehaviour
CancelInvoke
(
"DelayMoveHandle"
);
}
}
private
void
FixedUpdate
()
{
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
//if (Input.GetKeyDown(KeyCode.W))
//{
// DistanceByForce += new Vector3(0,0,5);
//}
//if (Input.GetKeyDown(KeyCode.S))
//{
// DistanceByForce += new Vector3(0, 0, -5);
//}
//if (Input.GetKeyDown(KeyCode.Q))
//{
// DistanceByForce += new Vector3(-5, 0, 0);
//}
//if (Input.GetKeyDown(KeyCode.D))
//{
// DistanceByForce += new Vector3(5, 0, 0);
//}
reduceStep
=
0.023f
/
0.1f
*
addScale
;
if
(!
BattleCtrl
.
instance
.
isStartBattle
)
...
...
@@ -309,9 +331,10 @@ public class PlayerMove : MonoBehaviour
return
;
}
RaycastHit
hit
;
xDelta
=
0
;
yDelta
=
0
;
zDelta
=
0
;
//xDelta = 0;
//yDelta = 0;
//zDelta = 0;
//不在地面上给物体添加一个模拟重力
Grounded
=
characterController
.
isGrounded
;
if
(!
Grounded
)
...
...
@@ -353,6 +376,23 @@ public class PlayerMove : MonoBehaviour
vertigoEffect
.
gameObject
.
SetActive
(
true
);
//AnimationManager(AnimationState.Vertigo);//眩晕动画
animationManager
.
ChangeAnimatorState
(
AnimationState
.
Vertigo
);
//眩晕状态也会被击退
xDelta
=
0
;
yDelta
=
0
;
zDelta
=
0
;
//------------模拟力-----------------------
Vector3
tempDis
=
DistanceByForce
;
DistanceByForce
=
Vector3
.
Lerp
(
DistanceByForce
,
new
Vector3
(
0
,
0
,
0
),
0.1f
);
tempDis
-=
DistanceByForce
;
//print("DistanceByForce:"+ DistanceByForce+ "tempDis:" + tempDis);
xDelta
+=
tempDis
.
x
;
yDelta
+=
tempDis
.
y
;
zDelta
+=
tempDis
.
z
;
//-----------------------------------------
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
}
else
{
...
...
@@ -427,10 +467,10 @@ public class PlayerMove : MonoBehaviour
{
//transform.position += transform.right * GameServices.inputService.joyStick.axisX.axisValue * HSpeed * Time.deltaTime;
xDelta
+
=
GameServices
.
inputService
.
joyStick
.
axisX
.
axisValue
*
VSpeed
*
Time
.
deltaTime
;
xDelta
=
GameServices
.
inputService
.
joyStick
.
axisX
.
axisValue
*
VSpeed
*
Time
.
deltaTime
;
//characterController.Move((transform.forward * MoveSpeed + new Vector3(0, _vertSpeed, 0)) * Time.deltaTime + (new Vector3(xDelta, 0, 0)));
}
zDelta
+
=
GameServices
.
inputService
.
joyStick
.
axisY
.
axisValue
*
VSpeed
*
Time
.
deltaTime
;
zDelta
=
GameServices
.
inputService
.
joyStick
.
axisY
.
axisValue
*
VSpeed
*
Time
.
deltaTime
;
if
(
xDelta
!=
0
||
zDelta
!=
0
)
{
//float angle = Vector3.Angle(new Vector3(transform.forward.x, 0, transform.forward.z), new Vector3(xDelta, 0, zDelta));
...
...
@@ -448,6 +488,16 @@ public class PlayerMove : MonoBehaviour
{
characterController
.
Move
(
new
Vector3
(
0
,
0
,
0
));
}
//------------模拟力-----------------------
Vector3
tempDis
=
DistanceByForce
;
DistanceByForce
=
Vector3
.
Lerp
(
DistanceByForce
,
new
Vector3
(
0
,
0
,
0
),
0.1f
);
tempDis
-=
DistanceByForce
;
//print("DistanceByForce:"+ DistanceByForce+ "tempDis:" + tempDis);
xDelta
+=
tempDis
.
x
;
yDelta
+=
tempDis
.
y
;
zDelta
+=
tempDis
.
z
;
//-----------------------------------------
//print("Player开始移动:" + new Vector3(xDelta, yDelta, zDelta));
characterController
.
Move
(
new
Vector3
(
xDelta
,
yDelta
,
zDelta
));
//移动
...
...
@@ -493,7 +543,13 @@ public class PlayerMove : MonoBehaviour
}
}
public
void
GetHitToBack
(
Vector3
OtherPostion
)
{
Vector3
dic
=
(
children
.
transform
.
position
-
OtherPostion
).
normalized
*
5
;
dic
.
y
=
0
;
DistanceByForce
=
dic
;
}
void
OnDestroy
()
{
...
...
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