示例#1
0
 private void OnMovementFinished(bool s)
 {
     RemoveEvents();
     if (StartCell == EndCell)
     {
         s = true;
     }
     MovementFinished?.Invoke(this, new CellMovementEventArgs(StartCell, EndCell, s, _path.Cells.Count + 1));
 }
示例#2
0
 void InvokeOnMovementFinished()
 {
     try
     {
         MovementFinished?.Invoke(this);
     }
     catch (Exception e)
     {
         Urho.IO.Log.Write(LogLevel.Debug,
                           $"There was an unexpected exception during the invocation of {nameof(MovementFinished)}: {e.Message}");
     }
 }
        public async void NotifyMovementFinished(int oldPosition, int newPosition)
        {
            MovementFinished?.Invoke(this, null);

            try
            {
                await _authSource.CommitRanking();
            }
            catch
            {
                // Cannot revert, keep going
            }
        }
示例#4
0
        public async void NotifyMovementFinished()
        {
            MovementFinished?.Invoke(this, null);

            try
            {
                await _authSource.CommitRanking();
            }
            catch (Exception e)
            {
                // Cannot revert, keep going
                Logger.Error(e);
            }
        }
示例#5
0
 private void OnMovementFinished(bool s)
 {
     _account.Character.Status = CharacterStatus.None;
     RemoveEvents();
     MovementFinished?.Invoke(this, new CellMovementEventArgs(StartCell, EndCell, s));
 }
示例#6
0
 private void OnMovementFinished(bool success)
 {
     _currentPath    = null;
     _neighbourMapId = 0;
     MovementFinished?.Invoke(success);
 }
示例#7
0
 public void OnMovementFinished()
 {
     MovementFinished?.Invoke(this, EventArgs.Empty);
 }
示例#8
0
    void Update()
    {
        if (mode == EMode.Selected && !colliding)
        {
            if (Input.GetMouseButtonDown(0))
            {
                mouseOffset       = Input.mousePosition.x;
                rotationDirection = Camera.main.WorldToScreenPoint(transform.position).y - Input.mousePosition.y > 50 ?
                                    -1 : 1;
            }

            else if (Input.GetMouseButton(0))
            {
                float mouseDelta = (Input.mousePosition.x - mouseOffset) * 20 / Screen.width;
                if (Mathf.Abs(mouseDelta) > 0.0005f && Mathf.Abs(rotationRate) < 100)
                {
                    if (Mathf.Sign(mouseDelta) != Mathf.Sign(rotationFloat))
                    {
                        rotationFloat = 0;
                    }

                    rotationFloat += mouseDelta;
                }
                if (Mathf.Abs(rotationFloat) > 1)
                {
                    if (rotationFloat > 0)
                    {
                        targetRotation = targetRotation + rotationDirection;
                    }
                    else if (rotationFloat < 0)
                    {
                        targetRotation = targetRotation - rotationDirection;
                    }

                    rotationFloat = 0;
                }
                mouseOffset = Input.mousePosition.x;
            }
        }


        //rotate gameObject and detect collisions until near destination then snap to new position


        if (Mathf.Abs(Mathf.DeltaAngle(targetRotation * 60, realRotationFloat)) > 0.05f)
        {
            realRotationFloat = Mathf.SmoothDampAngle(realRotationFloat, targetRotation * 60, ref rotationRate, 0.3f);
        }

        else if (Mathf.Abs(rotationRate) > 0 && !Input.GetMouseButton(0))
        {
            transform.rotation = Quaternion.Euler(0, targetRotation * 60, 0);
            rotationRate       = 0;
            rotationFloat      = 0;
            OnMovementFinished.Invoke();
        }

        if (realRotationFloat - lastGoodRotation * 60 > 60)
        {
            lastGoodRotation++;
        }
        else if (realRotationFloat - lastGoodRotation * 60 < -60)
        {
            lastGoodRotation--;
        }


        transform.rotation = Quaternion.Euler(0, realRotationFloat, 0);
    }
 public async void NotifyMovementFinished(int oldPosition, int newPosition)
 {
     MovementFinished?.Invoke(this, null);
     await _authSource.CommitRanking();
 }
 public void OnMovementFinished()
 {
     MovementFinished?.Invoke(this, null);
 }