Example #1
0
 void Start()
 {
     DataRef = GameObject.Find("GlobalData").GetComponent <GlobalData>();
     if (DataRef.Data != null)
     {
         for (int i = 0; i < DataRef.Data.Data.testData.Count; i++)
         {
             GameObject L_Spawned;
             L_Spawned = Instantiate(ObjectToSpawn, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)) as GameObject;
             L_Spawned.GetComponent <SelectorTask>().Setting(i, DataRef.Data.Data.testData[i].NameOfTask);
             L_Spawned.GetComponent <SelectorTask>().OnSwitchScene += EventToSwitch;
             L_Spawned.transform.SetParent(ContentRef.transform);
             L_Spawned.transform.localPosition = new Vector3(0, -80 - (100 * i), 0);
         }
     }
 }
Example #2
0
    private void Start()
    {
        DataRef = GameObject.Find("GlobalData").GetComponent <GlobalData>();


        DataRef.Data.currentNumberAnswers = 0;
        //Создание кнопок на сцене
        for (int i = 0; i < DataRef.Data.getNextAnswers(DataRef.Data.currentNumberAnswers).Count; i++)
        {
            GameObject L_Spawned;
            L_Spawned = Instantiate(ObjectToSpawn, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)) as GameObject;
            L_Spawned.GetComponent <CustomBTN>().Setting(i, "", this);
            L_Spawned.GetComponent <CustomBTN>().OnDragDetected += OnDragDetected;
            L_Spawned.GetComponent <CustomBTN>().OnDropDetected += OnDropDetected;
            L_Spawned.transform.SetParent(CanvasRef.transform);

            BTNRef.Add(L_Spawned);
        }

        //TimerTextRef.text = "Время: " + System.TimeSpan.FromSeconds(30).ToString();

        NextAnswer();
    }