public void timer() { if (!_isParry) { return; } float dt = Time.deltaTime; _curTime += dt; _restTime -= dt; sliderEffect(); if (_curTime <= elapseTime && _restTime <= 0) { if (PlatformUtils.isKeyBoardUser()) { keyBoardEvent(); } GestureCtrl.getInstance().timer(); } else if (_curTime > elapseTime) { this.endParry(false); } }
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 Update() { // 不需要初始化,因为 StartScene 已经初始化过的, 两种情况下对方无法移动。但是 plot 会导致已有左右手势的正常运作,因此在 player state 这边修 if (_state == GameState.Plot || _state == GameState.GameOver && player.getState() == PlayerState.Dead) { GestureCtrl.getInstance().timer(); } }
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; }
private void switchGestureToGameOver() { GestureCtrl.getInstance().toCenterGesture = RestartGame; GestureCtrl.getInstance().toLeftGesture = null; GestureCtrl.getInstance().toRightGesture = null; GestureCtrl.getInstance().toFrontGesture = null; GestureCtrl.getInstance().toBackGesture = null; }
// 切换手势功能到移动 public void switchGestureToMove() { GestureCtrl.getInstance().toLeftGesture = moveLeft; GestureCtrl.getInstance().toRightGesture = moveRight; GestureCtrl.getInstance().toBackGesture = _owner.refuseMoveBack; GestureCtrl.getInstance().toFrontGesture = moveFront; GestureCtrl.getInstance().toCenterGesture = null; }
// 外传的计时器 public void timer() { if (_owner.getState() != PlayerState.Idle) { return; } if (PlatformUtils.isKeyBoardUser()) { keyBoardEvent(); } // 为了能够有管控,因为 mobile 平台上 gesture 替代了 keyboard 所以要有与之对应的管控。parry 设置同理。 GestureCtrl.getInstance().timer(); }
// Update is called once per frame void Update() { GestureCtrl.getInstance().timer(); _curTime += Time.deltaTime; if (isFirstTimeEnterGame) { showStartAnim(); } if (_curTime > _elapseTime) { StartSceneAudioCtrl.getInstance().play(StartSceneAudioData.DOUBLE_CLICK); playSystemAudio(); } }
public void setGameState(GameState state) { Debug.Log("GameState Changed: " + state); _state = state; if (_state == GameState.Plot) { // 方便跳过剧情,通常用于测试 switchGestureToPlot(); } else if (_state == GameState.Playing) { GestureCtrl.getInstance().toCenterGesture = null; } }
public void setGestureToParry() { GestureCtrl.getInstance().toLeftGesture = () => { if (checkParry(ArrowDir.LEFT)) { endParry(true); } }; GestureCtrl.getInstance().toRightGesture = () => { if (checkParry(ArrowDir.RIGHT)) { endParry(true); } }; GestureCtrl.getInstance().toFrontGesture = () => { if (checkParry(ArrowDir.FRONT)) { endParry(true); } }; GestureCtrl.getInstance().toCenterGesture = null; GestureCtrl.getInstance().toBackGesture = null; }
// Use this for initialization void Start() { GestureCtrl.getInstance().preInit(); GestureCtrl.getInstance().init(); init(); }