示例#1
0
 public void MoveRight()
 {
     if (_MoveController != null)
     {
         _MoveController.TrunRight();
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (_MoveController == null)
        {
            return;
        }


        if (Input.GetKey(KeyCode.LeftShift))
        {
            if (Input.GetKey(KeyCode.W))
            {
                _MoveController.Forward();
            }
        }
        else
        {
            if (Input.GetKey(KeyCode.W))
            {
                _MoveController.RunForward();
            }
        }


        if (Input.GetKeyDown(KeyCode.W))
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                _MoveController.RunForward();
            }
            else
            {
                _MoveController.Forward();
            }
        }



        if (Input.GetKeyDown(KeyCode.S))
        {
            _MoveController.Backward();
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            _MoveController.TrunLeft();
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            _MoveController.TrunRight();
        }

        if (Input.GetKeyUp(KeyCode.W) ||
            Input.GetKeyUp(KeyCode.S))
        {
            _MoveController.StopMove();
        }

        if (Input.GetKeyUp(KeyCode.A) ||
            Input.GetKeyUp(KeyCode.D))
        {
            _MoveController.StopTrun();
        }
    }