diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Test/SaionjiScript.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Test/SaionjiScript.cs')
-rw-r--r-- | Assets/Scripts/Test/SaionjiScript.cs | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/Assets/Scripts/Test/SaionjiScript.cs b/Assets/Scripts/Test/SaionjiScript.cs deleted file mode 100644 index 1178b42a..00000000 --- a/Assets/Scripts/Test/SaionjiScript.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public partial class SaionjiScript : Avatar
-{
- public enum Weapon
- {
- Pistol,
- Blade,
- Reaper,
- LongSword,
- }
-
- HitBoxTest hitbox;
- Animator animator;
-
- public GameObject Go_PistolL;
- public GameObject Go_PistolR;
- public GameObject Go_Blade;
- public GameObject Go_Reaper;
- public GameObject Go_LongSword;
-
- [SerializeField]
- private Weapon m_Weapon;
-
- public bool EnableStateController;
-
- public EffectHandler[] Effects;
-
- void Start()
- {
- base.Init();
-
- animator = GetComponent<Animator>();
- //animator.speed = 0;
- PhysicsWorld.Instance.AddAnimator(animator);
-
- Go_PistolL.SetActive(m_Weapon == Weapon.Pistol);
- Go_PistolR.SetActive(m_Weapon == Weapon.Pistol);
- Go_Blade.SetActive(m_Weapon == Weapon.Blade);
- Go_Reaper.SetActive(m_Weapon == Weapon.Reaper);
- Go_LongSword.SetActive(m_Weapon == Weapon.LongSword);
-
- GetAnimHash();
-
- if (EnableStateController)
- SetupStates();
- }
-
- //private void Update()
- //{
- // //if (EnableStateController)
- // // m_StateController.OnUpdate();
- //}
-
- // 更新顺序:
- // internal animator update -> OnAnimatorMove() -> physics
- // 角色最后的位置以物理系统为准(如果加入物理系统的话)
- // 如果后续有物理处理,会重写transform
- // 对于后续不受物理管理的动作,不需要修改transform
- void OnAnimatorMove()
- {
- Animator animator = GetComponent<Animator>();
- if (animator == null)
- return;
-
- AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
-
- if(stateInfo.IsTag("IgnoreRootMotion"))
- {
- // ignore root motion
- //Debug.Log("ignore root motion ");
- }
- 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平面上
- Vector3 position = transform.position;
- position.x += animator.deltaPosition.x;
- position.y += animator.deltaPosition.y;
- transform.position = position;
-
- // animation clip导入设置旋转一般上设置为baked inpose,不需要手动限制
- transform.rotation *= animator.deltaRotation;
- }
- }
-
- public override void OnHit(HitInfo hitInfo)
- {
- base.OnHit(hitInfo);
- }
-
- public override void OnHurt(HurtInfo hurtInfo)
- {
- base.OnHurt(hurtInfo);
- }
-
-}
|