示例#1
0
    void Update()
    {
        if (!fired)
        {
            KeyMapper keyMapper = gameController.keyMapper;
            inputX = Input.GetAxis(keyMapper.GetHorizontalFire());
            inputX = Mathf.Abs(inputX) < Mathf.Epsilon ? 0f : Mathf.Sign(inputX);

            inputY = Input.GetAxis(keyMapper.GetVerticalFire());
            inputY = Mathf.Abs(inputY) < Mathf.Epsilon ? 0f : Mathf.Sign(inputY);

            input = new Vector2(inputX, inputY);
            input.Normalize();

            if (input != Vector2.zero)
            {
                Attack(input);
            }
        }
    }