Ejemplo n.º 1
0
    public void findAndRemoveMatches()
    {
        // формируем список линий
        ArrayList matches = lookMatches();

        for (int i = 0; i < matches.Count; i++)
        {
            ArrayList item      = (ArrayList)matches[i];
            int       numPoints = (item.Count - 1) * 25;

            for (int j = 0; j < item.Count; j++)
            {
                if (item[j] != null)
                {
                    GameObject gem      = (GameObject)item[j];
                    Gem        gemClass = gem.GetComponent <Gem>();

                    PopupScore.getInstance().AddPopupScore(new Vector3(gem.transform.position.x, gem.transform.position.y, -2), numPoints);

                    Debug.Log("Destroy gem " + gemClass.col + " " + gemClass.row);
                    gemClass.destroyed = true;

                    gemsBoard[gemClass.col, gemClass.row] = null;

                    _matches.Add(new int[2] {
                        gemClass.col, gemClass.row
                    });
                }
            }
        }


        //addNewPieces();
    }
Ejemplo n.º 2
0
 public static PopupScore getInstance()
 {
     if(_instance == null)
     {
         _instance = new PopupScore();
     }
     return _instance;
 }
Ejemplo n.º 3
0
 public static PopupScore getInstance()
 {
     if (_instance == null)
     {
         _instance = new PopupScore();
     }
     return(_instance);
 }
Ejemplo n.º 4
0
 public static void Initialize()
 {
     canvas = GameObject.Find("Canvas");
     if (!popupScorePrefab)
     {
         popupScorePrefab = Resources.Load <PopupScore>("UI Prefabs/Popup Score Parent");
     }
 }
Ejemplo n.º 5
0
    public static void CreatePopupScore(string text, Transform location)
    {
        PopupScore instance = Instantiate(popupScorePrefab);

        instance.transform.SetParent(canvas.transform, false);
        instance.SetText(text);
        instance.transform.position = location.position;
    }
Ejemplo n.º 6
0
    void Awake()
    {
        gems = Resources.LoadAll("Gems");

        PopupScore.getInstance().initTarget(gameObject);

        gemsBoard = new GameObject[countX, countY];

        CreateField();

        CreateBoard();
    }