Last active
August 29, 2015 14:01
-
-
Save DomDomHaas/c61d08bba0d75d84a4da to your computer and use it in GitHub Desktop.
MasterAudio get PlayListSource change pitch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private AudioSource playlistSource; | |
playlistCont = PlayListController.Instance; | |
playlistSource = playlistCont.CurrentPlaylistSource; | |
if (usePitchAddtion) { | |
checkAddPitch (); | |
} else { | |
checkPitchChange (); | |
} | |
private void checkAddPitch () | |
{ | |
float newPitch = this.pitchNormal; | |
if (!this.whiteSwarm.iAmDead && !this.blackSwarm.iAmDead) { | |
if (this.whiteSwarm.isInStream) { | |
if (this.whiteSwarm.hitOwnStream) { | |
newPitch += this.addOwnStream; | |
} else { | |
newPitch += this.addDmgStream; | |
} | |
} | |
if (this.blackSwarm.isInStream) { | |
if (this.blackSwarm.hitOwnStream) { | |
newPitch += this.addOwnStream; | |
} else { | |
newPitch += this.addDmgStream; | |
} | |
} | |
//Debug.Log (" newPitch: " + newPitch); | |
playlistSource.pitch = newPitch; | |
} | |
} | |
private void checkPitchChange () | |
{ | |
if (!this.whiteSwarm.iAmDead && !this.blackSwarm.iAmDead) { | |
bool whiteInWrongStream = (this.whiteSwarm.isInStream && !this.whiteSwarm.hitOwnStream); | |
bool blackInWrongStream = (this.blackSwarm.isInStream && !this.blackSwarm.hitOwnStream); | |
if (this.whiteSwarm.isInStream || this.blackSwarm.isInStream) { | |
if (whiteInWrongStream || blackInWrongStream) { | |
playlistSource.pitch = this.pitchDmgStream; | |
} else { | |
playlistSource.pitch = this.pitchOwnStream; | |
} | |
} else { | |
playlistSource.pitch = this.pitchNormal; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment