예제 #1
0
    public bool IsAround(CookPuzzle _puzzle)
    {
        if (_puzzle == null)
        {
            return(true);
        }

        return((_puzzle.transform.position - transform.position).sqrMagnitude < 5f);
    }
예제 #2
0
 void ResetPuzzle()
 {
     for (int i = 0; i < selectPuzzles.Count; ++i)
     {
         selectPuzzles[i].SetSelect(false);
     }
     oldPuzzle = null;
     selectPuzzles.Clear();
     lineRenderer.positionCount = 0;
     manager.ResetCombination();
 }
예제 #3
0
 public bool CheckCorrectedPuzzleSlot(int _index, CookPuzzle _puzzle)
 {
     if (correctedItemID[_index] == _puzzle.item.ID)
     {
         uIRestaurant.combinationView.UpdateIndex();
         return(true);
     }
     else
     {
         uIRestaurant.combinationView.ResetIndex();
         return(false);
     }
 }
예제 #4
0
    void SelectPuzzle()
    {
        if (!isMouseDown)
        {
            return;
        }

        RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector3.forward, 20f);

        if (hit)
        {
            CookPuzzle puzzle = hit.transform.GetComponent <CookPuzzle>();

            if (!puzzle.GetSelect() && puzzle.IsAround(oldPuzzle))
            {
                puzzle.SetSelect(true);
                selectPuzzles.Add(puzzle);
                manager.CheckCorrectedPuzzleSlot(selectPuzzles.Count - 1, puzzle);
                ++lineRenderer.positionCount;
                lineRenderer.SetPosition(selectPuzzles.Count - 1, puzzle.transform.position);
                oldPuzzle = puzzle;
            }
        }
    }