Пример #1
0
    private void FillEmptyDiagnostic()
    {
        int count = GemObjectList.Count;

        Debug.Log("FillEmptyDiagnostic");
        HexManager.Instance.SetScanSetting(0);

        GameObject go = HexManager.Instance.QueryScanNextHex();

        while (go != null)
        {
            HexObject objectScript = go.GetComponent <HexObject> ();

            if (objectScript.NoGemAttached())
            {
                GameObject gem = GemManager.Instance.QueryGetAvailableObject();

                if (gem != null)
                {
                    int colorType = (int)Random.Range(0, count);

                    GemObject gemScript = gem.GetComponent <GemObject> ();
                    gemScript.SetGemSprite(GemObjectList[colorType], (GemObject.eColorType)colorType);

                    objectScript.AttachGem(gem);
                }
            }

            go = HexManager.Instance.QueryScanNextHex();
        }
    }
Пример #2
0
    private void FillPreconfigDiagnostic()
    {
        int count = GemObjectList.Count;

        Debug.Log("FillEmptyDiagnostic");
        HexManager.Instance.SetScanSetting(0);

        GameObject go = HexManager.Instance.QueryScanNextHex();

        int index = 0;

        while (go != null)
        {
            HexObject objectScript = go.GetComponent <HexObject> ();

            if (objectScript._Type == HexObject.eType.Main && objectScript.NoGemAttached())
            {
                GameObject gem = GemManager.Instance.QueryGetAvailableObject();

                if (gem != null)
                {
                    int colorType = PreConfigBoard3[index++];

                    GemObject gemScript = gem.GetComponent <GemObject> ();
                    gemScript.SetGemSprite(GemObjectList[colorType], (GemObject.eColorType)colorType);

                    objectScript.AttachGem(gem);
                }
            }

            go = HexManager.Instance.QueryScanNextHex();
        }
    }