[3D Parkour] Audiomanager

Source: Internet
Author: User


Welcome to Unity Learning,Unity training ,UnityEnterprise TrainingEducation Area, there are manyu3d Resources,u3d Training Video,u3d Tutorials,U3d Frequently Asked questions,u3d Project Source code, the "Dog Planing Learning Network" Unity's Ultimate Academy, dedicated to building the industry unity3d Training , learning the first brand.
The most common components of sound management in the game are Audiosource and AudioClip, and my approach is to build a Audiomanager class (singleton) to manage each audio and talk about my experience:
  

  

  

Start () function: Sets the overall audio parameters;
Inspector panel: Drag-and-drop file assignment
View related APIs
Main logic:
 
Public
void Playsoundeffect (Soundeffects soundeffect)
{
AudioClip clip = null;
float pitch = 1;
Switch (soundeffect) {
Case Soundeffects.obstaclecollisionsoundeffect:
Clip = obstaclecollision;
Break
Case Soundeffects.coinsoundeffect:
Clip = coincollection;
Pitch = 1.5f;
Break
Case Soundeffects.powerupsoundeffect:
Clip = powerupcollection;
Break
Case Soundeffects.gameoversoundeffect:
Clip = Gameover;
Break
Case Soundeffects.guitapsoundeffect:
Clip = Guitap;
Break
}
Soundeffectsaudio.pitch = pitch;//Tone
Soundeffectsaudio.clip = clip;//
Soundeffectsaudio.play ();
}
For more information, please visit the "Dog Planing Learning Network" Unity Ultimate Academy Http://edu.gopedu.com


Statement: This document comes from the "Dog Planing Learning Network" Community-unity Extreme College, is a self-published Unity3d study articles, if anything violates your relevant interests, please communicate with the official, we will deal with the real-time.



[3D Parkour] Audiomanager

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.