public static void ChangeMusic(AudioCode audioCode) { Log("Change Music: " + audioCode); var clip = Setting.audioMap[audioCode]; if (musicSource == null) { musicSource = TheMatrix.Instance.GetComponent <AudioSource>(); } if (audioCode == AudioCode.None) { musicSource.Stop(); return; } if (musicSource.isPlaying && musicSource.clip == clip) { return; } musicSource.clip = clip; musicSource.Play(); }
public CodeData CreateCodeData(TextCovertedData data, EventCodeScriptable scr) { if (data == null) { return(new EndCode()); } if (CheckChain(data)) { return(this); } CodeData result = null; switch (data._head) { case "": case "name": //name[name] result = new TextData(data); break; case "branch": //branch \nbranchName \n $#1... result = new BranchCode(data); break; case "flag": //flag[flagName] 5 result = new FlagCode(data); break; case "item": //item[itemName] 1 result = new ItemCode(data); break; case "map": //map[mapName] result = new MapCode(data); break; case "image": //image[setName,num] back (center) result = new ImageCode(data); break; case "music": //music[setName,0] result = new AudioCode(data); break; case "battle": //battle[enemySetName] result = new BattleCode(data); break; case "load": //load[black] 500 result = new LoadCode(data); break; case "wait": //wait[500] result = new WaitCode(data); break; default: return(null); } result._targetScr = scr; return(result); }