// Update is called once per frame void Update() { if (controller.isGrounded && controller.velocity.magnitude > isWalkingThreshold && !isWalking) // si le joueur est sur le sol et a une vitesse supérieur au seuil { isWalking = true; // alors c'est qu'il marche stoppedWalking = false; startWalking = true; } else if (isWalking && (!controller.isGrounded || controller.velocity.magnitude < isWalkingThreshold)) // si le joueur était en train de marcher et qu'il n'est pas au sol, ou a une vitesse inférieur au seuil { isWalking = false; stoppedWalking = true; // alors c'est qu'il s'est arrêté de marcher } if (startWalking) { //print("start walking"); WwiseAudioManager.PlayLoopEvent("footsteps", this.gameObject); startWalking = false; } if (stoppedWalking) { stoppedWalking = false; //print("stopped walking"); WwiseAudioManager.StopLoopEvent("footsteps", this.gameObject); } }
void switchSounds() { //Tous les sons a switcher sont avec convolver for (int i = 0; i < playingObjects.Count; i++) { if (playingObjects[i].GetComponent <ConvolutionObject>() != null && playingObjects[i].GetComponent <InteractibleObject>().soundEvent != "") { //Stoppe son du convolver avec switch précédent WwiseAudioManager.StopLoopEvent(playingObjects[i].GetComponent <InteractibleObject>().soundEvent, playingObjects[i], true); //Lance switch du convolver WwiseAudioManager.PlayFiniteEvent(switchType + playingObjects[i].GetComponent <ConvolutionObject>().switchName, playingObjects[i]); //Lance son du convolver WwiseAudioManager.PlayLoopEvent(playingObjects[i].GetComponent <InteractibleObject>().soundEvent, playingObjects[i], true); } else if (playingObjects[i].GetComponentInChildren <AudioEventManager>() != null && playingObjects[i].GetComponentInChildren <AudioEventManager>().idleSound) { GameObject playingNPC = playingObjects[i]; //Stoppe son Idle (PNJ) playingNPC.GetComponentInChildren <AudioEventManager>().SounStopdIdle(); //play son Idle (PNJ) playingNPC.GetComponentInChildren <AudioEventManager>().SoundPlayIdle(); } } }
public void Start() { //appel du fragment WwiseAudioManager.PlayLoopEvent("fragment_call_" + family.ToString(), this.gameObject, false); if (desactivateOnStart) { this.gameObject.SetActive(false); } }
//Ramassage du fragment public GameObject OnTouch() { this.gameObject.SetActive(true); GetComponent <levitation>().enabled = true; GetComponent <levitation>().IsHeld(true); //stoppe appel WwiseAudioManager.StopLoopEvent("fragment_call_" + family.ToString(), this.gameObject, false); WwiseAudioManager.PlayFiniteEvent("prendre_morceau", gameObject); //lance convolution du fragment WwiseAudioManager.PlayLoopEvent(GetComponent <InteractibleObject>().soundEvent, gameObject); return(this.gameObject); }
/* * public void OnInteract(){ * print("Parent OnInteract"); * this.GetComponent<SettingPiece>().OnInteract(); * } */ public void OnAddingFragment(Fragment fragment) { if (this.GetComponent <Blend>() != null) { this.GetComponent <Blend>().enabled = false; } this.GetComponent <InteractibleObject> ().soundEvent = fragment.GetComponent <InteractibleObject> ().soundEvent; //fragment.transform.parent = this.transform; //print("SettingPiece:OnAddingFragment:" + GetComponent<InteractibleObject>().type); this.fragment = fragment; //activatedMaterial = fragment.material; this.GetComponentInChildren <Renderer>().material = fragment.material; //this.audioSource.clip = fragment.GetClip(); // this.audioEventName = fragment.audioEventName; //AkSoundEngine.SetRTPCValue ("binaural_to_convolver", 100); //fragment.Drop (); //AkSoundEngine.SetSwitch("Elements_decor", "Batiment_1", inHandObject.gameObject); SoundUniverseManager.addSoundEvent(this.gameObject); WwiseAudioManager.PlayFiniteEvent("linker_morceau", this.gameObject); WwiseAudioManager.PlayFiniteEvent(SoundUniverseManager.switchType + switchName, this.gameObject); WwiseAudioManager.PlayLoopEvent(fragment.GetComponent <InteractibleObject>().soundEvent, this.gameObject, true); WwiseAudioManager.PlayFiniteEvent("convolution_wet_to100", this.gameObject); if (GetComponent <InteractibleObject>().type == InteractibleType.NPC) { this.GetComponent <Musicien>().OnAddingFragment(fragment); GetComponentInChildren <AudioEventManager>().SoundRemovedIdle(); GetComponentInChildren <AudioEventManager>().idleSound = false; } }
//Quand le fragment est posé au sol public void Ground() { WwiseAudioManager.PlayFiniteEvent("lacher_morceau", gameObject); //relance appel du fragment WwiseAudioManager.PlayLoopEvent("fragment_call_" + family.ToString(), gameObject, false); }
/* * Sound events */ public void SoundPlayIdle() { WwiseAudioManager.PlayFiniteEvent(SoundUniverseManager.switchType + "_mood", this.transform.parent.gameObject); WwiseAudioManager.PlayLoopEvent(audioName.ToString() + "_idle", this.transform.parent.gameObject); }