From 6118fbc482417cdd44f21748fc02b093a3e0ac7b Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 6 Nov 2020 09:31:54 +0800 Subject: *misc --- Assets/Scenes/Demo/SaionjiShowOff.unity | 93 +++++++++++++++++++++- Assets/Scripts/Avatar/Actions/ActionEffects.meta | 8 -- Assets/Scripts/Avatar/Conditions/ConditionInair.cs | 2 +- Assets/Scripts/Effects/AfterImage/AfterImage.cs | 8 +- Assets/Scripts/Props.meta | 8 -- Assets/Scripts/Test/SaionjiScript.cs | 10 ++- Assets/Scripts/Test/SaionjiScript_Ability.cs | 22 +++++ Assets/Scripts/Test/SaionjiScript_Anim.cs | 10 ++- 8 files changed, 135 insertions(+), 26 deletions(-) delete mode 100644 Assets/Scripts/Avatar/Actions/ActionEffects.meta delete mode 100644 Assets/Scripts/Props.meta (limited to 'Assets') diff --git a/Assets/Scenes/Demo/SaionjiShowOff.unity b/Assets/Scenes/Demo/SaionjiShowOff.unity index 6118ee23..8cc12b68 100644 --- a/Assets/Scenes/Demo/SaionjiShowOff.unity +++ b/Assets/Scenes/Demo/SaionjiShowOff.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 170076734} - m_IndirectSpecularColor: {r: 0.44092876, g: 0.4896468, b: 0.5697499, a: 1} + m_IndirectSpecularColor: {r: 0.44092834, g: 0.4896462, b: 0.5697487, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -513,6 +513,36 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &476164675 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 476164676} + m_Layer: 0 + m_Name: Root_VisualEffects + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &476164676 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 476164675} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &534669902 GameObject: m_ObjectHideFlags: 0 @@ -1038,7 +1068,7 @@ GameObject: m_Component: - component: {fileID: 861183510} m_Layer: 0 - m_Name: Characters + m_Name: Root_Characters m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1422,7 +1452,7 @@ GameObject: m_Component: - component: {fileID: 1189435618} m_Layer: 0 - m_Name: Enviroment + m_Name: Root_Enviroment m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1884,7 +1914,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &1737075741 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2045,6 +2075,31 @@ PrefabInstance: propertyPath: Name value: Saionji objectReference: {fileID: 0} + - target: {fileID: 3741668520236251693, guid: 83d445123a203b14298b7a7662a0a470, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: fb1a6b631853ec045bdfb595c327997c, type: 2} + - target: {fileID: 3741668520236251699, guid: 83d445123a203b14298b7a7662a0a470, + type: 3} + propertyPath: m_LocalPosition.x + value: 0.1096 + objectReference: {fileID: 0} + - target: {fileID: 3741668520236251699, guid: 83d445123a203b14298b7a7662a0a470, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.3989 + objectReference: {fileID: 0} + - target: {fileID: 3741668520236251699, guid: 83d445123a203b14298b7a7662a0a470, + type: 3} + propertyPath: m_LocalScale.z + value: 1.2822342 + objectReference: {fileID: 0} + - target: {fileID: 3741668520236251699, guid: 83d445123a203b14298b7a7662a0a470, + type: 3} + propertyPath: m_LocalScale.x + value: 0.019999998 + objectReference: {fileID: 0} - target: {fileID: 5505303514460593431, guid: 83d445123a203b14298b7a7662a0a470, type: 3} propertyPath: m_LocalPosition.x @@ -2211,6 +2266,26 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8191694612211005764, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8191694612211005764, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_ReceiveShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8204134728969198478, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8204134728969198478, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_ReceiveShadows + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8969987971784487432, guid: 2bc84022d3389104b84680ddf3faeeda, type: 3} propertyPath: m_Name @@ -2221,6 +2296,16 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 9150241180084094106, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9150241180084094106, guid: 2bc84022d3389104b84680ddf3faeeda, + type: 3} + propertyPath: m_ReceiveShadows + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2bc84022d3389104b84680ddf3faeeda, type: 3} --- !u!4 &9190676758873534539 stripped diff --git a/Assets/Scripts/Avatar/Actions/ActionEffects.meta b/Assets/Scripts/Avatar/Actions/ActionEffects.meta deleted file mode 100644 index 17a426dd..00000000 --- a/Assets/Scripts/Avatar/Actions/ActionEffects.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0b5ccfefc2e6b104a8566f4da9a16c5f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs index 2c631970..212e5172 100644 --- a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs +++ b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs @@ -16,6 +16,6 @@ public class ConditionInAir : ConditionBase public override bool Evaluate() { - return m_Prim.Bound.w > PhysicsWorld.Ground; + return m_Prim.IsInAir; } } diff --git a/Assets/Scripts/Effects/AfterImage/AfterImage.cs b/Assets/Scripts/Effects/AfterImage/AfterImage.cs index b63661df..445a16c2 100644 --- a/Assets/Scripts/Effects/AfterImage/AfterImage.cs +++ b/Assets/Scripts/Effects/AfterImage/AfterImage.cs @@ -47,9 +47,11 @@ public class AfterImage : MonoBehaviour foreach(var renderer in myRenderers) { for(int i = 0;i < renderer.materials.Length; ++i) - { - renderer.materials[i].SetColor("_Color", Color.red); - renderer.materials[i].SetFloat("_Intensity", intensity); + { + renderer.materials[i].SetColor("_Color", Color.red); + renderer.materials[i].SetColor("_Color1", Color.white); + renderer.materials[i].SetColor("_Color2", Color.white); + renderer.materials[i].SetFloat("_Intensity", intensity); renderer.materials[i].SetFloat("_MKGlowPower", intensity); } } diff --git a/Assets/Scripts/Props.meta b/Assets/Scripts/Props.meta deleted file mode 100644 index bb96602e..00000000 --- a/Assets/Scripts/Props.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f299520ed9fcf4a45858ad4ef5a8d5d1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: 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 { 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 { 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 { 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 { 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 { switchToDash, towardLeft }); gun4.AddTrigger(trigger); + // air dash + trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirDash), new List { new ActionSetVelocity(m_Body, Vector3.zero), new ActionUseGravity(m_Body), toJump }); + airDash.AddTrigger(trigger); + + trigger = new Trigger(new ConditionMotionAtEnd(animator, Anim_AirAttack1), new List { 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"); } } -- cgit v1.1-26-g67d0