public bool IsAround(CookPuzzle _puzzle) { if (_puzzle == null) { return(true); } return((_puzzle.transform.position - transform.position).sqrMagnitude < 5f); }
void ResetPuzzle() { for (int i = 0; i < selectPuzzles.Count; ++i) { selectPuzzles[i].SetSelect(false); } oldPuzzle = null; selectPuzzles.Clear(); lineRenderer.positionCount = 0; manager.ResetCombination(); }
public bool CheckCorrectedPuzzleSlot(int _index, CookPuzzle _puzzle) { if (correctedItemID[_index] == _puzzle.item.ID) { uIRestaurant.combinationView.UpdateIndex(); return(true); } else { uIRestaurant.combinationView.ResetIndex(); return(false); } }
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; } } }