private void UpdateDragging() { float dragDistance = (_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x; MovePanel(dragDistance); if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT)) { _touchEndTime = TimeHelper.GetCurrentRealTimestamp(); _touchEndPos = _mouseStatus.GetMousePos(); float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f; if (dragTime < 0.5f) { CreateEasingData(dragTime); TimerEx.Init("MouseControl", dragTime, EasingFinish); _state = STATE.EASING; } else { _state = STATE.IDLE; } return; } }
private void UpdateDragging() { Vector3 dragDistance = new Vector3((_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x, 0, 0); _game.mapCamera.cManualMove.UpdateMovePos(dragDistance); if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT)) { _touchEndTime = TimeHelper.GetCurrentRealTimestamp(); _touchEndPos = _mouseStatus.GetMousePos(); float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f; if (dragTime < 0.5f) { dragDistance = new Vector3((_touchBeganPos - _touchEndPos).x, 0, 0); _game.mapCamera.cManualMove.UpdateEasingPos(dragTime, dragDistance); TimerEx.Init("MouseControl", dragTime, EasingFinish); _state = STATE.EASING; } else { _state = STATE.IDLE; } return; } }
public void InitTimer() { productionTimer = TimerEx.Init("Production ", 1.0f, OnProductionTimer, true); if (productionTimer != null) { productionTimer.Pause(); } }
public static TimerEx Init(string timerName, float interval, CALLBACK callback, bool loop = false, System.Object parameter = null) { if (_timerRoot == null) { _timerRoot = new GameObject("TimerSpawn"); MonoBehaviour.DontDestroyOnLoad(_timerRoot); } GameObject gameObject = new GameObject(TIMEREX_NAME_PREFIX + timerName); MonoBehaviour.DontDestroyOnLoad(gameObject); gameObject.transform.parent = _timerRoot.transform; TimerEx t = gameObject.AddComponent <TimerEx>(); if (t != null) { t.Init(interval, callback, loop, parameter); return(t); } return(null); }
private void InitTimer() { recoverEnergyTimer = TimerEx.Init("RecoverEnergy", 1.0f, OnRecoverEnergy, true); recoverEnergyTimer.Pause(); }
private void InitFightTimer() { _fightTimer = TimerEx.Init("fightTimer", 1.0f, FightTimerCallBack, true); _fightStartTimestamp = TimeHelper.GetCurrentRealTimestamp(); }