コード例 #1
0
    void Update()
    {
        if (!IsFreeze)
        {
            //INPUT
            velocity.x = Input.GetAxisRaw("Horizontal");
            velocity.y = Input.GetAxisRaw("Vertical");

            /*animator.SetFloat("Horizontal", velocity.x);
            animator.SetFloat("Vertical", velocity.y);
            animator.SetFloat("Speed", velocity.sqrMagnitude);*/

            /*if (Input.GetKeyDown(KeyCode.F))
                flashLight.SetActive(!flashLight.activeSelf);*/
            if (velocity.x > 0)
            {
                flashLight.SetDirection(FlashLight.Direction.Right);
                sr.flipX = false;
            }
            else if (velocity.x < 0)
            {
                flashLight.SetDirection(FlashLight.Direction.Left);
                sr.flipX = true;
            }
            animator.SetBool("Walking", Math.Abs(velocity.x) + Math.Abs(velocity.y) != 0);
        }
    }