Example #1
0
    private void Start()
    {
        pointer         = GameObject.FindGameObjectWithTag("Pointer");
        lvl1            = GameObject.FindGameObjectWithTag("Level 1");
        lvl2            = GameObject.FindGameObjectWithTag("Level 2");
        lvl3            = GameObject.FindGameObjectWithTag("Level 3");
        lvl1Background  = new List <GameObject>();
        lvl2Background  = new List <GameObject>();
        lvl3Background  = new List <GameObject> ();
        selectedEnemies = GameObject.FindGameObjectsWithTag("Enemy Selected");
        globalButton    = GameObject.FindGameObjectWithTag("Global Button").GetComponent <GlobalButton>();
        myEventSystem   = GameObject.Find("EventSystem");
        management      = GameObject.FindGameObjectWithTag("Management").GetComponent <Management>();

        for (int i = 0; i < lvl1.transform.childCount; i++)
        {
            for (int j = 0; j < lvl1.transform.GetChild(i).childCount; j++)
            {
                if (lvl1.transform.GetChild(i).GetChild(j).CompareTag("Main Menu"))
                {
                    lvl1Background.Add(lvl1.transform.GetChild(i).GetChild(j).gameObject);
                }
            }
        }

        for (int i = 0; i < lvl2.transform.childCount; i++)
        {
            for (int j = 0; j < lvl2.transform.GetChild(i).childCount; j++)
            {
                if (lvl2.transform.GetChild(i).GetChild(j).CompareTag("Submenu"))
                {
                    lvl2Background.Add(lvl2.transform.GetChild(i).GetChild(j).gameObject);
                }
            }
        }

        for (int i = 0; i < lvl3.transform.childCount; i++)
        {
            for (int j = 0; j < lvl3.transform.GetChild(i).childCount; j++)
            {
                if (lvl3.transform.GetChild(i).GetChild(j).CompareTag("Submenu"))
                {
                    lvl3Background.Add(lvl3.transform.GetChild(i).GetChild(j).gameObject);
                }
            }
        }
    }
Example #2
0
    /// <summary>
    /// Method that fades out and starts the boss combat
    /// </summary>
    /// <returns></returns>
    IEnumerator fadeOutBoss()
    {
        for (float i = 0f; i < 1f; i = i + 0.02f)
        {
            tmp.a = i;
            fader.GetComponent <RawImage>().color = tmp; //Hay que hacerlo así porque no es una variable y no se puede cambiar directamente
            yield return(new WaitForSeconds(0.0001f));
        }


        management.GetComponent <Management>().combat.SetActive(true);
        enemyModels  = GameObject.FindGameObjectsWithTag("EnemyCombat");
        globalButton = GameObject.FindGameObjectWithTag("Global Button").GetComponent <GlobalButton>();
        enemyModels[0].transform.GetChild(0).GetComponent <EnemyModel>().isBoss = true;
        globalButton.hasBoss = true;
        Destroy(gameObject);
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     tmp          = gameObject.GetComponent <SpriteRenderer>().color;
     globalButton = GameObject.FindGameObjectWithTag("Global Button").GetComponent <GlobalButton>();
 }