Skip to content

Commit

Permalink
Add error investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
kochounoyume committed Jul 4, 2024
1 parent cdb7baa commit 6b133f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Packages/PlayerControl/Runtime/MobilePlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,52 @@ 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<int> avoidTouchIds = (uiView.Joystick.IsUsing, uiView.SprintButton.IsUsing) switch
{
(true, true) => stackalloc int[] { uiView.Joystick.TouchId, uiView.SprintButton.TouchId },
(true, false) => stackalloc int[] { uiView.Joystick.TouchId },
(false, true) => stackalloc int[] { uiView.SprintButton.TouchId },
_ => ReadOnlySpan<int>.Empty
};
Debug.Log("88");
if (activeTouches.Count <= avoidTouchIds.Length) return;
Debug.Log("90 おそらくここまで到達しない;指を画面に触れてないから");
Touch activeTouch = default;
foreach (Touch touch in activeTouches)
{
Expand Down
12 changes: 12 additions & 0 deletions Packages/PlayerControl/Runtime/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,33 @@ protected Quaternion WorldRotation

protected virtual void Start()
{
Debug.Log("110");
transform = GetComponent<ITransform>();
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)
Expand Down

0 comments on commit 6b133f2

Please sign in to comment.