/// <summary>Writes a <see cref="Vibration"/> structure to a stream.</summary> /// <param name="writer">The writer; must not be null.</param> /// <param name="vibration">A <see cref="Vibration"/> structure.</param> public static void Write( this BinaryWriter writer, Vibration vibration ) { if( writer == null ) throw new ArgumentNullException( "writer" ); writer.Write( vibration.leftMotorSpeed ); writer.Write( vibration.rightMotorSpeed ); }
public ExportAndImportViewModel(Factories factories, CloudProviderFactory cloudProviderFactory, Vibration vibration, Cloud cloud, MessageDialog messageDialog, CloudMessages cloudMessages, BackgroundWorkerFactory workerFactory) { this.factories = factories; exportAndImport = new ExportAndImportImpl(factories); this.cloudProviderFactory = cloudProviderFactory; this.vibration = vibration; this.cloud = cloud; this.messageDialog = messageDialog; this.cloudMessages = cloudMessages; this.workerFactory = workerFactory; }
public void TestInitialize() { factories = Substitute.For<Factories>(); cloudProviderFactory = Substitute.For<CloudProviderFactory>(); cloudProvider = Substitute.For<CloudProvider>(); cloudProviderFactory.Create().Returns(cloudProvider); settings = new Settings(); factories.Settings.Returns(settings); vibration = Substitute.For<Vibration>(); cloud = Substitute.For<Cloud>(); messageDialog = Substitute.For<MessageDialog>(); cloudMessages = new Fixture().Create<CloudMessages>(); workerFactory = new BackgroundWorkerSyncFactory(); sut = new ExportAndImportViewModel(factories, cloudProviderFactory, vibration, cloud, messageDialog, cloudMessages, workerFactory); cloudProvider.GetAcquiredToken().Returns(new CloudToken { Secret = "foo", Token = "bar" }); cloudProvider.GetTokenAcquiringUrl(ExportAndImportViewModel.TOKEN_ACQUIRING_CALLBACK_URL).Returns("go"); cloud.ListImports().Returns(new List<string>()); navigatedTo = string.Empty; sut.NavigateInBrowser += (_, url) => { navigatedTo = url; }; }
void Start() { vibration = objectToVibrate.GetComponent<Vibration>(); }
public override void Reset() { vibration = null; milliseconds = new FsmInt { UseVariable = false, Value = 1000 }; }
public ControllerX() { this.userIndex = new UserIndex(); //trzeba dać wyjątki gdy nie podłączony żaden pad :D // foreach (var deviceInstance in SlimDX.XInput.get.GetDevices(SlimDX.DirectInput.DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices)) // this.joystickGuid = deviceInstance.InstanceGuid; this.joystick = new SlimDX.XInput.Controller(userIndex); this.vibration = new Vibration(); }
public void VibrateController( int a_iIndex , float a_iAmount , float fTime) { GamePad.SetVibration( (PlayerIndex)a_iIndex , a_iAmount , a_iAmount); Vibration v = new Vibration(); v.index = a_iIndex; v.fTimeToStop = Time.timeSinceLevelLoad + fTime; lVibrations.Add(v); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); DTE2 dte = GetService(typeof(DTE)) as DTE2; if (dte != null) { Events = dte.Events.DebuggerEvents; } mResetVibration = new Vibration(); mResetVibration.LeftMotorSpeed = 0; mResetVibration.RightMotorSpeed = 0; }
public sealed override bool SetVibration( Vibration vibration ) { if( base.Disabled || !( capabilities.HasLeftMotor || capabilities.HasRightMotor ) ) return false; var errorCode = SafeNativeMethods.XInputSetState( base.Index, ref vibration ); if( errorCode == (int)ErrorCode.NotConnected ) base.IsDisconnected = true; return errorCode == 0; }
/// <summary> /// Lance une salve /// </summary> /// <param name="salvo">Salve à lancer</param> public void Shoot(Salvo salvo) { currentTimeBeforeNextSalvo = currentShootParameters.GetTimeBewteenSalvos; currentShootParameters.IncreaseSalvoIndex(); shootedPositions = new List <List <Vector3> >(); #region Calculate Directions PoolingManager poolManager = GameManager.gameManager.PoolManager; Projectile shootProjectilePrefab = poolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.PeekFromPool); bool isBoulder = shootProjectilePrefab.IsBoulder; List <Vector3> allShootDirections = isBoulder ? GetAllShootPositions(salvo) : GetAllShootDirections(salvo); float projectilesSpacing = salvo.GetProjectilesSpacing; foreach (Vector3 direction in allShootDirections) { List <Vector3> thisShootedPos = new List <Vector3>(); /**/ List <Vector3> allPossiblePositions = CirclePositionsGenerator.GetAllPositionsInCircle(salvo.GetProjectileParameters.GetCurrentProjectileSize, projectilesSpacing, salvo.GetImprecisionParameter); for (int i = 0; i < salvo.GetNumberOfProjectiles; i++) { Projectile shootProjectile = poolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.GetFromPool); shootProjectile.transform.position = transform.position; shootProjectile.transform.rotation = Quaternion.identity; if (relatedShip != null) { shootProjectile.SetSource(relatedShip); } else if (relatedTurret != null) { shootProjectile.SetSource(relatedTurret); } if (isBoulder) { //List<Vector3> allPossiblePositions //Vector3 modifiedPosition = direction + new Vector3(Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter), 0, Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter)); /**/ int randomIndex = Random.Range(0, allPossiblePositions.Count); Vector3 modifiedPosition = direction + allPossiblePositions[randomIndex] + new Vector3(Random.Range(-projectilesSpacing / 2, projectilesSpacing / 2), 0, Random.Range(-projectilesSpacing / 2, projectilesSpacing / 2)); allPossiblePositions.RemoveAt(randomIndex); /**/ shootProjectile.ShootProjectile(salvo.GetProjectileParameters, transform.position, modifiedPosition); thisShootedPos.Add(modifiedPosition); } else { Vector3 modifiedDirection = Quaternion.Euler(0, Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter), 0) * direction; shootProjectile.ShootProjectile(salvo.GetProjectileParameters, modifiedDirection, GameManager.gameManager.Player.GetShipVelocity); } shootProjectile.SetProjectileTag(currentShootParameters.GetProjectileTag); #region Special Parameters if (projectileSpecialParameters != null) { shootProjectile.SetProjectileSpecialParameters( new ProjectileSpecialParameters( new ShipSpeedModifier(projectileSpecialParameters.GetSpeedModifier), new ProjectilePiercingParameters(projectileSpecialParameters.GetPiercingParameters), new ProjectileSkeweringParameters(projectileSpecialParameters.GetSkeweringParameters), projectileSpecialParameters.GetExplosionParameters, new SmokeZoneParameters(projectileSpecialParameters.GetSmokeZoneParameters), new SlowingZoneParameters(projectileSpecialParameters.GetSlowingZoneParameters) )); shootProjectile.GetProjectileSpecialParameters.GetSkeweringParameters.SetSourceProjectile(shootProjectile); } #endregion if (allPossiblePositions.Count == 0 && isBoulder) { Debug.LogWarning("couldn't shoot all boulders"); break; } } shootedPositions.Add(thisShootedPos); } #endregion #region Feedback if (shootParticleSystem != null) { //ParticleSystem.EmitParams parameters = shootParticleSystem.emission.; //if (shootParticleSystem.isPlaying) //{ //Debug.Log("ui"); //shootParticleSystem.Stop(); //shootParticleSystem.Play(); //shootParticleSystem.Emit(8); //waitingTimeToRelaunchShootEffect = 0.05f; /*} * else * shootParticleSystem.Play();*/ shootParticleSystem.Emit(2); } if (currentShootParameters.GetProjectileTag == AttackTag.Player) { Vibration.Vibrate(shootVibrationDuration); GameManager.gameManager.ScrshkManager.StartScreenshake(shootShakeParameters); } if (shootAudioSource != null) { shootAudioSource.PlaySound(currentShootParameters.GetShootSound); } #endregion if (currentShootParameters.GetCurrentSalvoIndex > 1) { ContinueLaunchedPreview(salvo); } }
public async void InputPinMethod(string value) { WarningText = ""; WarningVisible = false; if (value == "Delete") { if (pin.Length > 0) { pin = pin.Remove(pin.Length - 1); int countPin = pin.Length; HintColorChange(countPin); } } else { bool isExistvalue = Unities.CheckDigitaAndLength(value, 1); if (!isExistvalue) { WarningText = "ค่าที่ใส่ไม่ใช่ตัวเลข"; WarningVisible = true; try { Vibration.Vibrate(); var duration = TimeSpan.FromSeconds(1); Vibration.Vibrate(duration); } catch (FeatureNotSupportedException ex) { } catch (Exception ex) { } } pin += value; int countPin = pin.Length; HintColorChange(countPin); if (countPin == 6) { if (lastPage == Status.LastPage.Login) { if (repeatPin == "") { ChangeDataJoint(); } else { if (pin == repeatPin) { await Login(); } else { pin = ""; countPin = pin.Length; HintColorChange(countPin); WarningText = "รหัสผ่านทั้ง 2 ครั้งไม่ตรงกัน"; WarningVisible = true; try { Vibration.Vibrate(); var duration = TimeSpan.FromSeconds(1); Vibration.Vibrate(duration); } catch (FeatureNotSupportedException ex) { } catch (Exception ex) { } } } } else if (lastPage == Status.LastPage.Register) { if (repeatPin == "") { ChangeDataJoint(); } else { if (pin == repeatPin) { register.Pin = pin; await Register(); } else { pin = ""; countPin = pin.Length; HintColorChange(countPin); WarningText = "รหัสผ่านทั้ง 2 ครั้งไม่ตรงกัน"; WarningVisible = true; try { Vibration.Vibrate(); var duration = TimeSpan.FromSeconds(1); Vibration.Vibrate(duration); } catch (FeatureNotSupportedException ex) { } catch (Exception ex) { } } } } else { await Application.Current.MainPage.Navigation.PopToRootAsync(); } } if (countPin > 6) { pin = pin.Substring(0, 5); } } }
public void Vibrate(int duration) { Vibration.Vibrate(duration * 100); }
private async Task <bool> GetItems() { if (Connectivity.NetworkAccess == NetworkAccess.Internet) { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "DocumentSQLConnection"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { await GetAllHeaders(); if (CompleteNums.Count == 0) { await DisplayAlert("Done", "There are no futher outstanding orders to complete!", "OK"); await Navigation.PopAsync(); return(false); } foreach (string strNum in CompleteNums) { string str = $"GET?qry=SELECT * FROM tblTempDocLines WHERE DocNum='" + strNum + "'"; var Request = new RestSharp.RestRequest(); Request.Resource = str; Request.Method = RestSharp.Method.GET; var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.Content.ToString().Contains("DocNum")) { DataSet myds = new DataSet(); myds = Newtonsoft.Json.JsonConvert.DeserializeObject <DataSet>(res.Content); foreach (DataRow row in myds.Tables[0].Rows) { try { var Doc = new DocLine(); Doc.DocNum = row["DocNum"].ToString(); Doc.SupplierCode = row["SupplierCode"].ToString(); Doc.SupplierName = row["SupplierName"].ToString(); Doc.ItemBarcode = row["ItemBarcode"].ToString(); Doc.ItemCode = row["ItemCode"].ToString(); Doc.ItemDesc = row["ItemDesc"].ToString(); Doc.Bin = row["Bin"].ToString(); try { Doc.ScanAccQty = Convert.ToInt32(row["ScanAccQty"].ToString().Trim()); } catch { Doc.ScanAccQty = 0; } Doc.ScanRejQty = 0; try { Doc.PalletNum = Convert.ToInt32(row["PalletNumber"].ToString().Trim()); } catch { Doc.PalletNum = 0; } try { Doc.Balacnce = Convert.ToInt32(row["Balacnce"].ToString().Trim()); } catch { Doc.Balacnce = 0; } if (Convert.ToInt32(Doc.Balacnce) == -1) { Doc.Balacnce = 0; } Doc.ItemQty = Convert.ToInt32(row["ItemQty"].ToString().Trim()); await GoodsRecieveingApp.App.Database.Insert(Doc); } catch (Exception ex) { LodingIndiactor.IsVisible = false; Vibration.Vibrate(); message.DisplayMessage("Error In Server!!" + ex, true); return(false); } } } } } PopData(); } return(false); }
static extern uint XInputSetStateEx(int playerIndex, ref Vibration pVibration);
private void VibrateButton_Clicked(object sender, EventArgs e) { var duration = TimeSpan.FromSeconds(1); Vibration.Vibrate(duration); }
public void ToggleSmoothCameraScript() { smoothArCameraScript.smoothEnabled = !smoothArCameraScript.smoothEnabled; Vibration.Vibrate(20); }