Пример #1
0
    public void SelecionarBotao()
    {
        if (refScriptStatus == null)
        {
            refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
        }

        //remove a referencia do antigo
        refScriptStatus.RemoverSelecaoBotaoVelho();

        this.selecionado = true;



        refScriptStatus.IDFase = this.ID;//Atribui o nivel a que o botao pertence ao Status

        //pinta o botao com a cor de seleção
        if (refSeuSprite == null)
        {
            refSeuSprite       = renderer.material;      //this.GetComponent<OTSprite>();
            refSeuSprite.color = corBotaoSelecionado;
        }
        else
        {
            refSeuSprite.color = corBotaoSelecionado;
        }

        //Variaveis de controle do status
        refScriptStatus.ultimoBotaoSelID  = this.ID;
        refScriptStatus.refUltimoBotaoSel = this.gameObject;


        refScriptStatus.SetTempoJogobasedOnFase();

        //atualiza os melhores tempos

        if (refMelhoresTempos == null)
        {
            refMelhoresTempos = GameObject.Find("MelhoresTempos").GetComponent <MelhoresTempos>();
        }

        refMelhoresTempos.TrocouFaseSelecionada();
    }
Пример #2
0
    //Selecao via status
    public void SelecionarBotaoFaseDentroStatus()
    {
        RemoverSelecaoBotaoFaseDentroStatus();

        GameObject[] listGO = GameObject.FindGameObjectsWithTag("Btn");
        for (int i = 0; i < listGO.Length; i++)
        {
            Btn_Fase btn = listGO[i].gameObject.GetComponent <Btn_Fase>();       // Tira a cor do botao atual e adiciona cor ao Tint do outro;
            spriteUltimoBtnSelecionado = listGO[i].gameObject.renderer.material; //.GetComponent<OTSprite>();

            if (btn.ID == this.faseID)                                           // Se for o botao correto;
            {
                GameObject   obj     = GameObject.Find("Images");
                ImagesScript iscript = obj.GetComponent <ImagesScript>();

                this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[btn.ID + 6];                 // E somado 6 pois e a quantidade de posiçoes que devem ser puladas do array de imagens;//this.spriteUltimoBtnSelecionado.mainTexture = (Texture2D)iscript.imagem[7];// Selecionado;
                ultimoBotaoSelID  = btn.ID;
                refUltimoBotaoSel = listGO[i].gameObject;
                btn.selecionado   = true;


                break;
            }
        }


        //SetTempoJogobasedOnFase();

        //atualiza os melhores tempos
        if (refMelhoresTemposS == null)
        {
            refMelhoresTemposS = GameObject.Find("MelhoresTempos").GetComponent <MelhoresTempos>();
        }

        refMelhoresTemposS.TrocouFaseSelecionada();
    }
Пример #3
0
    // Camera camera1 = null;
#endif

    // Use this for initialization
    void Start()
    {
#if v1
        fase = new Descritores_MD.Fase();
#endif
#if v2
        //if (camera1 == null)
        //    camera1 = GameObject.Find("Main Camera").GetComponent<Camera>();

        if (refScriptStatus == null)
        {
            refScriptStatus = GameObject.Find("Status").GetComponent <Status>();
        }

        if (refSeuSprite == null)
        {
            refSeuSprite = this.gameObject.renderer.material;            //refSeuSprite = this.GetComponent<OTSprite>();
        }
        if (refMelhoresTempos == null)
        {
            refMelhoresTempos = GameObject.Find("MelhoresTempos").GetComponent <MelhoresTempos>();
        }

        char c = this.gameObject.name[this.gameObject.name.Length - 1];       // Pega a última posição;

        string str = "";
        str    += c;
        this.ID = int.Parse(str);         // Logica funciona de 0 a 9;

        // Carregar informações do nível:
        str  = "lvl";
        str += this.ID;

        if (!jaDefiniuBloqueio)
        {
            int tmp = PlayerPrefs.GetInt((str + "b")); // Todos os levels tem sua chave salva como lvl+ID+info. Ex: lvl1b (Pega o bool para saber se está bloqueado ou não);
            if (tmp == 0)
            {
                if (this.ID != 1)
                {//botao 1 é sempre liberado
                    this.bloqueado    = true;
                    jaDefiniuBloqueio = true;
                }
            }
            else if (tmp == 1)//se nao esta bloqueado
            {
                this.bloqueado    = false;
                jaDefiniuBloqueio = true;
            }

            //LiberarTodasFasesDebug();
        }

        /*else
         *  Debug.LogError("Não foi lida uma das informações de arquivo!");
         */

        //this.tempo = PlayerPrefs.GetFloat((str+"t")); // Retorna o tempo;
        //if(this.tempo <= 0.0f){}// Tempo não exite;

        // Imagens:
        //this.sprite = this.gameObject.GetComponent<OTSprite>();

        this.sprite = this.gameObject.renderer.material;

        if (!selecionado)//Se  o botão nao estiver selecionado, dai tu define a imagem padrao baseado se o botao esta liberado ou nao
        {
            GameObject   obj     = GameObject.Find("Images");
            ImagesScript iscript = obj.GetComponent <ImagesScript>();

            if (this.bloqueado)
            {
                this.sprite.mainTexture = (Texture2D)iscript.imagem[0];
            }
            else//trocar dependente de qual sprite
            {
                //this.sprite.image = iscript.imagem[1];
                this.sprite.mainTexture = (Texture2D)iscript.imagem[this.ID];
            }
        }
#endif
    }