Exemple #1
0
    private IEnumerator SwapBack()
    {
        yield return(new WaitForSeconds(0.2f));

        if (temp.GetComponent <SpriteRenderer>().sprite == previousImage && render.sprite == swappedImage)
        {
            temp.GetComponent <SpriteRenderer>().sprite = swappedImage;
            render.sprite = previousImage;
        }
        StopCoroutine(BoardManager.instance.FindNullTiles());
        StartCoroutine(BoardManager.instance.FindNullTiles());
        temp      = null;
        coroutine = null;
    }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     Psprite = parent.GetComponent <SpriteRenderer>().sprite;
     if (Psprite == options[0])
     {
         Render.color = new Color32(255, 208, 161, 255);
     }
     else if (Psprite == options[1])
     {
         Render.color = new Color32(253, 161, 240, 255);
     }
     else if (Psprite == options[2])
     {
         Render.color = new Color32(161, 187, 253, 255);
     }
     else if (Psprite == options[3])
     {
         Render.color = new Color32(251, 253, 161, 255);
     }
     else if (Psprite == options[4])
     {
         Render.color = new Color32(253, 170, 161, 255);
     }
     else if (Psprite == options[5])
     {
         Render.color = new Color32(161, 244, 253, 255);
     }
     else if (Psprite == options[6])
     {
         Render.color = new Color32(180, 253, 161, 255);
     }
     ParticleSystem.MainModule main = Pop.main;
     main.startColor = Render.color;
 }
Exemple #3
0
    void OnMouseDown()
    {
        // 1
        if (render.sprite == null || BoardManager.instance.IsShifting || !Started)
        {
            return;
        }

        if (isSelected)
        { // 2 Is it already selected?
            Deselect();
        }
        else
        {
            if (previousSelected == null)
            { // 3 Is it the first tile selected?
                Select();
            }
            else
            {
                if (GetAllAdjacentTiles().Contains(previousSelected.gameObject))
                {                                        // 1
                    SwapSprite(previousSelected.render); // 2
                    previousSelected.ClearAllMatches(false, gameObject);
                    temp = previousSelected;
                    previousSelected.Deselect();
                    ClearAllMatches(true, gameObject);
                }
                else
                { // 3
                    previousSelected.GetComponent <ConnectTile>().Deselect();
                    Select();
                }
            }
        }
    }