// Use this for initialization
    void Start()
    {
        curTheme = 0;
        for (int i = 0; i < ThemeCollection.getThemes().Count; i++)
        {
            Transform rt = (Transform)Instantiate(model, new Vector3(0, basedistance * i), Quaternion.identity);
            rt.SetParent(transform, false);
            rt.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -basedistance * (i + 1));
            if (i <= SavenLoad.setting.point / 9)
            {
                rt.GetComponent <Image>().sprite        = ThemeCollection.getThemes()[i].image;
                rt.GetComponentInChildren <Text>().text = "";
            }
            else
            {
                rt.GetComponent <Image>().sprite        = lockedTheme;
                rt.GetComponentInChildren <Text>().text = 9 * i + " MISSIONS";
            }

            /*	rt.GetComponent<Image>().sprite = ThemeCollection.getThemes()[i].image;
             *      rt.GetComponentInChildren<Text>().text = "";
             *      rt.name = "theme_icon"+i;*/
        }
        Transform slt = (Transform)Instantiate(selectedSprite, new Vector3(0, 0), Quaternion.identity);

        slt.SetParent(transform, false);
        slt.GetComponent <Image> ().color = new Color(0, 0, 0, 140);
        slt.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -basedistance * (SavenLoad.setting.activedTheme + 1));
        slt.name = "SelectedTheme";
        ((RectTransform)transform).anchoredPosition = new Vector2(0, basedistance * (SavenLoad.setting.activedTheme + 0.5f) - ((RectTransform)transform).rect.height / 2);

        //slt.GetComponent<Image>().sprite = theme.image;
    }
    public static void UnlockTheme(int index)
    {
        GameObject rt = GameObject.Find("theme_icon" + index);

        if (rt != null)
        {
            rt.GetComponent <Image>().sprite = ThemeCollection.getThemes()[index].image;
        }
    }
    // Use this for initialization
    void Start()
    {
        SavenLoad.Load();
        GameObject.Find("ButtonSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("UnlockSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("BgSound").GetComponent <AudioSource> ().volume     = SavenLoad.setting.volumeMusic;

        ThemeCollection.getThemes();
        Invoke("ProcessToMain", 0.75f);
    }
Exemple #4
0
    // Use this for initialization
    public void Start()
    {
        List <GameObject> list1 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Spot"));
        List <GameObject> list2 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Icon"));
        List <GameObject> list3 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Highlight"));

        list3.AddRange(GameObject.FindGameObjectsWithTag("Line"));
        list3.AddRange(GameObject.FindGameObjectsWithTag("Button"));
        list3.AddRange(GameObject.FindGameObjectsWithTag("Colored Text"));
        List <GameObject> list4 = new List <GameObject> (GameObject.FindGameObjectsWithTag("Background"));
        List <GameObject> list5 = new List <GameObject> (GameObject.FindGameObjectsWithTag("DotBg"));

        list5.AddRange(GameObject.FindGameObjectsWithTag("IconBg"));
        Theme loaded = ThemeCollection.getThemes()[SavenLoad.setting.activedTheme];

        foreach (GameObject g in list1)
        {
            //
            g.GetComponent <SpriteRenderer>().sprite = loaded.dot;
        }
        foreach (GameObject g in list2)
        {
            ChangeColor(g, loaded.color1);
        }
        foreach (GameObject g in list3)
        {
            ChangeColor(g, loaded.color2);
        }
        foreach (GameObject g in list4)
        {
            ChangeColor(g, loaded.color3);
        }
        foreach (GameObject g in list5)
        {
            ChangeColor(g, loaded.color4);
        }
        GameObject logo = GameObject.Find("GameLogo");

        if (logo != null)
        {
            logo.GetComponent <Image> ().sprite = Resources.Load <Sprite> ("m" + loaded.imgName);
        }
    }
Exemple #5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0) && !gameMaster.paused)
     {
         Vector3      v   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         RaycastHit2D hit = Physics2D.Raycast(v, Vector2.zero);
         if (hit.collider != null && hit.transform.position != previousSpot && hit.transform.tag == "Spot")
         {
             hit.transform.gameObject.GetComponent <Animator>().SetInteger("Animation", ThemeCollection.getThemes()[SavenLoad.setting.activedTheme].animation);
             AddSpot(hit.transform.position);
             currentLine += hit.transform.name;
         }
         v.z = 0;
         render.SetPosition(2 * count - 2, v);
     }
     else if (Input.GetMouseButtonUp(0) && currentLine != "" && !gameMaster.paused)
     {
         //call Game Master here
         gameMaster.checkAns(currentLine);
         //Cancel line
         count       = 1;
         currentLine = "";
         render.SetVertexCount(1);
         previousSpot = new Vector3(0.1f, 0.1f, -1);
     }
     if (currentLine == "")
     {
         foreach (GameObject t in GameObject.FindGameObjectsWithTag("Highlight"))
         {
             t.GetComponent <SpriteRenderer>().enabled = false;
         }
     }
 }