diff --git a/Assets/GameAssets/Map/MapAssets/Tree1.prefab b/Assets/GameAssets/Map/MapAssets/Tree1.prefab index 4c5dc10..cd72362 100644 --- a/Assets/GameAssets/Map/MapAssets/Tree1.prefab +++ b/Assets/GameAssets/Map/MapAssets/Tree1.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 3758759900999227703} - component: {fileID: 5190637995354101084} + - component: {fileID: 8800099389817632657} m_Layer: 0 m_Name: Tree1 m_TagString: Untagged @@ -82,3 +83,17 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!136 &8800099389817632657 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7787474680208908760} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.15 + m_Height: 4 + m_Direction: 1 + m_Center: {x: 0, y: 2, z: 0} diff --git a/Assets/GameAssets/Map/MapAssets/Tree2.prefab b/Assets/GameAssets/Map/MapAssets/Tree2.prefab index c27cfef..ad924be 100644 --- a/Assets/GameAssets/Map/MapAssets/Tree2.prefab +++ b/Assets/GameAssets/Map/MapAssets/Tree2.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 6793637964037508681} - component: {fileID: 2478893278458593826} + - component: {fileID: 2492019538709937380} m_Layer: 0 m_Name: Tree2 m_TagString: Untagged @@ -82,3 +83,17 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!136 &2492019538709937380 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 467458995388004006} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.15 + m_Height: 4 + m_Direction: 1 + m_Center: {x: 0, y: 2, z: 0} diff --git a/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim b/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim new file mode 100644 index 0000000..6a07f98 --- /dev/null +++ b/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim @@ -0,0 +1,95 @@ +%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: Attack_3 + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 3500951761227251082, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.2 + value: {fileID: -848416997838638187, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.4 + value: {fileID: -1594377132886445991, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.5 + value: {fileID: -7939720171757009327, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.6 + value: {fileID: 4278741268874708782, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.7 + value: {fileID: -5551026827497223419, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.8 + value: {fileID: -2437237654950474820, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 0.9 + value: {fileID: -5853263684127566195, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 1 + value: {fileID: 806391716420303315, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - time: 1.1 + value: {fileID: -7703501868747715773, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + m_SampleRate: 10 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 3500951761227251082, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -848416997838638187, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -1594377132886445991, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -7939720171757009327, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: 4278741268874708782, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -5551026827497223419, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -2437237654950474820, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -5853263684127566195, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: 806391716420303315, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + - {fileID: -7703501868747715773, guid: ae72133dacba6ec4eb33ecde48f50e56, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.2 + 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: [] diff --git a/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim.meta b/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim.meta new file mode 100644 index 0000000..4f1eb52 --- /dev/null +++ b/Assets/GameAssets/Prefabs/Role/Warrior/Aniamtion/Attack_3.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b6e99fde1431eb4cb5bbab0121a0990 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameAssets/Prefabs/Role/Warrior/myWarrior.controller b/Assets/GameAssets/Prefabs/Role/Warrior/myWarrior.controller index a12149d..229acf5 100644 --- a/Assets/GameAssets/Prefabs/Role/Warrior/myWarrior.controller +++ b/Assets/GameAssets/Prefabs/Role/Warrior/myWarrior.controller @@ -73,6 +73,43 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &-4500150767147751999 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 4054845936075069209} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 1.0025342 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!114 &-4498217639007397335 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2b274c361bdeb94eb5e5f80d9370967, type: 3} + m_Name: + m_EditorClassIdentifier: + ShakeStep: 1 + Multiple: 10 + OnTimeProcess: 0.5 --- !u!1101 &-4318655337576861579 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -112,7 +149,7 @@ AnimatorStateMachine: m_Position: {x: 340, y: 110, z: 0} - serializedVersion: 1 m_State: {fileID: -3802118723531622627} - m_Position: {x: 540, y: 0, z: 0} + m_Position: {x: 590, y: 60, z: 0} - serializedVersion: 1 m_State: {fileID: 4164821889480732602} m_Position: {x: 340, y: 260, z: 0} @@ -169,7 +206,16 @@ AnimatorStateMachine: m_Position: {x: 450, y: -170, z: 0} - serializedVersion: 1 m_State: {fileID: 993502365009367806} - m_Position: {x: 540, y: -100, z: 0} + m_Position: {x: 610, y: -120, z: 0} + - serializedVersion: 1 + m_State: {fileID: 504469167200563978} + m_Position: {x: 0, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: 993732683156966362} + m_Position: {x: 0, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: 2819678479818455320} + m_Position: {x: 750, y: -50, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -434,6 +480,32 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1102 &504469167200563978 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Dash-Attack 0 + 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: 11822cbe6f25108459fd2ef98cc9255c, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1102 &993502365009367806 AnimatorState: serializedVersion: 6 @@ -462,6 +534,32 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1102 &993732683156966362 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Dash-Attack 1 + 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: 11822cbe6f25108459fd2ef98cc9255c, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1102 &1147905805402225859 AnimatorState: serializedVersion: 6 @@ -540,6 +638,51 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1102 &2819678479818455320 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Attack_3 + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -4500150767147751999} + m_StateMachineBehaviours: + - {fileID: 3280784038793258507} + - {fileID: -4498217639007397335} + 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: 2b6e99fde1431eb4cb5bbab0121a0990, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!114 &3280784038793258507 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1f25b8c125efdad4585737ed25a28b12, type: 3} + m_Name: + m_EditorClassIdentifier: + CanSkipTime: 1 + SendCanToNext: 0 + RoleID: 0 + NodeType: 0 --- !u!1102 &4054845936075069209 AnimatorState: serializedVersion: 6 diff --git a/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs b/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs new file mode 100644 index 0000000..c932f30 --- /dev/null +++ b/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs @@ -0,0 +1,58 @@ +using Game; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public enum E_ANIME_STEP +{ + OnEnter, + OnTimeProcess, + OnExit +} + +public class anime_CamerShake : StateMachineBehaviour +{ + + public E_ANIME_STEP ShakeStep = E_ANIME_STEP.OnExit; + public float Multiple = 1; + public float OnTimeProcess = 0.7f; + bool bDoShake = false; + + // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state + override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + bDoShake = false; + if (ShakeStep == E_ANIME_STEP.OnEnter) + AppEntry.Event.Fire(null, CameraShakeEventArgs.Create(Multiple)); + } + + // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks + override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if (ShakeStep == E_ANIME_STEP.OnTimeProcess && !bDoShake && stateInfo.normalizedTime > OnTimeProcess) + { + bDoShake = true; + AppEntry.Event.Fire(null, CameraShakeEventArgs.Create(Multiple)); + } + } + + // OnStateExit is called when a transition ends and the state machine finishes evaluating this state + override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + bDoShake = false; + if (ShakeStep == E_ANIME_STEP.OnExit) + AppEntry.Event.Fire(null, CameraShakeEventArgs.Create(Multiple)); + } + + // OnStateMove is called right after Animator.OnAnimatorMove() + //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + //{ + // // Implement code that processes and affects root motion + //} + + // OnStateIK is called right after Animator.OnAnimatorIK() + //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + //{ + // // Implement code that sets up animation IK (inverse kinematics) + //} +} diff --git a/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs.meta b/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs.meta new file mode 100644 index 0000000..c9b4811 --- /dev/null +++ b/Assets/Scripts/Main/AnimeScript/anime_CamerShake.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2b274c361bdeb94eb5e5f80d9370967 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Main/AnimeScript/anime_DeadAnimeEnd.cs b/Assets/Scripts/Main/AnimeScript/anime_DeadAnimeEnd.cs index 715243f..cfa2e3c 100644 --- a/Assets/Scripts/Main/AnimeScript/anime_DeadAnimeEnd.cs +++ b/Assets/Scripts/Main/AnimeScript/anime_DeadAnimeEnd.cs @@ -8,22 +8,34 @@ public class anime_DeadAnimeEnd : StateMachineBehaviour public int RoleID = 0; public int NodeType = 0; + bool bSendEvent = false; + // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { + bSendEvent = false; NodeType = animator.GetInteger("NodeType"); RoleID = animator.GetInteger("RoleID"); } // OnState}Update is called on each Update frame between OnStateEnter and OnStateExit callbacks - //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) - //{ - //} + override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if (!bSendEvent && stateInfo.normalizedTime > 0.95f) + { + bSendEvent = true; + AppEntry.Event.Fire(null, RoleDeadAnimeEndEventArgs.Create((E_NODE_TYPE)NodeType, RoleID)); + } + } // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { - AppEntry.Event.Fire(null, RoleDeadAnimeEndEventArgs.Create((E_NODE_TYPE)NodeType,RoleID)); + if (!bSendEvent) + { + bSendEvent = true; + AppEntry.Event.Fire(null, RoleDeadAnimeEndEventArgs.Create((E_NODE_TYPE)NodeType,RoleID)); + } } // OnStateMove is called right after Animator.OnAnimatorMove() diff --git a/Assets/Scripts/Main/AnimeScript/anime_OnceAttack.cs b/Assets/Scripts/Main/AnimeScript/anime_OnceAttack.cs index 65b716c..ffd95f5 100644 --- a/Assets/Scripts/Main/AnimeScript/anime_OnceAttack.cs +++ b/Assets/Scripts/Main/AnimeScript/anime_OnceAttack.cs @@ -30,7 +30,7 @@ public class anime_OnceAttack : StateMachineBehaviour // OnState}Update is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { - if (!SendCanToNext && stateInfo.normalizedTime > 0.8f) + if (!SendCanToNext && stateInfo.normalizedTime > CanSkipTime) { SendCanToNext = true; AppEntry.Event.Fire(null, MainPlayerOnceAttackEventArgs.Create(RoleID, (E_NODE_TYPE)NodeType, E_ONCEATTACK_STEP.InAttackCanToNext)); diff --git a/Assets/Scripts/Main/Camera/CameraShake.cs b/Assets/Scripts/Main/Camera/CameraShake.cs index f4c0e1f..6d2e671 100644 --- a/Assets/Scripts/Main/Camera/CameraShake.cs +++ b/Assets/Scripts/Main/Camera/CameraShake.cs @@ -9,6 +9,7 @@ using UnityEngine; public class CameraShake : MonoBehaviour { public float _magnitude = 0.02f; + public float Multiple = 1; private void OnEnable() { @@ -24,6 +25,7 @@ public class CameraShake : MonoBehaviour { CameraShakeEventArgs msg = (CameraShakeEventArgs)e; if (msg == null) throw new GameException("OnCameraShakeEventArgs is null"); + Multiple = msg.Multiple; StartShake(); } @@ -33,7 +35,7 @@ public class CameraShake : MonoBehaviour if (IEnumerator_Shake != null) StopCoroutine(IEnumerator_Shake); - IEnumerator_Shake = StartCoroutine(PlayCameraShakeAnimation(0.1f, _magnitude)); + IEnumerator_Shake = StartCoroutine(PlayCameraShakeAnimation(0.1f * Multiple, _magnitude)); } Coroutine IEnumerator_Shake; diff --git a/Assets/Scripts/Main/CustomsComponent/BattleMgrComponent.cs b/Assets/Scripts/Main/CustomsComponent/BattleMgrComponent.cs index fc3e5b9..f69b579 100644 --- a/Assets/Scripts/Main/CustomsComponent/BattleMgrComponent.cs +++ b/Assets/Scripts/Main/CustomsComponent/BattleMgrComponent.cs @@ -53,7 +53,7 @@ namespace Game //TODO 受击朝向 //摄像机震动 - AppEntry.Event.Fire(null, CameraShakeEventArgs.Create()); + AppEntry.Event.Fire(null, CameraShakeEventArgs.Create(1)); CanAttack = true; @@ -72,7 +72,7 @@ namespace Game //TODO 受击朝向 //摄像机震动 - AppEntry.Event.Fire(null, CameraShakeEventArgs.Create()); + AppEntry.Event.Fire(null, CameraShakeEventArgs.Create(1)); CanAttack = true; diff --git a/Assets/Scripts/Main/CustomsComponent/InputComponent.cs b/Assets/Scripts/Main/CustomsComponent/InputComponent.cs index 50ebcc3..a66e1c5 100644 --- a/Assets/Scripts/Main/CustomsComponent/InputComponent.cs +++ b/Assets/Scripts/Main/CustomsComponent/InputComponent.cs @@ -34,6 +34,15 @@ namespace Game mInputMotionData.Init(); } + void OnEnable() + { + mInputMotionData.OnEnable(); + } + + void OnDisable() + { + mInputMotionData.OnDestory(); + } /// /// 检测是否点击UI @@ -141,6 +150,8 @@ namespace Game Update_Touch(); Update_Input(); + //更新行为列表逻辑 + mInputMotionData.Update_Logic(); } /// diff --git a/Assets/Scripts/Main/CustomsComponent/MainPlayerComponent.cs b/Assets/Scripts/Main/CustomsComponent/MainPlayerComponent.cs index b9d33ea..fc05798 100644 --- a/Assets/Scripts/Main/CustomsComponent/MainPlayerComponent.cs +++ b/Assets/Scripts/Main/CustomsComponent/MainPlayerComponent.cs @@ -109,20 +109,27 @@ namespace Game string AtkBoxAnimeName; //是否是最终招式 bool IsEndMotion = false; + //一次也没按下 - if (!GamePlayEntry.Input.mInputMotionData.CheckHistoryLastMotion(E_MOTION_TYPE.Attack_1)) + if (GamePlayEntry.Input.mInputMotionData.CheckHistoryLastMotion(E_MOTION_TYPE.Attack_2)) { - AnimeName = "Attack_1"; + AnimeName = "Attack_3"; AtkBoxAnimeName = "HorizontalCut_Down"; - GamePlayEntry.Input.mInputMotionData.AddMontionKey(E_MOTION_TYPE.Attack_1); + GamePlayEntry.Input.mInputMotionData.AddMontionKey(E_MOTION_TYPE.Attack_3); + IsEndMotion = true; + //结束动作 + } + else if(GamePlayEntry.Input.mInputMotionData.CheckHistoryLastMotion(E_MOTION_TYPE.Attack_1)) + { + AnimeName = "Attack_2"; + AtkBoxAnimeName = "HorizontalCut_Up"; + GamePlayEntry.Input.mInputMotionData.AddMontionKey(E_MOTION_TYPE.Attack_2); } else { - //结束动作 - AnimeName = "Attack_2"; - AtkBoxAnimeName = "HorizontalCut_Up"; - GamePlayEntry.Input.mInputMotionData.AddMontionKey(E_MOTION_TYPE.Attack_2); - IsEndMotion = true; + AnimeName = "Attack_1"; + AtkBoxAnimeName = "HorizontalCut_Down"; + GamePlayEntry.Input.mInputMotionData.AddMontionKey(E_MOTION_TYPE.Attack_1); } Player.Anime.SetAttack(AnimeName); diff --git a/Assets/Scripts/Main/Definition/DataStruct/Input/InputMotionData.cs b/Assets/Scripts/Main/Definition/DataStruct/Input/InputMotionData.cs index 6e9895a..1df3855 100644 --- a/Assets/Scripts/Main/Definition/DataStruct/Input/InputMotionData.cs +++ b/Assets/Scripts/Main/Definition/DataStruct/Input/InputMotionData.cs @@ -1,3 +1,5 @@ +using Axibug; +using Axibug.Event; using System; using System.Collections.Generic; using System.Configuration; @@ -10,6 +12,7 @@ namespace Game None, Attack_1, Attack_2, + Attack_3, } public class MontionkeyClass @@ -28,11 +31,53 @@ namespace Game static Queue tempHistoryQueue = new Queue(); const int MontionHistoryLimit = 10; + bool mNeedClear = false; + const float ClearCD = 0.3f; + //剩余清理时间 + float flagTime = 0; + bool NeedClear { get { return mNeedClear; } + set { + if (value) + { + flagTime = ClearCD; + } + else + { + flagTime = 0; + } + mNeedClear = value; + } + } + public void Init() { ClearHistoryMotion(); } + public void OnEnable() + { + + AppEntry.Event.Subscribe(MainPlayerOnceAttackEventArgs.EventId, OnMainPlayerInAttackEventArgs); + } + + public void OnDestory() + { + AppEntry.Event.Unsubscribe(MainPlayerOnceAttackEventArgs.EventId, OnMainPlayerInAttackEventArgs); + } + + private void OnMainPlayerInAttackEventArgs(object sender, LogicEventArgs e) + { + MainPlayerOnceAttackEventArgs msg = (MainPlayerOnceAttackEventArgs)e; + if (msg == null) throw new GameException("MainPlayerOnceAttackEventArgs is null"); + if (msg.RoleID == GamePlayEntry.MainPlayer.Player.RoleID) + { + if (msg.Step == E_ONCEATTACK_STEP.InAttack) + NeedClear = false; + else if(msg.Step == E_ONCEATTACK_STEP.None) + NeedClear = true; + } + } + MontionkeyClass EnqueueOneMotionHistory() { if (tempHistoryQueue.Count > 0) @@ -63,6 +108,8 @@ namespace Game tempHistoryQueue.Enqueue(KeyHistory[i]); } KeyHistory.Clear(); + NeedClear = false; + AxibugLog.Debug("清理MotionHistory"); } public bool CheckHistoryLastMotion(E_MOTION_TYPE type) @@ -92,5 +139,18 @@ namespace Game return true; } + + public void Update_Logic() + { + if (NeedClear) + { + flagTime -= Time.deltaTime; + if (flagTime <= 0) + { + ClearHistoryMotion(); + NeedClear = false; + } + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Main/Definition/DataStruct/Role/RoleData.cs b/Assets/Scripts/Main/Definition/DataStruct/Role/RoleData.cs index b6e6106..fc860cd 100644 --- a/Assets/Scripts/Main/Definition/DataStruct/Role/RoleData.cs +++ b/Assets/Scripts/Main/Definition/DataStruct/Role/RoleData.cs @@ -9,11 +9,15 @@ namespace Game public S_ROLE_ECON econ;//经济 public S_ROLE_MOVE move; + + public S_HAD_SKILL skill; + public S_ROLE_SELF() { RoleType = E_NODE_TYPE.N_MAINPLAYER; move = new S_ROLE_MOVE(); econ = new S_ROLE_ECON(); + skill = new S_HAD_SKILL(); } override public void Init() @@ -22,6 +26,7 @@ namespace Game exp.Init(); move.Init(); econ.Init(); + skill.Init(); } } diff --git a/Assets/Scripts/Main/Definition/DataStruct/Role/RoleDataClass.cs b/Assets/Scripts/Main/Definition/DataStruct/Role/RoleDataClass.cs index 6e85b3f..3f71a08 100644 --- a/Assets/Scripts/Main/Definition/DataStruct/Role/RoleDataClass.cs +++ b/Assets/Scripts/Main/Definition/DataStruct/Role/RoleDataClass.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; namespace Game @@ -149,6 +150,18 @@ namespace Game } + + //攻击锁定 + public class S_HAD_SKILL + { + public List hadskillid = new List(); + + public void Init() + { + hadskillid.Clear(); + } + } + //移动控制数据 public class S_ROLE_MOVE { diff --git a/Assets/Scripts/Main/Event/CameraEvent/CameraShakeEventArgs.cs b/Assets/Scripts/Main/Event/CameraEvent/CameraShakeEventArgs.cs index d306749..4ebb34c 100644 --- a/Assets/Scripts/Main/Event/CameraEvent/CameraShakeEventArgs.cs +++ b/Assets/Scripts/Main/Event/CameraEvent/CameraShakeEventArgs.cs @@ -12,14 +12,18 @@ namespace Game /// public override int Id { get { return EventId; } } - public static CameraShakeEventArgs Create() + public float Multiple = 0; + + public static CameraShakeEventArgs Create(float multiple) { CameraShakeEventArgs s = ReferencePool.Acquire(); + s.Multiple = multiple; return s; } public override void Clear() { + Multiple = 0; } } } \ No newline at end of file diff --git a/Assets/Scripts/Main/Role/MainRole.cs b/Assets/Scripts/Main/Role/MainRole.cs index 946b08a..6356dfe 100644 --- a/Assets/Scripts/Main/Role/MainRole.cs +++ b/Assets/Scripts/Main/Role/MainRole.cs @@ -9,6 +9,7 @@ namespace Game { protected SpriteRenderer mSpriteRenderer; public SnapshotData mRoleSnapshot; + public S_ROLE_SELF PlayData; /// /// 初始化 @@ -17,6 +18,7 @@ namespace Game public void Init(S_ROLE_SELF data) { base.Init(data); + PlayData = data; mRoleSnapshot = new SnapshotData(); } @@ -86,7 +88,6 @@ namespace Game Anime.SetAnimatorSpeed(2.6f); Move_BaseSpeed = 3.5f * 2.6f; } - } public override void MeshChangeMoveState(bool ToMoveState) @@ -152,7 +153,9 @@ namespace Game else { //如果超过移动时间 - if(MoveTime > ConstClass.ToFastModeTime) + if(MoveTime > ConstClass.ToFastModeTime + && PlayData.skill.hadskillid.Contains(5)//判断是否有加速技能 + ) IsFastSkillMode = true; else IsFastSkillMode = false; diff --git a/Assets/Scripts/Main/Role/RoleBase.cs b/Assets/Scripts/Main/Role/RoleBase.cs index 81abd44..d2dbf1c 100644 --- a/Assets/Scripts/Main/Role/RoleBase.cs +++ b/Assets/Scripts/Main/Role/RoleBase.cs @@ -1,4 +1,5 @@ using Axibug; +using Axibug.Event; using Axibug.Runtime; using System; using System.Collections.Generic; @@ -54,10 +55,35 @@ namespace Game AttackStep = E_ONCEATTACK_STEP.None; MeshChangeDir(mIsLeft); + + AppEntry.Event.Subscribe(AttackHitEventArgs.EventId, OnAttackHitEventArgs); } protected virtual void OnDisable() { + AppEntry.Event.Unsubscribe(AttackHitEventArgs.EventId, OnAttackHitEventArgs); + } + + private void OnAttackHitEventArgs(object sender, LogicEventArgs e) + { + AttackHitEventArgs msg = (AttackHitEventArgs)e; + if (msg == null) throw new GameException("AttackHitEventArgs is null"); + + if (msg.UnderAtk_RoleID != RoleID) + return; + + RoleBase Attacker = GamePlayEntry.RoleMgr.FindRole(msg.Attacker_Type, msg.Attacker_RoleID); + if (Attacker == null) + { + AxibugLog.Error("Attacker 为空"); + return; + } + + //受击、朝向 + if (Attacker.transform.position.x < transform.position.x) + IsLeft = true; + else + IsLeft = false; } ///