// method: set locomotions based on the given locomotion combination, optionally playing cycling audio // public static void setLocomotions(LocomotionCombination locomotionCombination, bool playAudio) { // first, disable all of the managed locomotions // foreach (GameObject locomotion in managedLocomotions) { if (locomotion) { locomotion.SetActive(false); } } // next, enable all of the locomotions in the given locomotion combination // foreach (GameObject locomotion in locomotionCombination.array) { if (locomotion) { locomotion.SetActive(true); } } // optionally play the locomotion cycling audio (on both hands, since this method is not hand specific) // if (playAudio) { left.audioComponent.PlayOneShot(left.audioComponent.clip); right.audioComponent.PlayOneShot(right.audioComponent.clip); } }
// method: set locomotions based on the given locomotion combination – optionally playing cycling audio – then disallow locomotion cycling // public static void setLocomotionsThenLock(LocomotionCombination locomotionCombination, bool playAudio) { // set locomotions // setLocomotions(locomotionCombination, playAudio); // disallow locomotion cycling // cyclingAllowed = false; }