Commit b24f623e authored by czy's avatar czy

Boss动画优化

parent 3c1a7b98
......@@ -24,10 +24,14 @@ AnimatorStateMachine:
- serializedVersion: 1
m_State: {fileID: 5730630131191024332}
m_Position: {x: -30, y: 350, z: 0}
- serializedVersion: 1
m_State: {fileID: 5232131748971255912}
m_Position: {x: -260, y: 240, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: -988131835395953829}
- {fileID: -5157424812580719683}
- {fileID: 8973507764031670339}
- {fileID: 2005904175553675675}
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
......@@ -140,19 +144,22 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter: MoveSpeed
--- !u!1101 &-4809412122287805464
--- !u!1101 &-5157424812580719683
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: IsFirstHurricaneKickBefor
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 0}
m_DstState: {fileID: 5232131748971255912}
m_Solo: 0
m_Mute: 0
m_IsExit: 1
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
......@@ -162,32 +169,29 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-1429333520268681619
--- !u!1101 &-4809412122287805464
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 4
m_ConditionEvent: MoveSpeed
m_EventTreshold: 0.2
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5730630131191024332}
m_DstState: {fileID: 0}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
m_IsExit: 1
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.6428572
m_HasExitTime: 0
m_ExitTime: 0.75
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-988131835395953829
--- !u!1101 &-1429333520268681619
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
......@@ -195,18 +199,18 @@ AnimatorStateTransition:
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: HurricaneKick
m_EventTreshold: 0
- m_ConditionMode: 4
m_ConditionEvent: MoveSpeed
m_EventTreshold: 0.2
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 4471307210666310047}
m_DstState: {fileID: 5730630131191024332}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_ExitTime: 0.6428572
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
......@@ -254,19 +258,31 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: LegSweep
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: HurricaneKick
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: HurricaneKickBefor
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: IsFirstHurricaneKickBefor
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
......@@ -280,6 +296,31 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1101 &2005904175553675675
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: HurricaneKick
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 4471307210666310047}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &2335692240658299194
AnimatorStateTransition:
m_ObjectHideFlags: 1
......@@ -357,7 +398,33 @@ AnimatorState:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
m_TimeParameter: aaa
--- !u!1102 &5232131748971255912
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HurricaneKickBefor
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: d266a3801edfb2d4ebf814eeea93f5d2, type: 2}
m_Tag:
m_SpeedParameter: MoveSpeed
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter: aaa
--- !u!1102 &5730630131191024332
AnimatorState:
serializedVersion: 5
......
This diff is collapsed.
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HurricaneKickBefor
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.98333335
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events:
- time: 0.98333335
functionName: HurricaneKickBeforEnd
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
fileFormatVersion: 2
guid: d266a3801edfb2d4ebf814eeea93f5d2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
......@@ -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
......
......@@ -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
......
......@@ -6,16 +6,32 @@ public enum BossAnimationState
{
LegSweep=1,
HurricaneKick=2,
NotAttack=3
NotAttack=3,
}
public class BossAnimationManager : MonoBehaviour
{
private Animator animator;
private float HurricaneKickTimer = 0;
public bool IsFirstHurricaneKickBefor = true;
void Start()
{
animator = GetComponentInChildren<Animator>();
}
private void Update()
{
if (!IsFirstHurricaneKickBefor)
{
HurricaneKickTimer += Time.deltaTime;
}
else
{
HurricaneKickTimer = 0;
}
}
public void ChangeAnimatorState(BossAnimationState state)
{
......@@ -24,27 +40,58 @@ public class BossAnimationManager : MonoBehaviour
{
case BossAnimationState.LegSweep:
IsFirstHurricaneKickBefor = true;
HurricaneKickTimer = 0;
animator.SetBool("HurricaneKick", false);
animator.SetBool("LegSweep", true);
animator.SetFloat("MoveSpeed", 0);
break;
case BossAnimationState.HurricaneKick:
animator.SetBool("HurricaneKick", true);
animator.SetBool("LegSweep", false);
animator.SetFloat("MoveSpeed", 0) ;
//--------第一次旋转需要停留一秒钟----------------------------------------------
if (IsFirstHurricaneKickBefor)
{
IsFirstHurricaneKickBefor = false;
}
if (HurricaneKickTimer<=1f)
{
print("第一次播放。");
animator.SetBool("IsFirstHurricaneKickBefor", true);
}
else
{
print("不是第一次播放。");
animator.SetBool("IsFirstHurricaneKickBefor", false);
animator.SetBool("HurricaneKickBefor", true);
animator.SetBool("HurricaneKick", true);
animator.SetBool("LegSweep", false);
animator.SetFloat("MoveSpeed", 0);
}
break;
case BossAnimationState.NotAttack:
IsFirstHurricaneKickBefor = true;
HurricaneKickTimer = 0;
animator.SetBool("HurricaneKick", false);
animator.SetBool("LegSweep", false);
break;
default:
IsFirstHurricaneKickBefor = true;
HurricaneKickTimer = 0;
animator.SetBool("HurricaneKick", false);
animator.SetBool("LegSweep", false);
Debug.LogError(state);
break;
}
}
//public void SetIsFirstHurricaneKickBefor()
//{
// animator.SetBool("IsFirstHurricaneKickBefor", false);
//}
}
......@@ -21,11 +21,14 @@ public class BossAttack : MonoBehaviour
public AttackType attackType = AttackType.Null;
private Animator animator;
public BossAnimationManager bossAnimationManager;
// Start is called before the first frame update
void Start()
{
animator= GetComponentInChildren<Animator>();
}
// Update is called once per frame
......@@ -63,6 +66,16 @@ public class BossAttack : MonoBehaviour
print("改变boss攻击状态为:"+attackType);
}
public void HurricaneKickBeforEnable()
{
animator.SetBool("HurricaneKickBefor", false);
}
/// <summary>
/// HurricaneKickBefor状态结束时调用。
/// </summary>
public void HurricaneKickBeforEnd()
{
animator.SetBool("HurricaneKickBefor", false);
animator.SetBool("HurricaneKick", true);
}
}
......@@ -34,7 +34,7 @@ public class BossAttackDamageRange : MonoBehaviour
other.gameObject.GetComponentInChildren<AIMove>().Hurt(0.5f);
ps = Instantiate(hitEffects, hitPos, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
Handheld.Vibrate();//手机震动
//Handheld.Vibrate();//手机震动
}
}
......
......@@ -35,7 +35,7 @@ public class BossMove : MonoBehaviour
[Header("旋风腿")]
[Tooltip("旋风腿持续时间")]
public float HurricaneKickDuration = 3;
public float HurricaneKickDuration = 1.5f;
public float CurrentHurricaneKickDuration=0;
[Tooltip("旋风腿冷却时间")]
public float HurricaneKickCoolingTime =5;
......@@ -45,8 +45,8 @@ public class BossMove : MonoBehaviour
[Header("扫腿")]
[Tooltip("扫腿冷却时间")]
public float LegSweepDuration = 2;
public float CurrentLegSweepDuration = 0;
public float LegSweepCoolingTime = 3;
public float CurrentLegSweepCoolingTime = 0;
[Tooltip("扫腿技能是否处于冷却中")]
public bool isDeltaTime2 = false;
......@@ -57,6 +57,9 @@ public class BossMove : MonoBehaviour
private bool IsCanMove = true;
private bool isHurricaneKick = false;
public ParticleSystem ps;
public ParticleSystem ps2;
......@@ -158,11 +161,13 @@ public class BossMove : MonoBehaviour
if (isDeltaTime2)
{
//扫腿处于冷却中。
CurrentLegSweepDuration += Time.deltaTime;
if (CurrentLegSweepDuration >= LegSweepDuration)
//扫腿处于冷却中。
print("扫腿冷却中");
CurrentLegSweepCoolingTime += Time.deltaTime;
if (CurrentLegSweepCoolingTime >= LegSweepCoolingTime)
{
CurrentLegSweepDuration = 0;
print("扫腿冷却完毕");
CurrentLegSweepCoolingTime = 0;
isDeltaTime2 = false;
}
}
......@@ -234,6 +239,9 @@ public class BossMove : MonoBehaviour
{
//附近有2个人就触发,技能好了就等待,当前播放的动画不是扫腿就开始播放旋风腿。
print("旋风腿");
ps.Play();
ps2.Play();
CurrentHurricaneKickDuration += Time.deltaTime;//旋风腿持续时间减少
if (CurrentHurricaneKickDuration >= HurricaneKickDuration)
{
......@@ -241,6 +249,8 @@ public class BossMove : MonoBehaviour
isDeltaTime = true;
isHurricaneKick = false;
//重新计时冷却时间
ps.Stop();
ps2.Stop();
CurrentHurricaneKickCoolingTime = 0;
CurrentHurricaneKickDuration = 0;
}
......
......@@ -51,7 +51,7 @@ public class AttackTrigger : MonoBehaviour
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(0.5f);
ps= Instantiate(hitEffects, hitPos.transform.position, hitPos.transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
Handheld.Vibrate();//手机震动
//Handheld.Vibrate();//手机震动
}
else if (other.tag == "Competitor")
......@@ -59,7 +59,11 @@ public class AttackTrigger : MonoBehaviour
other.gameObject.GetComponentInChildren<AIMove>().Hurt(0.5f);
ps=Instantiate(hitEffects, hitPos.transform.position, hitPos.transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
Handheld.Vibrate();//手机震动
if (Root.tag == "Player")
{
Handheld.Vibrate();//手机震动
}
}
else if (other.tag == "Boss")
......@@ -67,7 +71,10 @@ public class AttackTrigger : MonoBehaviour
other.gameObject.GetComponentInChildren<BossMove>().Hurt(1);
ps = Instantiate(hitEffects, hitPos.transform.position, hitPos.transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
Handheld.Vibrate();//手机震动
if (Root.tag == "Player")
{
Handheld.Vibrate();//手机震动
}
if (Root.name == "Player")
{
Root.GetComponentInChildren<PlayerMove>().UpdateScore(2);
......
......@@ -74,6 +74,7 @@ public class PlayerMove : MonoBehaviour
if (other.tag == "Food")
{
//print("吃到食物。");
Handheld.Vibrate();//手机震动
UpdateScore(1);
if (scale >= (1 + MaxFood * addScale))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment