diff options
Diffstat (limited to 'Assets/Scripts/Test')
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript.cs | 10 | ||||
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript_Ability.cs | 22 | ||||
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript_Anim.cs | 10 |
3 files changed, 40 insertions, 2 deletions
diff --git a/Assets/Scripts/Test/SaionjiScript.cs b/Assets/Scripts/Test/SaionjiScript.cs index 90e4a7e0..c9bb3f05 100644 --- a/Assets/Scripts/Test/SaionjiScript.cs +++ b/Assets/Scripts/Test/SaionjiScript.cs @@ -61,7 +61,15 @@ public partial class SaionjiScript : Avatar // ignore root motion
//Debug.Log("ignore root motion ");
}
- else
+ else if(stateInfo.IsTag("IgnoreRootMotionY"))
+ {
+ Vector3 position = transform.position;
+ position.x += animator.deltaPosition.x;
+ transform.position = position;
+
+ transform.rotation *= animator.deltaRotation;
+ }
+ else
{
// animator.deltaPosition和animator.deltaRotation是animator做的root motion后的结果
// 在后面做一个硬性约束z=0,将角色限制在z=0平面上
diff --git a/Assets/Scripts/Test/SaionjiScript_Ability.cs b/Assets/Scripts/Test/SaionjiScript_Ability.cs index d8233f56..665b787c 100644 --- a/Assets/Scripts/Test/SaionjiScript_Ability.cs +++ b/Assets/Scripts/Test/SaionjiScript_Ability.cs @@ -64,6 +64,8 @@ public partial class SaionjiScript : Avatar };
JumpAbility jump = new JumpAbility(jumpConfig);
+ AttackAbility airDash = new AttackAbility(animator, Anim_AirDash, m_Body);
+
AttackAbilityConfig config;
//招式会绑定一个motion
@@ -97,6 +99,8 @@ public partial class SaionjiScript : Avatar AttackAbility gun3 = new AttackAbility(animator, Anim_Gun3, m_Body);
AttackAbility gun4 = new AttackAbility(animator, Anim_Gun4, m_Body);
+ AttackAbility airAttk1 = new AttackAbility(animator, Anim_AirAttack1, m_Body);
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// actions
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -124,6 +128,9 @@ public partial class SaionjiScript : Avatar ActionSwitchAbility switchToGun3 = new ActionSwitchAbility(m_AbilitySystem, gun3);
ActionSwitchAbility switchToGun4 = new ActionSwitchAbility(m_AbilitySystem, gun4);
+ ActionSwitchAbility switchToAirDash = new ActionSwitchAbility(m_AbilitySystem, airDash);
+ ActionSwitchAbility switchToAirAttk1 = new ActionSwitchAbility(m_AbilitySystem, airAttk1);
+
ActionWipeCmdRecord wipeCmdRecord = new ActionWipeCmdRecord();
ActionEffectGhost enableGhost = new ActionEffectGhost(Effects[0] as CharacterGhostEffect);
@@ -154,6 +161,8 @@ public partial class SaionjiScript : Avatar ConditionJumpDone condJumpDone = new ConditionJumpDone(jump);
ConditionJumpOnGround condJumpOnGround = new ConditionJumpOnGround(jump);
+ ConditionInAir condInAir = new ConditionInAir(m_BodyCollider);
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// common triggers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -217,6 +226,12 @@ public partial class SaionjiScript : Avatar move.AddTrigger(trigger);
// jump ability
+ trigger = new Trigger(Ands(condInAir, condRightCmd, condRight2Cmd), new List<ActionBase> { towardRight, switchToAirDash, new ActionSetVelocity(m_Body, new Vector3(25, 0, 0)), new ActionDontUseGravity(m_Body) });
+ jump.AddTrigger(trigger);
+ trigger = new Trigger(Ands(condInAir, condLeftCmd, condLeft2Cmd), new List<ActionBase> { towardLeft, switchToAirDash, new ActionSetVelocity(m_Body, new Vector3(-25, 0, 0)), new ActionDontUseGravity(m_Body) });
+ jump.AddTrigger(trigger);
+ trigger = new Trigger(Ands(condInAir, condCircleCmd), new List<ActionBase> { switchToAirAttk1, new ActionSetLocalVelocity(m_Body, new Vector3(0, 0, 0)), new ActionDontUseGravity(m_Body)});
+ jump.AddTrigger(trigger);
ConditionCheckJumpState condCheckJump = new ConditionCheckJumpState(jump, JumpAbility.State.None, JumpAbility.Direction.Neutral);
trigger = new Trigger(And(condRightButtonHold, condCheckJump), new List<ActionBase> { towardRight, new ActionSetVelocityX(m_Body, 4)}, TriggerOnlyOnce.Off, TriggerSwallow.Off);
jump.AddTrigger(trigger);
@@ -361,6 +376,13 @@ public partial class SaionjiScript : Avatar trigger = new Trigger(And(condGun4MotionRange, condLeft2Cmd), new List<ActionBase> { switchToDash, towardLeft });
gun4.AddTrigger(trigger);
+ // air dash
+ trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirDash), new List<ActionBase> { new ActionSetVelocity(m_Body, Vector3.zero), new ActionUseGravity(m_Body), toJump });
+ airDash.AddTrigger(trigger);
+
+ trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirAttack1), new List<ActionBase> { new ActionSetVelocity(m_Body, Vector3.zero), new ActionUseGravity(m_Body), toJump });
+ airAttk1.AddTrigger(trigger);
+
m_AbilitySystem.ForceStart(idle);
}
diff --git a/Assets/Scripts/Test/SaionjiScript_Anim.cs b/Assets/Scripts/Test/SaionjiScript_Anim.cs index 023d5d39..f5543823 100644 --- a/Assets/Scripts/Test/SaionjiScript_Anim.cs +++ b/Assets/Scripts/Test/SaionjiScript_Anim.cs @@ -27,11 +27,16 @@ public partial class SaionjiScript : Avatar int Anim_JumpDown;
int Anim_JumpEnd; + int Anim_AirDash; + int Anim_AirAttack1; + void GetAnimHash() { //Anim_Idle = Animator.StringToHash("Idle_Gun"); //Anim_Idle = Animator.StringToHash("Idle_Fight"); - Anim_Idle = Animator.StringToHash("Idle_Fight2"); + //Anim_Idle = Animator.StringToHash("Idle_Fight2"); + Anim_Idle = Animator.StringToHash("Idle_Relax"); + Anim_Idle = Animator.StringToHash("Idle_Stand"); Anim_Run = Animator.StringToHash("Run_Sword_Fast"); Anim_LightAttack1 = Animator.StringToHash("Light_Attk_1"); @@ -56,6 +61,9 @@ public partial class SaionjiScript : Avatar Anim_JumpUp = Animator.StringToHash("Jump_Up"); Anim_JumpDown = Animator.StringToHash("Jump_Down"); Anim_JumpEnd = Animator.StringToHash("Jump_End"); + + Anim_AirDash = Animator.StringToHash("Air_Dash"); + Anim_AirAttack1 = Animator.StringToHash("Air_Attk_1"); } } |