// 添加背景音乐播放 public override void play(System.String clipName, callback method = null) { if (audioPlayers.Count <= 0 || clips.Count <= 0) { return; } float maxTime = -1; AudioSource player = _atom; switch (clipName) { case "": player.clip = null; return; } AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime); AudioPlayCtrl.getInstance().addBackgroundObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToBackgroundClip(clipName, method); } }
public override void play(String clipName, callback method = null) { if (audioPlayers.Count <= 0 || clips.Count <= 0) { return; } float maxTime = -1; AudioSource player = _center; // specific clip data. switch 的传入判断值必须在运行时就已经是既定值,即 const 不能作为判断对象。 switch (clipName) { case PlayerAudioData.SWITCH_OBSTACLE_CLIP: player = _switch; break; default: break; } AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime); AudioPlayCtrl.getInstance().addEffectObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method); } }
private void init() { _curTime = 0; // 动态加载资源 if (!ResourcesSaveUtils.getInstance().isLoaded) { // 开启协程,异步执行数据内容(并不是异步) StartCoroutine(ResourcesSaveUtils.getInstance().loadSpriteResources()); } // init audio AudioPlayCtrl.init(audioManager); StartSceneAudioCtrl.init(audioManager); // repeat play audio GestureCtrl.getInstance().toLeftGesture = playSystemAudio; GestureCtrl.getInstance().toCenterGesture = makeSure; GestureCtrl.getInstance().toRightGesture = null; GestureCtrl.getInstance().toBackGesture = () => { changeChoice(false); }; GestureCtrl.getInstance().toFrontGesture = () => { changeChoice(true); }; bindingUIFeature(); GameManagerGlobalData.resetGameGlobalData(); }
private void switchGestureToPlot() { GestureCtrl.getInstance().toCenterGesture = AudioPlayCtrl.getInstance().stopEffect; GestureCtrl.getInstance().toLeftGesture = null; GestureCtrl.getInstance().toRightGesture = null; GestureCtrl.getInstance().toFrontGesture = null; GestureCtrl.getInstance().toBackGesture = null; }
// Use this for initialization void Start() { CanvasCtrl.adjustCanvasScale(canvas); LoadingSceneAudioCtrl.init(audioManager); AudioPlayCtrl.init(audioManager); LoadingSceneAudioCtrl.getInstance().play(LOADING_TIPS); GestureCtrl.removeInstance(); fillBar.fillAmount = 0; fillEyes.fillAmount = 0; StartCoroutine(LoadMainScene()); }
// init audio private void initAudioCtrl() { AudioPlayCtrl.init(audioManager); PlayerAudioCtrl.init(audioManager); BackgroundAudioCtrl.init(audioManager); ObstacleAudioCtrl.init(audioManager); // close contain feature when in the runtime. if (PlatformUtils.isTouchUser()) { isDevelop = false; } }
// 这个功能是有可复用性的,只是针对 playeAudioCtrl 并不有效 public virtual void play(String clipName, callback method = null) { if (audioPlayers.Count > 0 && clips.Count > 0) { AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, audioPlayers[0], 3.5f); AudioPlayCtrl.getInstance().addEffectObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method); } } }
public override void play(System.String clipName, callback method = null) { if (clips.Count <= 0) { return; } float maxTime = -1; AudioSource player = manager; AudioPlayObj obj = new AudioPlayObj(selectClip(clipName), this, player, maxTime); AudioPlayCtrl.getInstance().addEffectObj(obj); if (method != null) { AudioPlayCtrl.getInstance().addCallbackToEffectClip(clipName, method); } }
public void playAudio(ArrowDir dir) { String name = selectedDir(dir); System.String clipName = ""; AudioPlayObj obj = null; if (dir == ArrowDir.FRONT) { clipName = "frontSword"; obj = new AudioPlayObj(selectClip(clipName), this, selectSource(name)); } else { clipName = "bow"; obj = new AudioPlayObj(selectClip(clipName), this, selectSource(name)); } AudioPlayCtrl.getInstance().addEffectObj(obj); // 教学音频设计需要 if (GameManagerGlobalData.isFirstMeetObstacle) { PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_FRONT_TIPS, () => { Parry.getInstance().setParry(true); GameManagerGlobalData.isFirstMeetObstacle = false; }); } else if (GameManagerGlobalData.isSecondMeetObstacle) { PlayerAudioCtrl.getInstance().play(PlayerAudioData.PARRY_TO_LEFT_TIPS, () => { Parry.getInstance().setParry(true); GameManagerGlobalData.isSecondMeetObstacle = false; }); } }
public static void init(GameObject manager) { _instance = manager.GetComponent <AudioPlayCtrl>(); }