Example #1
0
        public void Show()
        {
            gameObject.SetActive(true);

            IntVector2 targetPosition;
            Chuzzle    arrowChuzzle;

            GamefieldUtility.Tip(gamefield.Level.ActiveChuzzles, out targetPosition, out arrowChuzzle);

            fromFingerPosition = arrowChuzzle.Current.IntVector2Position;
            toFingerPosition   = targetPosition;

            var fromPosition = GamefieldUtility.ConvertXYToPosition((int)fromFingerPosition.x, (int)fromFingerPosition.y, Chuzzle.Scale);

            finger.transform.position = fromPosition;
            finger.Values["position"] = GamefieldUtility.ConvertXYToPosition((int)toFingerPosition.x, (int)toFingerPosition.y, Chuzzle.Scale);
            finger.Play();

            Tutorial.instance.targetCell      = gamefield.Level.GetCellAt(targetPosition);
            Tutorial.instance.takeableChuzzle = gamefield.Level.At(fromFingerPosition.x, fromFingerPosition.y);
            gamefield.TileDestroyed          += OnTileDestroyed;

            tutorialCloud.SetText("Drag to destroy");
            tutorialCloud.SetPosition(Camera.main.WorldToScreenPoint(fromPosition + Vector3.up * 0.5f));
            tutorialCloud.Show();
        }
Example #2
0
    private void CheckPossibleCombinations()
    {
        _targetPosition = null;
        _arrowChuzzle   = null;
        var numberOfTries = 0;

        do
        {
            if (GamefieldUtility.Repaint(numberOfTries))
            {
                break;
            }

            _possibleCombination = GamefieldUtility.Tip(Gamefield.Level.ActiveChuzzles, out _targetPosition,
                                                        out _arrowChuzzle);
            Debug.Log(string.Format("Tip. From: {0} To: {1}", _arrowChuzzle, _targetPosition));
            numberOfTries++;
        }while (!_possibleCombination.Any());
    }