/// <summary> /// 角色移动 /// </summary> void PlayerMove() { moveSpeed = isRunning ? runSpeed : walkSpeed; Vector3 output = SimpleTools.V3Rect2Round(new Vector3(_hMove, 0, _vMove)); _rigidbody.velocity = new Vector3(moveSpeed * output.x, _rigidbody.velocity.y, moveSpeed * output.z); }
private static bool init = false;//是否已经初始化 public static void Init() { if (!init) { init = true; _mSocket = new SocketControl(); _mMySql = new MySQL(); _mStools = new SimpleTools(); _mTaskTools = new TaskTools(); _mHttpServer = new HttpServerControl(); _mHttp = new HttpControl(); _mNDCControl = new NDCControl(); _mTaskControler = new TaskControler(); _mRunTask = new RunTask(); _mForAGVControl = new ForAGVControl(); _mNDCControl.NoticeWcsMagic += _mForAGVControl.SubmitAgvMagic; _mNDCControl.NoticeWcsOnLoad += _mForAGVControl.SubmitAgvLoading; _mForWmsControl = new ForWMSControl(); _mHttpServer.WmsModelAdd += _mForWmsControl.WriteTaskToWCS; } }
private void Update() { _hMove = Input.GetAxis("Horizontal"); _vMove = Input.GetAxis("Vertical"); SetMoveDir(); SetRun(); toRound = SimpleTools.V2Rect2Round(new Vector2(_hMove, _vMove)); dirMag = Mathf.Sqrt(toRound.x * toRound.x + toRound.y * toRound.y); SimpleMsgMechanism.SendMsg("PlayerMove", dirMag, isRunning); SetNormalAttack(); }