diff options
author | chai <chaifix@163.com> | 2020-10-19 09:08:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-19 09:08:22 +0800 |
commit | 608395979f5323dc69f3cc343715aba4f5c552bc (patch) | |
tree | 68f21eaf8a2c3b996cf27bf68c2464460e6973e0 /Assets/Scripts | |
parent | 08f9a5eae6739e4070f4db7b298e2b34016ea4f4 (diff) |
+Gun ability
Diffstat (limited to 'Assets/Scripts')
-rw-r--r-- | Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs | 18 | ||||
-rw-r--r-- | Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs.meta | 11 | ||||
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript_Ability.cs | 55 | ||||
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript_Anim.cs | 12 |
4 files changed, 90 insertions, 6 deletions
diff --git a/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs b/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs new file mode 100644 index 00000000..c21fce77 --- /dev/null +++ b/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ActionJumpBack : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs.meta b/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs.meta new file mode 100644 index 00000000..c8db01c7 --- /dev/null +++ b/Assets/Scripts/AbilitySystem/Actions/ActionJumpBack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b4b55d531ec4084294169cddfbeb57a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Test/SaionjiScript_Ability.cs b/Assets/Scripts/Test/SaionjiScript_Ability.cs index b0a124c7..18cc93dd 100644 --- a/Assets/Scripts/Test/SaionjiScript_Ability.cs +++ b/Assets/Scripts/Test/SaionjiScript_Ability.cs @@ -42,6 +42,10 @@ public partial class SaionjiScript : MonoBehaviour AttackAbility attk5 = new AttackAbility(animator, Anim_LightAttack5);
AttackAbility sideKick = new AttackAbility(animator, Anim_SideKick);
AttackAbility superKick = new AttackAbility(animator, Anim_SuperKick);
+ AttackAbility gun1 = new AttackAbility(animator, Anim_Gun1);
+ AttackAbility gun2 = new AttackAbility(animator, Anim_Gun2);
+ AttackAbility gun3 = new AttackAbility(animator, Anim_Gun3);
+ AttackAbility gun4 = new AttackAbility(animator, Anim_Gun4);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// actions
@@ -60,6 +64,10 @@ public partial class SaionjiScript : MonoBehaviour ActionSwitchAbility switchToSideKick = new ActionSwitchAbility(m_AbilitySystem, sideKick);
ActionSwitchAbility switchToDash = new ActionSwitchAbility(m_AbilitySystem, dash);
ActionSwitchAbility switchToSuperKick = new ActionSwitchAbility(m_AbilitySystem, superKick);
+ ActionSwitchAbility switchToGun1 = new ActionSwitchAbility(m_AbilitySystem, gun1);
+ ActionSwitchAbility switchToGun2 = new ActionSwitchAbility(m_AbilitySystem, gun2);
+ ActionSwitchAbility switchToGun3 = new ActionSwitchAbility(m_AbilitySystem, gun3);
+ ActionSwitchAbility switchToGun4 = new ActionSwitchAbility(m_AbilitySystem, gun4);
ActionWipeCmdRecord wipeCmdRecord = new ActionWipeCmdRecord();
@@ -73,10 +81,11 @@ public partial class SaionjiScript : MonoBehaviour ConditionButtonHold condLeftButtonHold = new ConditionButtonHold(GamepadButton.Left);
ConditionCommand condCircleCmd = new ConditionCommand(GamepadButton.Circle);
ConditionCommand condCrossCmd = new ConditionCommand(GamepadButton.Cross);
+ ConditionCommand condSquareCmd = new ConditionCommand(GamepadButton.Square);
ConditionTowardLeft condTowardLeft = new ConditionTowardLeft(this.transform);
ConditionTowardRight condTowardRight = new ConditionTowardRight(this.transform);
- ConditionCommandSeq condRight2Cmd = new ConditionCommandSeq(new List<GamepadButton>{GamepadButton.Right, GamepadButton.Right }, 1f);
- ConditionCommandSeq condLeft2Cmd = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Left, GamepadButton.Left }, 1f);
+ ConditionCommandSeq condRight2Cmd = new ConditionCommandSeq(new List<GamepadButton>{GamepadButton.Right, GamepadButton.Right }, 0.8f);
+ ConditionCommandSeq condLeft2Cmd = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Left, GamepadButton.Left }, 0.8f);
ConditionCommandSeq condDRC = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Right, GamepadButton.Circle}, 1f);
ConditionCommandSeq condDLC = new ConditionCommandSeq(new List<GamepadButton> { GamepadButton.Down, GamepadButton.Left, GamepadButton.Circle}, 1f);
@@ -101,14 +110,16 @@ public partial class SaionjiScript : MonoBehaviour idle.AddTrigger(trigger);
trigger = new Trigger(And(condTowardLeft, And(condLeftCmd, condLeft2Cmd)), new List<ActionBase> { wipeCmdRecord , switchToDash });
idle.AddTrigger(trigger);
- trigger = new Trigger(And(condRightButtonHold, Not(condRight2Cmd)), new List<ActionBase> { switchToMove, towardRight });
+ trigger = new Trigger(condRightButtonHold, new List<ActionBase> { switchToMove, towardRight });
idle.AddTrigger(trigger);
- trigger = new Trigger(And(condLeftButtonHold, Not(condLeft2Cmd)), new List<ActionBase> { switchToMove, towardLeft });
+ trigger = new Trigger(condLeftButtonHold, new List<ActionBase> { switchToMove, towardLeft });
idle.AddTrigger(trigger);
trigger = new Trigger(condCircleCmd, switchToAttk1);
idle.AddTrigger(trigger);
trigger = new Trigger(condCrossCmd, switchToSideKick);
idle.AddTrigger(trigger);
+ trigger = new Trigger(condSquareCmd, switchToGun1);
+ idle.AddTrigger(trigger);
idle.AddTrigger(triggerTurnRight);
idle.AddTrigger(triggerTurnLeft);
@@ -134,7 +145,8 @@ public partial class SaionjiScript : MonoBehaviour // attack abilities
float expireTime = 0.3f;
-
+
+ // sword normal attack
ConditionAnimAtEnd condAttk1AtEnd = new ConditionAnimAtEnd(animator, Anim_LightAttack1);
trigger = new Trigger(And(condAttk1AtEnd, condCircleCmd), switchToAttk2);
attk1.AddTrigger(trigger);
@@ -180,14 +192,47 @@ public partial class SaionjiScript : MonoBehaviour attk5.AddTrigger(triggerTurnRight);
attk5.AddTrigger(triggerTurnLeft);
+ // side kick normal
ConditionAttkExpireTime condSideKickExpireTime = new ConditionAttkExpireTime(sideKick, expireTime);
trigger = new Trigger(condSideKickExpireTime, switchToIdle);
sideKick.AddTrigger(trigger);
+ // super kick combo
ConditionAttkExpireTime condSuperKickExpireTime = new ConditionAttkExpireTime(superKick, expireTime);
trigger = new Trigger(condSuperKickExpireTime, switchToIdle);
superKick.AddTrigger(trigger);
+ // gun normal
+ ConditionAnimAtEnd condGun1AtEnd = new ConditionAnimAtEnd(animator, Anim_Gun1);
+ trigger = new Trigger(And(condGun1AtEnd, condSquareCmd), switchToGun2);
+ gun1.AddTrigger(trigger);
+ ConditionAttkExpireTime condGun1ExpireTime = new ConditionAttkExpireTime(gun1, expireTime);
+ trigger = new Trigger(condGun1ExpireTime, switchToIdle);
+ gun1.AddTrigger(trigger);
+
+ ConditionAnimAtEnd condGun2AtEnd = new ConditionAnimAtEnd(animator, Anim_Gun2);
+ trigger = new Trigger(And(condGun2AtEnd, condSquareCmd), switchToGun3);
+ gun2.AddTrigger(trigger);
+ ConditionAttkExpireTime condGun2ExpireTime = new ConditionAttkExpireTime(gun2, expireTime);
+ trigger = new Trigger(condGun2ExpireTime, switchToIdle);
+ gun2.AddTrigger(trigger);
+
+ ConditionAnimAtEnd condGun3AtEnd = new ConditionAnimAtEnd(animator, Anim_Gun3);
+ trigger = new Trigger(And(condGun3AtEnd, condSquareCmd), switchToGun4);
+ gun3.AddTrigger(trigger);
+ ConditionAttkExpireTime condGun3ExpireTime = new ConditionAttkExpireTime(gun3, expireTime);
+ trigger = new Trigger(condGun3ExpireTime, switchToIdle);
+ gun3.AddTrigger(trigger);
+
+ ConditionAttkExpireTime condGun4ExpireTime = new ConditionAttkExpireTime(gun4, expireTime);
+ trigger = new Trigger(condGun4ExpireTime, switchToIdle);
+ gun4.AddTrigger(trigger);
+ ConditionAnimRange condGun4AnimRange = new ConditionAnimRange(animator, 0.6f, 1f);
+ trigger = new Trigger(And(condGun4AnimRange, condRight2Cmd), new List<ActionBase> { switchToDash, towardRight });
+ gun4.AddTrigger(trigger);
+ trigger = new Trigger(And(condGun4AnimRange, condLeft2Cmd), new List<ActionBase> { switchToDash, towardLeft });
+ gun4.AddTrigger(trigger);
+
m_AbilitySystem.ForceStart(idle);
}
diff --git a/Assets/Scripts/Test/SaionjiScript_Anim.cs b/Assets/Scripts/Test/SaionjiScript_Anim.cs index f7c29d3b..1b99ce35 100644 --- a/Assets/Scripts/Test/SaionjiScript_Anim.cs +++ b/Assets/Scripts/Test/SaionjiScript_Anim.cs @@ -15,10 +15,15 @@ public partial class SaionjiScript : MonoBehaviour int Anim_SideKick; int Anim_DashWithSword; int Anim_SuperKick; + int Anim_Gun1; + int Anim_Gun2; + int Anim_Gun3; + int Anim_Gun4; void GetAnimHash() { - Anim_Idle = Animator.StringToHash("Idle_Fight"); + Anim_Idle = Animator.StringToHash("Idle_Gun"); + //Anim_Idle = Animator.StringToHash("Idle_Fight"); Anim_Run = Animator.StringToHash("Run_Sword_Fast"); Anim_LightAttack1 = Animator.StringToHash("Light_Attk_1"); @@ -32,6 +37,11 @@ public partial class SaionjiScript : MonoBehaviour Anim_SuperKick = Animator.StringToHash("SuperKickCombo"); Anim_DashWithSword = Animator.StringToHash("Dash_With_Sword"); + + Anim_Gun1 = Animator.StringToHash("Gun01"); + Anim_Gun2 = Animator.StringToHash("Gun02"); + Anim_Gun3 = Animator.StringToHash("Gun03"); + Anim_Gun4 = Animator.StringToHash("Gun04"); } } |