/// <summary> /// Clones a sound /// </summary> OTSound Clone() { OTSound s = new OTSound(_name); s.Count(_count); s.Pan(_pan); s.Pitch(_pitch); s.Delay(_delay); s.Volume(_volume); s.Duration(_duration); s.FadeIn(fadeIn); s.FadeOut(fadeOut); return(s); }
private IEnumerator playResultAnimation(OTAnimatingSprite anim, string soundName) { //Debug.Log ("Started Playing"); anim.GetComponent<Renderer>().enabled = true; anim._numberOfPlays = 1; anim.Play(); OTSound sound = new OTSound(soundName); sound.Play(); //Debug.Log("Funcion delay"); yield return new WaitForSeconds(1f); //Debug.Log ("finished Playing"); anim.GetComponent<Renderer>().enabled = false; }
/// <summary> /// Plays the sound /// </summary> /// <param name='clone'> /// If true, a new sound instance (clone) is launched and played /// If flase, the current sound is played or stopped and re-played /// </param> public OTSound Play(bool clone) { if (clone) { OTSound s = Clone(); s.Play(false); return(s); } else { _boolMessage(MessageType.Destroy); InitSound(); return(this); } }
// Use this for initialization void Start () { GetComponent<OTAnimatingSprite>().PlayLoop("walkRight"); //ensure we have the right frameset queued GetComponent<OTAnimatingSprite>().Pauze(); (landSound = new OTSound("land")).Idle(); (jumpSound = new OTSound("jump")).Idle(); (pickupSound = new OTSound("pickup")).Idle(); allDialog.Add (new Dialog("The stars are dying! I have to save them!", Time.time + 2.5f, 2f)); allDialog.Add (new Dialog("Maybe if I climb that hill I can reach them.", Time.time + 5f, 2f)); nightTimeEnd = Camera.mainCamera.GetComponent<CameraController>().nightTime + Camera.mainCamera.GetComponent<CameraController>().start; Debug.Log ("night ending at " + nightTimeEnd + " currently " + Time.time); allDialog.Add (new Dialog("It's almost day time. I should get home.", nightTimeEnd - 4f, 2f)); }
void Start() { // Update with our default view then Orthello one if (Application.platform == RuntimePlatform.Android) { OT.view.camera.orthographicSize = 700; } else { OT.view.camera.orthographicSize = orthographicSize; } // Background music if (mainTheme != null) { themeClip = new OTSound(mainTheme); themeClip.Volume(themeVolume); themeClip.Loop(); } }
// Update is called once per frame void Update() { if (volume < 0) { volume = 0; } if (volume > 1) { volume = 1; } if (Application.isPlaying) { float vol = (mute)?0:volume; if (vol != AudioListener.volume) { AudioListener.volume = vol; } } int s = 0; while (s < sounds.Count) { OTSound sound = sounds[s]; if (!sound.ready) { continue; } if (sound.tick == 0) { // lets skip first tick so sound will be started on 2nd tick // and we have a tick to setup the sound sound.tick++; continue; } // lets start play the sound if no delay on this 2nd tick if (sound.tick == 1 && !sound._boolMessage(OTSound.MessageType.HasDelay)) { sound._boolMessage(OTSound.MessageType.Play); } sound.tick++; if (sound._boolMessage(OTSound.MessageType.HasDelay)) { sound._boolMessage(OTSound.MessageType.Wait, Time.deltaTime); if (!sound._boolMessage(OTSound.MessageType.HasDelay)) { sound._boolMessage(OTSound.MessageType.Play); } } else { sound._boolMessage(OTSound.MessageType.Playing, Time.deltaTime); if (!sound.isPlaying) { if (!sound._boolMessage(OTSound.MessageType.Repeat)) { sound._boolMessage(OTSound.MessageType.Destroy); continue; } } else { if (sound._boolMessage(OTSound.MessageType.Expired)) { sound._boolMessage(OTSound.MessageType.Destroy); continue; } } } s++; } }
/// <summary> /// Clones a sound /// </summary> OTSound Clone() { OTSound s = new OTSound(_name); s.Count(_count); s.Pan(_pan); s.Pitch(_pitch); s.Delay(_delay); s.Volume(_volume); s.Duration(_duration); s.FadeIn(fadeIn); s.FadeOut(fadeOut); return s; }
// Use this for initialization void Start() { over = new OTSound("menuMove"); over.Idle(); }
/// <summary> /// Play BGM sound. /// </summary> /// <param name="_delayTime"> Delay time </param> public void PlayBGM(float _delayTime = 0) { if (m_SoundLists.Add ("FGBGM")) { m_BGMSound = new OTSound("FGBGM").Play ().Delay(_delayTime).Loop(); } }
/// <summary> /// Use this for initialization /// </summary> void Start() { m_IsPlay = false; m_winSoundIndex = 1; m_SoundLists = new HashSet<string> (); m_WinSound = new OTSound ("LineWin1").Idle (); m_OtherSound = new OTSound ("").Idle (); m_WinTailSound = new OTSound ("LineWinTail").Idle(); //! used for time sections and amount sections //! for 0.5f, means t = 0.5f * duration, amount = TotalWin * 0.5f. m_AmountSection = new float[4] {0.4f, 0.25f, 0.25f, 0.1f }; m_SoundScetion = new float[4] {0.5f, 0.25f, 0.2f, 0.05f}; m_timePerSection = new float[3 ]; m_SpeedPerSection = new float[3]; m_SpeedFactor = new float[3] { 1.1f, 1.5f, 3f}; }
/// <summary> /// Win sound play when meter running, spining speed will reflected to sound length. /// </summary> /// <param name="_meterSpeed"> meter spining speed. </param> /// <param name="_delayTime"> delay time. </param> public void PlayWinSound(ref float _meterSpeed, float _delayTime = 0f) { if (GameVariables.Instance.IS_INCRESED) return; // Silence win sound in free game. if (GameVariables.Instance.IS_FREEGAME && FreeGame.Instance.FG_LEFT > 0) { int wS = ComputeWinMusicIndex (); string _name = "LineWin" + wS.ToString (); m_WinSound = new OTSound(_name).Play ().Delay(_delayTime); m_Duration = m_WinSound.GetSoundDuration(); m_WinSound.Stop(); _meterSpeed = WinManager.Instance.TOTALWIN / m_Duration; return; } //! update meter spped no matter the game is in main or free game. if(WinManager.Instance.Is_BigWin()) { string _name = "BigWin"; if(m_SoundLists.Add (_name)) { m_Timer = 0; m_WinSound = new OTSound(_name).Play ().Delay(_delayTime).Loop(); m_Duration = m_WinSound.GetSoundDuration() * 2; //GoldCoinEmitter.Instance.StartGoldCoinAnimation(); } m_Timer += Time.deltaTime; _meterSpeed = 50 * GameVariables.Instance.GetCreditPerLine(); if(m_Timer > m_Duration/2) _meterSpeed = AdjustSpeed (m_Timer, m_Duration); } else { //! Norma win sound case: int wS = ComputeWinMusicIndex (); string _name = "LineWin" + wS.ToString (); if(m_SoundLists.Add (_name)) { m_Timer = 0f; //! Play selected win sound and win tail. m_WinSound = new OTSound(_name).Play ().Delay(_delayTime); m_Duration = m_WinSound.GetSoundDuration(); if(wS >= 9 && wS <= 30) m_WinTailSound.Play ().Delay(m_Duration); } m_Timer += Time.deltaTime; _meterSpeed = WinManager.Instance.TOTALWIN / m_Duration; //AdjustSpeed (m_Timer, m_Duration); } if (m_Timer > m_Duration) GameVariables.Instance.IS_INCRESED = true; }
/// <summary> /// Play sound clip with given name. /// </summary> /// <param name="_name"> name of sound track. </param> /// <param name="_delayTime"> Time to delay. </param> public void PlaySound(string _name, float _delayTime = 0f) { //hash set 'Add' function return true if _name is successful add to contianer. // return false, if _name has already been in the contianer. if (m_SoundLists.Add (_name)) { if(_name == "Anticipation") m_OtherSound = new OTSound(_name).Play ().Delay(_delayTime).Loop(); else m_OtherSound = new OTSound(_name).Play ().Delay(_delayTime); } }
private void initValues() { this.currentLevel=1; this.timeLeft = true; this.card1 = null; this.card2 = null; this.remainingCards = 0; this.score = 0; this.errors = 0; this.correct = 0; this.currentLevel = 1; this.tableSize = 0; this.levelCards = new ArrayList(); this.winCard = new OTSound("winCard"); this.winCard.Idle(); this.left = false; this.globalTime = 0; ExitGame eg = (ExitGame)this.exitCross.GetComponent(typeof(ExitGame)); eg.setCore(this); }
// Trigger necessary and reset when unused void PageChange(int lastPage, int currentPage) { OT.Print("Current Page: " + currentPage); // Starting Part if (currentPage == 12) { SpriteMoveForward script = GameObject.Find("Page 12 Sprite").GetComponent <SpriteMoveForward>(); script.TriggerStart(); page12Clip = new OTSound("engine"); page12Clip.Play(); } else if (currentPage == 10) { Page10Logic logic = GameObject.Find("Page 10 Logic").GetComponent <Page10Logic>(); logic.TriggerStart(); } else if (currentPage == 18) { Page18Logic logic = GameObject.Find("Page 18 Logic").GetComponent <Page18Logic>(); logic.TriggerStart(); } else if (currentPage == 14) { Page14Logic logic = GameObject.Find("Page 14 Logic").GetComponent <Page14Logic>(); logic.TriggerStart(); } else if (currentPage == 20) { Page20Logic logic = GameObject.Find("Page 20 Logic").GetComponent <Page20Logic>(); logic.TriggerStart(); } else if (currentPage == 22) { Page22Logic logic = GameObject.Find("Page 22 Logic").GetComponent <Page22Logic>(); logic.TriggerStart(); } else if (currentPage == 24) { Page24Logic logic = GameObject.Find("Page 24 Logic").GetComponent <Page24Logic>(); logic.TriggerStart(); } else if (currentPage == 28) { Page28Logic logic = GameObject.Find("Page 28 Logic").GetComponent <Page28Logic>(); logic.TriggerStart(); } else if (currentPage == 6) { Page6Logic logic = GameObject.Find("Page 6 Logic").GetComponent <Page6Logic>(); logic.TriggerStart(); } else if (currentPage == 4) { Page5Logic logic = GameObject.Find("Page 5 Logic").GetComponent <Page5Logic>(); logic.TriggerStart(); } else if (currentPage == 16) { SpriteHighlightSequence logic = GameObject.Find("Page 16 Logic").GetComponent <SpriteHighlightSequence>(); logic.TriggerStart(); page16Clip = new OTSound("train"); page16Clip.Play(); } else if (currentPage == 30) { Page30Logic logic = GameObject.Find("Page 30 Logic").GetComponent <Page30Logic>(); logic.TriggerStart(); } else if (currentPage == 25) { //PuzzleCreate logic = GameObject.Find("Page 27 Logic").GetComponent<PuzzleCreate>(); //logic.TriggerStart(); } else if (currentPage == 8) { MatchingLogic logic = GameObject.Find("Matching Logic").GetComponent <MatchingLogic>(); logic.TriggerStart(); } else if (currentPage == 31) { Page33Logic logic = GameObject.Find("Page 33 Logic").GetComponent <Page33Logic>(); logic.TriggerStart(); } else if (currentPage == 19) { Page21Logic logic = GameObject.Find("Page 21 Logic").GetComponent <Page21Logic>(); logic.TriggerStart(); } else if (currentPage == 9) { if (_page9Dialogue != null) { if (_page9Dialogue.isPlaying) { _page9Dialogue.Stop(); } } _page9Dialogue = new OTSound("queen"); } else if (currentPage == 5) { page5Clip = new OTSound("garden"); page5Clip.Loop(); } else if (currentPage == 7) { page7Clip = new OTSound("raven-many"); page7Clip.Loop(); } // Reset Part if (lastPage == 12) { SpriteMoveForward script = GameObject.Find("Page 12 Sprite").GetComponent <SpriteMoveForward>(); script.Reset(); if (page12Clip != null) { page12Clip.Stop(); page12Clip = null; } } else if (lastPage == 10) { Page10Logic logic = GameObject.Find("Page 10 Logic").GetComponent <Page10Logic>(); logic.Reset(); } else if (lastPage == 16) { SpriteHighlightSequence logic = GameObject.Find("Page 16 Logic").GetComponent <SpriteHighlightSequence>(); logic.Reset(); if (page16Clip != null) { page16Clip.Stop(); page16Clip = null; } } else if (lastPage == 18) { Page18Logic logic = GameObject.Find("Page 18 Logic").GetComponent <Page18Logic>(); logic.Reset(); } else if (lastPage == 14) { Page14Logic logic = GameObject.Find("Page 14 Logic").GetComponent <Page14Logic>(); logic.Reset(); } else if (lastPage == 20) { Page20Logic logic = GameObject.Find("Page 20 Logic").GetComponent <Page20Logic>(); logic.Reset(); } else if (lastPage == 22) { Page22Logic logic = GameObject.Find("Page 22 Logic").GetComponent <Page22Logic>(); logic.Reset(); } else if (lastPage == 24) { Page24Logic logic = GameObject.Find("Page 24 Logic").GetComponent <Page24Logic>(); logic.Reset(); } else if (lastPage == 28) { Page28Logic logic = GameObject.Find("Page 28 Logic").GetComponent <Page28Logic>(); logic.Reset(); } else if (lastPage == 29) { Page31Logic logic = GameObject.Find("Page 31 Logic").GetComponent <Page31Logic>(); logic.Reset(); } else if (lastPage == 6) { Page6Logic logic = GameObject.Find("Page 6 Logic").GetComponent <Page6Logic>(); logic.Reset(); } else if (lastPage == 30) { Page30Logic logic = GameObject.Find("Page 30 Logic").GetComponent <Page30Logic>(); logic.Reset(); } else if (lastPage == 25) { PuzzleCreate logic = GameObject.Find("Page 27 Logic").GetComponent <PuzzleCreate>(); logic.Reset(); } else if (lastPage == 8) { MatchingLogic logic = GameObject.Find("Matching Logic").GetComponent <MatchingLogic>(); logic.Reset(); } else if (lastPage == 4) { Page5Logic logic = GameObject.Find("Page 5 Logic").GetComponent <Page5Logic>(); logic.Reset(); } else if (lastPage == 31) { Page33Logic logic = GameObject.Find("Page 33 Logic").GetComponent <Page33Logic>(); logic.Reset(); } else if (lastPage == 5) { if (page5Clip != null) { page5Clip.Stop(); page5Clip = null; } } else if (lastPage == 7) { if (page7Clip != null) { page7Clip.Stop(); page7Clip = null; } } PageButtonCheck(currentPage); }
void Awake() { observers = new ArrayList(); this.NotifyEvent += new NotifyHandler(notify); this.flip = new OTSound("flip"); //Sonido de giro de carta this.flip.Idle(); this.onBack = true; //La carta está tapada this.getDefaultAnim(); //Animación que tapa la carta this.getAtlas(); }
// Use this for initialization void Start() { back = new OTSound("menuMove"); back.Idle(); }