Example #1
0
 public ToggleList(params string [] s)
 {
     Togg = new ToggleContainer[s.Length];
     for (int i = 0; i < Togg.Length; i++)
     {
         Togg[i] = new ToggleContainer(s[i], false);
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        _dataController   = FindObjectOfType <DataController>();
        _firebaseScript   = FindObjectOfType <FirebaseScript>();
        _questionCopy     = _firebaseScript.GetQuestionData();
        _levelCopy        = _firebaseScript.GetLevelData();
        _enemyAnimatorMap = GetComponent <EnemyAnimatorMap>();
        _toggleContainer  = GetComponent <ToggleContainer>();

        //Create toggle objects which acts as the container to be chosen for the question
        for (int i = 0; i < _questionCopy.Count; ++i)
        {
            GameObject tempToggle = Instantiate(templateToggle, templateToggle.transform.parent, false);
            tempToggle.SetActive(true);
            tempToggle.GetComponentInChildren <TextMeshProUGUI>().text = _questionCopy[i].QuestionText;
            _toggleContainer.AddToggle(tempToggle);
        }

        //Set default enemy sprite as "chicken"
        enemyChrPos = enemySprite.transform.position;
        UpdateEnemyChr(0);
    }