Exemple #1
0
        public void OnNavigate(InputAction.CallbackContext context)
        {
            if (!Confirmed)
            {
                if (context.started)
                {
                    Vector2 navigation = (Vector2)context.ReadValueAsObject();

                    if (Mathf.Abs(navigation.x) < Mathf.Abs(navigation.y))
                    {
                        if (navigation.y > 0f && selectedItem.neighbours.up)
                        {
                            selectedItem = selectedItem.neighbours.up;
                        }
                        else if (navigation.y < 0f && selectedItem.neighbours.down)
                        {
                            selectedItem = selectedItem.neighbours.down;
                        }
                    }
                    else
                    {
                        if (navigation.x > 0f && selectedItem.neighbours.right)
                        {
                            selectedItem = selectedItem.neighbours.right;
                        }
                        else if (navigation.x < 0f && selectedItem.neighbours.left)
                        {
                            selectedItem = selectedItem.neighbours.left;
                        }
                    }
                }
            }
        }
 public void OnScroll(InputAction.CallbackContext context)
 {
     if (!(context.ReadValueAsObject() is Vector2 value))
     {
         return;
     }
     if (value.y < 0)
     {
         if (camera.orthographicSize >= 20)
         {
             camera.orthographicSize -= 4;
         }
     }
     else
     {
         if (camera.orthographicSize <= 120)
         {
             camera.orthographicSize += 4;
         }
     }
 }