public ControlStep GetControlStep() { var step = new ControlStep(); float h = CrossPlatformInputManager.GetAxis("Horizontal"); float v = CrossPlatformInputManager.GetAxis("Vertical"); bool crouch = Input.GetKey(KeyCode.C); if (_fire) { step.State = CharacterState.AIMING; step.Move = Vector2.zero; step.Crouch = false; step.Jump = false; } else { _cameraForward = Vector3.Scale(_cameraTransform.forward, new Vector3(1, 0, 1)).normalized; _move = v*_cameraForward + h*_cameraTransform.right; step.Crouch = crouch; step.Jump = _jump; step.Move = _move; } _jump = false; _fire = false; return step; }
private void mySP_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { byte[] readBuffer = new byte[mySP.ReadBufferSize]; mySP.Read(readBuffer, 0, readBuffer.Length); int i = 0; while (i < readBuffer.Length) { if (readBuffer[i] == (byte)0x00) { break; } if (getStart == false && readBuffer[i] == (byte)0xaa) { getStart = true; } else if (getStart == true) { getStart = false; if (readBuffer[i] == (byte)0x01) { _captureInProgress = true; delayTime = 0; isFound = false; //openCameraBtn.Text = "关闭摄像头"; myCS = ControlStep.Search; searchGlobe(); } else if (readBuffer[i] == (byte)0x02) { _captureInProgress = false; //openCameraBtn.Text = "打开摄像头"; } else if (readBuffer[i] == (byte)0xd0) { //红场水平 centre[0] = centreRedMid[0]; centre[1] = centreRedMid[1]; } else if (readBuffer[i] == (byte)0xd1) { centre[0] = centreRedTilt[0]; centre[1] = centreRedTilt[1]; } else if (readBuffer[i] == (byte)0xd2) { centre[0] = centreBlueMid[0]; centre[1] = centreBlueMid[1]; } else if (readBuffer[i] == (byte)0xd3) { centre[0] = centreBlueTilt[0]; centre[1] = centreBlueTilt[1]; } } i++; } }
public ControlStep GetControlStep() { var step = new ControlStep(); if (_buttonDown) { step.State = CharacterState.ATTACK; } else { _mouseLook.LookRotation (_characterTransform, _cameraTransform, out step.CharacterLocalRotation, out step.CameraLocalRotation); } _buttonDown = false; return step; }
public BasePlayerControlMessage(GameObject originObject, ControlStep controlStep = ControlStep.GENERAL) : base(originObject) { ControlStep = controlStep; }