// Use this for initialization void Start() { NameText.text = Variable.Name; throwingEffectEmission = ThrowingEffect.emission; BoxSpawnSound.Play(BoxAudioSource); hitSoundCooldown = 1; }
void Button3Click(object sender, EventArgs e) { MediaFile mediaFile = new SoundFile("resources\\track.wma"); mediaFile.Play(); System.Threading.Thread.Sleep(3000); mediaFile.Stop(); }
void OnCollisionEnter(Collision other) { if (other.gameObject.tag != "Player") { ThrowingEffect.Stop(); if (hitSoundCooldown < 0) { BoxHitSound.Play(BoxAudioSource); hitSoundCooldown = .1f; } } }
private void PlayWarningSound() { String soundFile = Properties.Settings.Default.Sound4CompletingBreak; if (soundFile != "") { try { SoundFile sound = new SoundFile(soundFile); sound.Play(); } catch (Exception ex) { log.Error("Could not play music!", ex); } } }
// Update is called once per frame void Update() { if (Time.timeScale == 0) { return; } rotationInput = Input.GetAxis("Mouse X"); horizontalInput = Input.GetAxis("Horizontal"); verticalInput = Input.GetAxis("Vertical"); if (Input.GetButtonDown("Jump") && IsGrounded()) // TODO: Check touches ground { rb.AddForce(transform.up * JumpForce, ForceMode.Impulse); JumpSound.Play(BotAudioSource); } }
private void AttractUsingLerp() { if (!isAttracting || currentlyPickedUp == null) { return; } if (isLerpingPosition) { // Move this to the correct position currentlyPickedUp.transform.position = Vector3.Lerp(currentlyPickedUp.transform.position, ForkLift.position, Time.deltaTime * PickupLerpSpeed); // Snap completely if close float epsilon = .1f; if ((currentlyPickedUp.transform.position - ForkLift.position).sqrMagnitude < epsilon) { BoxPickupEvent.Raise(); AttractedInPosition.Play(ForkLiftAudioSource); isLerpingPosition = false; } } else { currentlyPickedUp.transform.position = ForkLift.position; } if (isLerpingRotation) { currentlyPickedUp.transform.rotation = Quaternion.Slerp(currentlyPickedUp.transform.rotation, ForkLift.rotation, Time.deltaTime * PickupLerpSpeed); float angleEpsilon = 1f; if (Quaternion.Angle(currentlyPickedUp.transform.rotation, ForkLift.rotation) < angleEpsilon) { isLerpingRotation = false; } } else { currentlyPickedUp.transform.rotation = ForkLift.rotation; } }
public void OnInTraciSenseStop() { InTraciSenseEndSound.Play(BotAudioSource); }
public void OnInTraciSenseStart() { InTraciSenseStartSound.Play(BotAudioSource); }
// Update is called once per frame void Update() { if (Time.timeScale == 0) { return; } input = Input.GetAxis("Mouse Y"); var fire1AxisTrue = Input.GetAxis("Fire1") > 0; var fire1AxisDown = fire1AxisTrue && !fire1AxisTrueLastFrame; var fire1AxisUp = !fire1AxisTrue && fire1AxisTrueLastFrame; fire1AxisTrueLastFrame = fire1AxisTrue; if (Input.GetButtonDown("Fire1") || fire1AxisDown) { if (isAttracting) { if (currentlyPickedUp != null) { timeCharged = 0; isChargingPush = true; FullyChargedEffect.Play(); ChargingSound.Play(ForkLiftAudioSource); } else { isAttracting = false; } } else { SelectGameObjectToPickup(); if (isAttracting) { AttractSound.Play(ForkLiftAudioSource); } else { AttractFailedSound.Play(ForkLiftAudioSource); } // isAttracting = true; } } if (isChargingPush && (Input.GetButton("Fire1") || fire1AxisTrue)) // Charging... { timeCharged += Time.deltaTime; fullyChargedEmission.rateOverTime = 40 * Mathf.Clamp01(1 - (MaxChargeTime - timeCharged)) + 10; // FullyChargedEffect.emission = fullyChargedEmission; if (timeCharged >= MaxChargeTime && !fullyChargedSoundPlayed) { fullyChargedSoundPlayed = true; FullyChargedSound.Play(ForkLiftAudioSource); // FullyChargedEffect.SetActive(true); } } if (isChargingPush && (Input.GetButtonUp("Fire1") || fire1AxisUp)) // Actually pushing { if (currentlyPickedUp != null) { fullyChargedSoundPlayed = false; currentlyPickedUp.GetComponent <Rigidbody>().isKinematic = false; currentlyPickedUp.GetComponent <BoxCollider>().enabled = true; currentlyPickedUp.GetComponent <Box>().StartThrowing(Mathf.Clamp01(1 - (MaxChargeTime - timeCharged))); BoxThrowEvent.Raise(); if (timeCharged > .8f) { BoxLongThrowEvent.Raise(); } PushObjectAway(); currentlyPickedUp = null; FullyChargedEffect.Stop(); ForkLiftAudioSource.Stop(); ThrowSound.Play(ForkLiftAudioSource); } isAttracting = false; isChargingPush = false; } AttractUsingLerp(); }
public void OnWrongBoxPickedUp() { WrongBoxPickedUpSound.Play(ForkLiftAudioSource); }
public void OnIncinerate() { BoxIncinerateSound.Play(BoxAudioSource); }