void OnFingerStationary(FingerMotionEvent e) { // if (e.Hit.collider!=null && e.Hit.collider.gameObject.layer == LayerMask.GetMask("UI")) { // Debug.Log("e.Selection:" + e.Selection); } if (e.Phase == FingerMotionPhase.Started) { //Debug.Log("*******Started moving " + e.Finger); } else if (e.Phase == FingerMotionPhase.Updated) { // var heading = GetSwipeDirectionVector(gesture.Direction); float distance = _camera.ScreenToWorldPoint(e.Position).x - _trans.position.x; if (Math.Abs(distance) > 0.1f) { NormalMove(distance); } else { Stop(); } } else { Stop(); } }
public void OnFingerMove(FingerMotionEvent e) { Vector3 camPos = Camera.main.transform.position; Debug.DrawLine(camPos, camPos + Camera.main.ScreenPointToRay(e.Position).direction * 100f); { if (FingerPointData == null) { FingerPointData = new PointerEventData(eventSystem); } FingerPointData.Reset(); if (e.Phase == FingerMotionPhase.Updated) { FingerPointData.position = e.Position; List <RaycastResult> rayCastResults = new List <RaycastResult>(); eventSystem.RaycastAll(FingerPointData, rayCastResults); FingerPointData.pointerCurrentRaycast = FindFirstRaycast(rayCastResults); m_fingerTargetObject = FingerPointData.pointerCurrentRaycast.gameObject; rayCastResults.Clear(); } else { FingerPointData = null; } } }
void OnFingerStationary(FingerMotionEvent e) { if (m_entity != null) { m_recordPosition = m_entity.transform.position; } }
/// <summary> /// Raises the finger stationary event. /// 3D objects - Play the sound when the object is pressed down /// </summary> void OnFingerStationary(FingerMotionEvent e) { if (e.Phase == FingerMotionPhase.Started) { CheckSoundToPlay(); } }
void FingerStationaryEventHandler(FingerMotionEvent e) { if (fingerStationaryMethods != null) { fingerStationaryMethods(e.Position, e.Selection, MotionPhaseConvertor(e.Phase)); } }
void OnFingerStationary(FingerMotionEvent e) { if (e.Hit.collider != null && e.Selection.tag == "Trigger") //&& e.Hit.collider.gameObject.layer == LayerMask.GetMask("UI") { // Debug.Log("OnFingerStationary:e.Selection:" + e.Selection.name); return; } if (e.Phase == FingerMotionPhase.Started) { //Debug.Log("*******Started moving " + e.Finger); } else if (e.Phase == FingerMotionPhase.Updated) { // var heading = GetSwipeDirectionVector(gesture.Direction); //如果点中自己的时候 一般为双击变形 此时不进行位移 //if (e.Hit.collider != null && e.Hit.collider.gameObject == this.gameObject) //{ // return; //} float distance = _camera.ScreenToWorldPoint(e.Position).x - _trans.position.x; if (Math.Abs(distance) > 0.1f) { NormalMove(distance); } } else { Stop(); } }
void OnFingerStationary(FingerMotionEvent e) { if (currentFinger == e.Finger) { GoToTouchTarget(e.Position, 1f); } }
public void OnFingerMove(FingerMotionEvent e) { _updates.Add(new InputMessage( InputMessage.InputTypes.FingerMoving, InputMessage.MessageTypes.Transient, e.Position )); }
void OnFingerMove(FingerMotionEvent e) { if(e.Finger.Index != 0) return; position = e.Position; if (OnFingerMotionEvent != null) OnFingerMotionEvent (e); }
public override void DealOnFingerMotion (FingerMotionEvent e) { if ( e.Phase == FingerMotionPhase.Updated ) { Vector2 velocity = e.Finger.DeltaPosition / Time.deltaTime; flower.Blow( velocity * Global.Pixel2Unit ); } UpdateColliderPosition(); }
private void OnFinger(FingerMotionEvent eventData) { if (eventData.Phase == FingerMotionPhase.Started) { } else if (eventData.Phase == FingerMotionPhase.Ended) { } }
public override void DealOnFingerMotion(FingerMotionEvent e) { if (e.Phase == FingerMotionPhase.Updated) { Vector2 velocity = e.Finger.DeltaPosition / Time.deltaTime; flower.Blow(velocity * Global.Pixel2Unit); } UpdateColliderPosition(); }
void OnFingerStationary(FingerMotionEvent e) { if (!doneWithShake) { //Cancel shaker if finger stops moving and stays stationary transform.position = startDragPos; elapsed = 0; } }
void OnFingerMoveBack( FingerMotionEvent e ) { GameObject selection = e.Selection; if (selection == null ) return; SenseGuesture sense = selection.GetComponent<SenseGuesture>(); if ( sense != null ) sense.DealOnFingerMotion( e ); }
void OnFingerMove(FingerMotionEvent e) { if (m_player != null) { Vector2 fingerDir = e.Position - m_fingerDownPosition; float moveSpeed = m_player.GetPlayerMoveSpeed(); Vector2 entityMovePosition = m_playerPosition + new Vector2(fingerDir.x, fingerDir.y) * moveSpeed; m_player.SetMoveDirection(fingerDir); m_player.MovePosition(entityMovePosition); } }
void OnFingerMove(FingerMotionEvent fingerMove) { //// if(fingerMove.Selection == gameObject) { // if(canMove) { // //// if(fingerMove.Finger.Index) { //// //// } // transform.position = (Vector2)Camera.main.ScreenToWorldPoint(fingerMove.Position) + positionOffset; // } //// } }
void OnFingerStationary(FingerMotionEvent e) { if (m_player != null) { m_playerPosition = m_player.GetPlayerPosition(); } m_fingerDownPosition = e.Position; if (m_player != null) { m_player.SetMoveDirection(Vector2.zero); } }
void OnFingerMove(FingerMotionEvent e) { GameStart.GetInstance().LogModuel.Log(ELogType.Normal, "OnFingerMove : " + (e.Position * m_moveSpeed).ToString()); Vector2 fingerDir = e.Position - m_downPosition; Vector3 entityMovePosition = m_recordDownPosition + new Vector3(fingerDir.x, fingerDir.y, 0f) * m_moveSpeed; if (MoveEntityAction != null) { MoveEntityAction(entityMovePosition); } //m_entity.transform.position = CheckOutofRange(entityMovePosition); }
void OnFingerMove(FingerMotionEvent e) { //if (e.Phase == FingerMotionPhase.Started) //{ // Debug.Log("Started moving " + e.Finger); //} //else if (e.Phase == FingerMotionPhase.Updated) //{ // Debug.Log("Updated moving " + e.Finger); //} //else //{ // Debug.Log("Stopped moving " + e.Finger); //} }
void OnFingerMoveBack(FingerMotionEvent e) { GameObject selection = e.Selection; if (selection == null) { return; } SenseGuesture sense = selection.GetComponent <SenseGuesture>(); if (sense != null) { sense.DealOnFingerMotion(e); } }
void OnFingerMoveBack(FingerMotionEvent e) { if (enabled && m_state == CameraState.Free) { // update the level position according to the finger movement bool check = false; switch (Application.platform) { case RuntimePlatform.Android: case RuntimePlatform.IPhonePlayer: check = FingerGestures.Touches.Count >= 2; break; default: check = e.Finger.Index >= 1; break; } if (check) { if (e.Phase == FingerMotionPhase.Updated) { GameObject levelObj = LogicManager.LevelManager.GetLevelObject(); Vector3 pos = -levelObj.transform.position; // move the camera Vector3 worldDelta = -Global.V2ToV3(e.Finger.DeltaPosition) * Global.Pixel2Unit * senseIntense; // pos -= Global.V2ToV3( e.Finger.DeltaPosition ) * Global.Pixel2Unit * senseIntense; // restrict the range pos = GetNewPosition(pos, worldDelta); levelObj.transform.position = -pos; } else if (e.Phase == FingerMotionPhase.Ended) { LogicManager.LevelManager.GetWind().StartUpdateWind(); } } } else { //show the unable to move feedback if (e.Phase == FingerMotionPhase.Started) { EventManager.Instance.PostEvent(EventDefine.UnableToMove); } } }
//手指移动事件 void OnFingerMove(FingerMotionEvent e) { //如果事件状态是移动开始状态 if (e.Phase == FingerMotionPhase.Started) { //如果选择本物体,且与控制器中当前选定的物体一致 if (e.Selection == gameObject && game_controller.selection == gameObject) { gameObject.transform.position = GetWorldPos(e.Position) + new Vector3(0, 0, -2); //进入拖动的状态 animIndex = 2; } } //如果事件状态是移动结束状态 else if (e.Phase == FingerMotionPhase.Ended) { //如果选择本物体,且与控制器中当前选定的物体一致 if (e.Selection == gameObject && game_controller.selection == gameObject) { //如果是拖动状态 if (animIndex == 2) { //角色的位置等于鼠标的位置 //gameObject.transform.position = GetWorldPos(e.Position) + new Vector3(0, 0, -0.5f); animIndex = 0; } } } //如果事件状态是移动中状态 else if (e.Phase == FingerMotionPhase.Updated) { //如果选择本物体,且与控制器中当前选定的物体一致 if (e.Selection == gameObject && game_controller.selection == gameObject) { //如果是拖动状态 if (animIndex == 2) { //角色的位置等于鼠标的位置 gameObject.transform.position = GetWorldPos(e.Position) + new Vector3(0, 0, -2); } } } }
void OnFingerStationaryBack(FingerMotionEvent e) { if (e.Phase == FingerMotionPhase.Updated) { if (inkDict.ContainsKey(e.Finger.Index) && inkDict[e.Finger.Index] != null) { if (e.Finger.DistanceFromStart < inkDict[e.Finger.Index].affectRange()) { inkDict[e.Finger.Index].Spread(Time.deltaTime); } else { inkDict[e.Finger.Index].Fade(); inkDict[e.Finger.Index] = null; } } } }
void OnFingerMove(FingerMotionEvent e) { PathRenderer path = paths[e.Finger.Index]; if (e.Phase == FingerMotionPhase.Started) { UI.StatusText = "Started moving " + e.Finger; // path.AddPoint( e.Position, fingerMoveBeginMarkerPrefab ); } else if (e.Phase == FingerMotionPhase.Updated) { path.AddPoint(e.Position); } else { UI.StatusText = "Stopped moving " + e.Finger; // path.AddPoint( e.Position, fingerMoveEndMarkerPrefab ); } }
private void OnFingerEvent(FingerEvent args) { FingerMotionEvent motionEventArgs = args as FingerMotionEvent; if (null != motionEventArgs) { // ui collider clicked if (UICamera.hoveredObject == m_HeroCollider) { // only rotate on finger down if (motionEventArgs.Phase == FingerMotionPhase.Updated) { // rotate left or right if (motionEventArgs.Position.x - m_LastFingerPos.x > 0.5) { OnHeroRotate(m_CurHeroId, -1); } else if (motionEventArgs.Position.x - m_LastFingerPos.x < -0.5) { OnHeroRotate(m_CurHeroId, 1); } else { } } m_LastFingerPos = motionEventArgs.Position; } return; } FingerDownEvent downEventArgs = args as FingerDownEvent; if (downEventArgs != null) { if (UICamera.hoveredObject == m_HeroCollider) { return; } return; } }
float myalpha = 1; //skull alpha,if not drop to 0,you pick the skull,you lose the game /// <summary> /// Raises the finger move event. /// </summary> /// <param name="e">E.</param> void OnFingerMove(FingerMotionEvent e) { if (e.Selection == skull) //is touching on skull target { if (e.Phase == FingerMotionPhase.Started) //is start moving { } else if (e.Phase == FingerMotionPhase.Updated) //is moving { myalpha = sp.color.a - .004f; //keep decrease the skull alpha sp.color = new Color(sp.color.r, sp.color.g, sp.color.b, myalpha); //update color if (myalpha <= 0) { sp.enabled = false; //keep alpha to zero if } } else { } } }
void OnFingerMove(FingerMotionEvent e) { LineRendererTest.instance.DrawLine(e.Position); // DrawLineTest.instance.lineInfo.Add(e.Position); if (index > 0) { Vector2 dirNow = e.Position - touch[index].TouPosition; Vector2 dirLast = touch[index].TouPosition - touch[index - 1].TouPosition; if (JudgeUndo(dirNow, dirLast)) { return; } } if (((Vector2)e.Position - touch[index].TouPosition).sqrMagnitude > 300) { float touchlength = (e.Position - touch[index].TouPosition).magnitude; // print(touchlength); //判断线的长度 以及能否继续划线 if (!CanDraw(touchlength)) { return; } // 撤销操作 touch.Add(new TouchMsg(e.Position, touchlength)); // bonePosition.Add(rayPos(e.Position)); index++; } }
void OnFingerMove(FingerMotionEvent e) { if (e.Phase == FingerMotionPhase.Updated) { Vector2 delta = e.Finger.DeltaPosition; if (LogicManager.isLockVerticle) { delta.y = 0; } head.UpdateHead(delta); } // Vector3 to = Camera.main.ScreenPointToRay( e.Position - e.Finger.DeltaPosition ).direction; // Vector3 from = Camera.main.ScreenPointToRay( e.Position ).direction; // // if ( LogicManager.isLockVerticle ) // { // from.y = to.y = 0; // } // transform.rotation *= Quaternion.FromToRotation( from , to ); }
virtual public void OnMotion(FingerMotionEvent e) { }
void OnFingerMoveBack( FingerMotionEvent e ) { if ( enabled && m_state == CameraState.Free ) { // update the level position according to the finger movement bool check = false; switch( Application.platform ) { case RuntimePlatform.Android: case RuntimePlatform.IPhonePlayer: check = FingerGestures.Touches.Count >= 2; break; default : check = e.Finger.Index >= 1; break; } if ( check ) { if ( e.Phase == FingerMotionPhase.Updated ) { GameObject levelObj = LogicManager.LevelManager.GetLevelObject(); Vector3 pos = - levelObj.transform.position; // move the camera Vector3 worldDelta = - Global.V2ToV3( e.Finger.DeltaPosition ) * Global.Pixel2Unit * senseIntense; // pos -= Global.V2ToV3( e.Finger.DeltaPosition ) * Global.Pixel2Unit * senseIntense; // restrict the range pos = GetNewPosition( pos , worldDelta ); levelObj.transform.position = - pos; }else if ( e.Phase == FingerMotionPhase.Ended ) { LogicManager.LevelManager.GetWind().StartUpdateWind(); } } }else { //show the unable to move feedback if ( e.Phase == FingerMotionPhase.Started ) EventManager.Instance.PostEvent( EventDefine.UnableToMove ); } }
void OnFingerStationary(FingerMotionEvent e) { if (e.Hit.collider != null && e.Selection.tag == "Trigger") //&& e.Hit.collider.gameObject.layer == LayerMask.GetMask("UI") { // Debug.Log("OnFingerStationary:e.Selection:" + e.Selection.name); return; } if (e.Phase == FingerMotionPhase.Started) { //Debug.Log("*******Started moving " + e.Finger); } else if (e.Phase == FingerMotionPhase.Updated) { // var heading = GetSwipeDirectionVector(gesture.Direction); //如果点中自己的时候 一般为双击变形 此时不进行位移 //if (e.Hit.collider != null && e.Hit.collider.gameObject == this.gameObject) //{ // return; //} float distance = _camera.ScreenToWorldPoint(e.Position).x - _trans.position.x; if (Math.Abs(distance) > 0.1f) { NormalMove(distance); } } else { Stop(); } }
void OnFingerStationary( FingerMotionEvent e ) { if( e.Phase == FingerMotionPhase.Started ) { // skip if we're already holding another finger stationary on our object if( stationaryFingerIndex != -1 ) return; GameObject selection = e.Selection; if( selection == fingerStationaryObject ) { UI.StatusText = "Begin stationary on finger " + e.Finger.Index; // remember which finger we're using stationaryFingerIndex = e.Finger.Index; // remember the original material originalStationaryMaterial = selection.renderer.sharedMaterial; // change the material to show we've started the stationary state selection.renderer.sharedMaterial = highlightMaterial; } } else if( e.Phase == FingerMotionPhase.Updated ) { if( e.ElapsedTime < chargeDelay ) return; if( e.Selection == fingerStationaryObject ) { // compute charge progress % (0 to 1) float chargePercent = Mathf.Clamp01( ( e.ElapsedTime - chargeDelay ) / chargeTime ); // compute and apply new particle emission rate based on charge % float emissionRate = Mathf.Lerp( minSationaryParticleEmissionCount, maxSationaryParticleEmissionCount, chargePercent ); stationaryParticleEmitter.minEmission = emissionRate; stationaryParticleEmitter.maxEmission = emissionRate; // make sure the emitter is turned on stationaryParticleEmitter.emit = true; UI.StatusText = "Charge: " + ( 100 * chargePercent ).ToString( "N1" ) + "%"; } } else if( e.Phase == FingerMotionPhase.Ended ) { if( e.Finger.Index == stationaryFingerIndex ) { float timeStationary = e.ElapsedTime; UI.StatusText = "Stationary ended on finger " + e.Finger + " - " + timeStationary.ToString( "N1" ) + " seconds elapsed"; // turn off the stationary particle emitter when we begin to move the finger, as it's no longer stationary StopStationaryParticleEmitter(); // restore the original material fingerStationaryObject.renderer.sharedMaterial = originalStationaryMaterial; // reset our stationary finger index stationaryFingerIndex = -1; } } }
public virtual void DealOnFingerMotion( FingerMotionEvent e ) {}
void OnDetectFingerMotion(FingerMotionEvent e) { inputPosition = GetScreenPosition(e.Position); }
void OnFingerStationaryBack( FingerMotionEvent e ) { if ( e.Phase == FingerMotionPhase.Updated ) { if ( inkDict.ContainsKey( e.Finger.Index ) && inkDict[e.Finger.Index] != null) { if ( e.Finger.DistanceFromStart < inkDict[e.Finger.Index].affectRange() ) { inkDict[e.Finger.Index].Spread(Time.deltaTime); } else { inkDict[e.Finger.Index].Fade(); inkDict[e.Finger.Index] = null; } } } }
void OnDetectFingerMotion(FingerMotionEvent e) { inputPosition = GetScreenPosition(e.Position); }
void OnFingerMove(FingerMotionEvent e) { Vector3 pos = Camera.main.ScreenToWorldPoint ((Vector3)e.Position); pos.z = 0; transform.position = pos; }
void OnFingerMove(FingerMotionEvent e) { transform.position = Camera.main.ScreenToWorldPoint(new Vector3(e.Finger.Position.x, e.Finger.Position.y, 1)); }
public void OnFingerStationary(FingerMotionEvent e) { _updates.Add(new InputMessage( InputMessage.InputTypes.FingerStationary, InputMessage.MessageTypes.Transient, e.Position )); }
void OnFingerMove(FingerMotionEvent e) { m_delta = e.Finger.DeltaPosition; m_pos = e.Finger.Position; }
void OnFingerStationary(FingerMotionEvent e) { if (e.Phase == FingerMotionPhase.Started) { // skip if we're already holding another finger stationary on our object if (stationaryFingerIndex != -1) { return; } GameObject selection = e.Selection; if (selection == fingerStationaryObject) { UI.StatusText = "Begin stationary on finger " + e.Finger.Index; // remember which finger we're using stationaryFingerIndex = e.Finger.Index; // remember the original material originalStationaryMaterial = selection.renderer.sharedMaterial; // change the material to show we've started the stationary state selection.renderer.sharedMaterial = highlightMaterial; } } else if (e.Phase == FingerMotionPhase.Updated) { if (e.ElapsedTime < chargeDelay) { return; } if (e.Selection == fingerStationaryObject) { // compute charge progress % (0 to 1) float chargePercent = Mathf.Clamp01((e.ElapsedTime - chargeDelay) / chargeTime); // compute and apply new particle emission rate based on charge % float emissionRate = Mathf.Lerp(minSationaryParticleEmissionCount, maxSationaryParticleEmissionCount, chargePercent); stationaryParticleEmitter.minEmission = emissionRate; stationaryParticleEmitter.maxEmission = emissionRate; // make sure the emitter is turned on stationaryParticleEmitter.emit = true; UI.StatusText = "Charge: " + (100 * chargePercent).ToString("N1") + "%"; } } else if (e.Phase == FingerMotionPhase.Ended) { if (e.Finger.Index == stationaryFingerIndex) { float timeStationary = e.ElapsedTime; UI.StatusText = "Stationary ended on finger " + e.Finger + " - " + timeStationary.ToString("N1") + " seconds elapsed"; // turn off the stationary particle emitter when we begin to move the finger, as it's no longer stationary StopStationaryParticleEmitter(); // restore the original material fingerStationaryObject.renderer.sharedMaterial = originalStationaryMaterial; // reset our stationary finger index stationaryFingerIndex = -1; } } }
void OnFingerMove(FingerMotionEvent e) { delta = e.Finger.DeltaPosition; }
void OnFingerMove( FingerMotionEvent e ) { PathRenderer path = paths[e.Finger.Index]; if( e.Phase == FingerMotionPhase.Started ) { UI.StatusText = "Started moving " + e.Finger; path.AddPoint( e.Position, fingerMoveBeginMarkerPrefab ); } else if( e.Phase == FingerMotionPhase.Updated ) { path.AddPoint( e.Position ); } else { UI.StatusText = "Stopped moving " + e.Finger; path.AddPoint( e.Position, fingerMoveEndMarkerPrefab ); } }