コード例 #1
0
        private void Update()
        {
            if (interactable.attachedToHand)
            {
                hand = interactable.attachedToHand.handType;
                Vector2 m = a_move.GetAxis(hand);
                movement = new Vector3(m.x, 0, m.y);

                jump = a_jump.GetStateDown(hand);
                glow = Mathf.Lerp(glow, a_jump.GetState(hand) ? 1.5f : 1.0f, Time.deltaTime * 20);
            }
            else
            {
                movement = Vector2.zero;
                jump     = false;
                glow     = 0;
            }

            Joystick.localPosition = movement * joyMove;

            float rot = transform.eulerAngles.y;

            movement = Quaternion.AngleAxis(rot, Vector3.up) * movement;

            jumpHighlight.sharedMaterial.SetColor("_EmissionColor", Color.white * glow);

            character.Move(movement * 2, jump);
        }
コード例 #2
0
        private void Update()
        {
            // if (interactable.attachedToHand)
            // {
            //     hand = interactable.attachedToHand.handType;
            //     Vector2 m = moveAction[hand].axis;
            //     movement = new Vector3(m.x, 0, m.y);

            //     jump = jumpAction[hand].stateDown;
            //     glow = Mathf.Lerp(glow, jumpAction[hand].state ? 1.5f : 1.0f, Time.deltaTime * 20);
            // }
            // else
            // {
            //     movement = Vector2.zero;
            //     jump = false;
            //     glow = 0;
            // }

            Joystick.localPosition = movement * joyMove;

            float rot = transform.eulerAngles.y;

            movement = Quaternion.AngleAxis(rot, Vector3.up) * movement;

            jumpHighlight.sharedMaterial.SetColor("_EmissionColor", Color.white * glow);

            character.Move(movement * 2, jump);
        }