From 6b133f26256102899ddc900e6d924f751230a921 Mon Sep 17 00:00:00 2001 From: Kochoyume <78918084+kochounoyume@users.noreply.github.com> Date: Thu, 4 Jul 2024 23:29:42 +0900 Subject: [PATCH] Add error investigation --- .../PlayerControl/Runtime/MobilePlayerController.cs | 11 +++++++++++ Packages/PlayerControl/Runtime/PlayerController.cs | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Packages/PlayerControl/Runtime/MobilePlayerController.cs b/Packages/PlayerControl/Runtime/MobilePlayerController.cs index 4490e6d..67d46a7 100644 --- a/Packages/PlayerControl/Runtime/MobilePlayerController.cs +++ b/Packages/PlayerControl/Runtime/MobilePlayerController.cs @@ -42,33 +42,42 @@ public class MobilePlayerController : PlayerController protected override void Start() { + Debug.Log("45"); base.Start(); + Debug.Log("47"); uiView.Joystick.OnValueChanged += value => { const InputActionPhase phase = InputActionPhase.Performed; base.OnActionTriggered(new CallbackContext(Move, phase, value)); }; + Debug.Log("53"); uiView.SprintButton.OnStart += () => { const InputActionPhase phase = InputActionPhase.Performed; base.OnActionTriggered(new CallbackContext(Sprint, phase)); }; + Debug.Log("59"); uiView.SprintButton.OnRelease += () => { const InputActionPhase phase = InputActionPhase.Canceled; base.OnActionTriggered(new CallbackContext(Sprint, phase)); }; + Debug.Log("65"); uiView.JumpButton.onClick.AddListener(() => { const InputActionPhase phase = InputActionPhase.Started; base.OnActionTriggered(new CallbackContext(Jump, phase)); }); + Debug.Log("71"); } protected override void Update() { + Debug.Log("76"); base.Update(); + Debug.Log("78"); var activeTouches = Touch.activeTouches; + Debug.Log("80"); ReadOnlySpan avoidTouchIds = (uiView.Joystick.IsUsing, uiView.SprintButton.IsUsing) switch { (true, true) => stackalloc int[] { uiView.Joystick.TouchId, uiView.SprintButton.TouchId }, @@ -76,7 +85,9 @@ protected override void Update() (false, true) => stackalloc int[] { uiView.SprintButton.TouchId }, _ => ReadOnlySpan.Empty }; + Debug.Log("88"); if (activeTouches.Count <= avoidTouchIds.Length) return; + Debug.Log("90 おそらくここまで到達しない;指を画面に触れてないから"); Touch activeTouch = default; foreach (Touch touch in activeTouches) { diff --git a/Packages/PlayerControl/Runtime/PlayerController.cs b/Packages/PlayerControl/Runtime/PlayerController.cs index e0a73e9..62ee9f3 100644 --- a/Packages/PlayerControl/Runtime/PlayerController.cs +++ b/Packages/PlayerControl/Runtime/PlayerController.cs @@ -107,21 +107,33 @@ protected Quaternion WorldRotation protected virtual void Start() { + Debug.Log("110"); transform = GetComponent(); + Debug.Log("112"); constants = new AnimHashConstants(); + Debug.Log("114"); PlayerInput.onActionTriggered += context => OnActionTriggered(context); + Debug.Log("116"); JumpControl.OnJump.AddListener(OnJump); + Debug.Log("118"); } protected virtual void Update() { + Debug.Log("123"); Animator.SetFloat(constants.Speed, CurrentSpeed); + Debug.Log("125"); Animator.SetBool(constants.IsGround, IsOnGround); + Debug.Log("127"); Vector3 currentDirection = LocalDirection; + Debug.Log("130"); float deltaTime = Time.deltaTime; + Debug.Log("132"); Animator.SetFloat(constants.Forward, currentDirection.z, MoveDampTime, deltaTime); + Debug.Log("134"); Animator.SetFloat(constants.SideStep, currentDirection.x, MoveDampTime, deltaTime); + Debug.Log("136"); } protected virtual void OnActionTriggered(in CallbackContext context)