コード例 #1
0
    private bool AmINeighbourTo(Board_Slot slot)
    {
        bool amI = false;

        if (slot.neighbourhood.nUp == mySlot)
        {
            amI = true;
        }

        if (slot.neighbourhood.nDown == mySlot)
        {
            amI = true;
        }

        if (slot.neighbourhood.nLeft == mySlot)
        {
            amI = true;
        }

        if (slot.neighbourhood.nRight == mySlot)
        {
            amI = true;
        }

        return(amI);
    }
コード例 #2
0
 public void GemSelected(Board_Slot slot)
 {
     if (!moveLock)
     {
         draggingGem = true;
         currentSlot = slot;
     }
 }
コード例 #3
0
 public void ResetStatus()
 {
     moveLock    = false;
     currentSlot = null;
     targetSlot  = null;
     movedGem01  = null;
     movedGem02  = null;
 }
コード例 #4
0
    public void ReturnGems()
    {
        currentSlot = movedGem01;
        targetSlot  = movedGem02;

        StartCoroutine(RewindSwap());


        AudioController.Audio_PlaySound(0);
    }
コード例 #5
0
 public void SwapGemWith(Board_Slot targetSlot)
 {
     if (myGem != null)
     {
         myGem.transform.parent = targetSlot.transform;
         myGem.GoToParent();
         targetSlot.ReadGemProperties();
         //targetSlot.ScanNeighbours();
         myGem = null;
     }
     //noGem = false;
 }
コード例 #6
0
    private IEnumerator PerformSwap()
    {
        AudioController.Audio_PlaySound(0);

        movedGem01 = currentSlot;
        movedGem02 = targetSlot;

        currentSlot.SwapGemWith(targetSlot);
        targetSlot.SwapGemWith(currentSlot);


        currentSlot.ReadGemProperties();
        targetSlot.ReadGemProperties();

        while (currentSlot.myGem.goingToParent || targetSlot.myGem.goingToParent)
        {
            yield return(new WaitForEndOfFrame());
        }

        yield return(StartCoroutine(boardManager.OnMovePerformed()));

        yield return(null);
    }
コード例 #7
0
    public IEnumerator GenerateBoard()
    {
        for (int row = 0; row < boardGrid; row++)
        {
            for (int column = 0; column < boardGrid; column++)
            {
                yield return(new WaitForEndOfFrame());

                // instances
                GameObject boardSlot       = Instantiate(slotPrefab, board);
                Transform  boardSlotTR     = boardSlot.GetComponent <Transform>();
                Board_Slot boardSlotScript = boardSlot.GetComponent <Board_Slot>();

                // Positioning
                boardSlotTR.localPosition = GetGemPosition(column, row);
                boardSlot.name            = "R" + row.ToString() + " | C " + column;

                // Indexing
                mySlots.Add(boardSlotScript);

                if (row == 0)
                {
                    boardSlotScript.topSlot = true;
                }

                //GemNeration
                boardSlotScript.CreateGem(Random.Range(0, stageDifficulty));
            }
        }


        StartCoroutine(DispatchNeighbourhoodCheck());

        StartCoroutine(BoardValidation());

        yield return(null);
    }
コード例 #8
0
 private void Awake()
 {
     mySlot           = GetComponent <Board_Slot>();
     playerController = FindObjectOfType <Player_Controller>();
     boardManager     = FindObjectOfType <Board_Manager>();
 }
コード例 #9
0
 public void AddToArray(Board_Slot slot)
 {
     matchArray.Add(slot);
 }