void Awake() { Instance = this; //init fields defaultClips = SongInfoMessenger.Instance.currentSong.defaultBeats; len = defaultClips.Length; savedClips = new AudioClip[len]; for (int i = 0; i < len; i++) { savedClips[i] = null; } //animations mainFlipDownAnimation = new RotationAnimation(); boardFlipUpAnimation = new RotationAnimation(); boardRecInnerAnimation = new ImageColorAnimation( boardMicInner, new Color(boardMicInner.color.r, boardMicInner.color.g, boardMicInner.color.b, 1f), boardMicInner.color, 0f //configure after the clip is recorded ); boardDefaultInnerAnimation = new ImageColorAnimation( boardDefaultInner, new Color(boardDefaultInner.color.r, boardDefaultInner.color.g, boardDefaultInner.color.b, 1f), boardDefaultInner.color, 0f //configure when the board is flipped ); //toggle event ToggleBar.toggledEvent += Toggled; //init mic Microphone.Start(null, false, 1, 44100); //iPhoneSpeaker.ForceToSpeaker(); Microphone.End(null); }
void Start() { //references of the components _audioSouce = GetComponent <AudioSource>(); _image = GetComponent <Image> (); //init original color slotColor = _image.color; transparentColor = new Color(0f, 0f, 0f, 0f); //init anim anim = new ImageColorAnimation( innerCircle, slotColor, transparentColor, 1f //will reset duration every time the coroutine starts ); //register to soundboard manager SoundboardManager.stateChangedEvent += StateChanged; //disable image when loading _image.enabled = false; }