Example #1
0
    void Start()
    {
        for (int i = 0; i < HalayorSize; i++)
        {
            GameObject go      = Object.Instantiate(HalayorPrefab, _halayorParent);
            Halayor    halayor = go.GetComponent <Halayor>();
            halayor.Halay         = Halay.GetComponent <SpiralGenerator>();
            go.transform.position = new Vector3(Random.Range(0f, 1f) >= 0.5 ? Random.Range(53.0f, 77.0f) : Random.Range(-53.0f, -77.0f), Random.Range(-40.0f, 40.0f), 0);
            halayor.HalayorColor  = GameManager.LerpHSV(ColorExtension.ToHSV(LeftMostColor),
                                                        ColorExtension.ToHSV(RightMostColor), ((float)i) / HalayorSize);
            halayor.HalayorID = i + 1;
            go.transform.GetChild(0).GetComponent <TextMesh>().text = (i + 1).ToString();
            _halayorPool.Add(go);
        }

        Halay.GetComponent <SpiralGenerator>().HalayInit();
        if (OnGame)
        {
            GameManager.Instance.SelectNewHalayor();
        }
    }