Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (!onTuto)
        {
            float vAxis = VerticalAxis();

            if (Mathf.Abs(vAxis) > 0.1f)
            {
                if (vAxis < 0f)
                {
                    play.material.color         = Color.gray;
                    instructions.material.color = Color.white;
                    up = false;
                }
                if (vAxis > 0f)
                {
                    play.material.color         = Color.white;
                    instructions.material.color = Color.gray;
                    up = true;
                }
            }

            if (waitTime > 0f)
            {
                waitTime -= Time.deltaTime;
            }
            else if (control.Accept())
            {
                if (up)
                {
                    Application.LoadLevel(Application.loadedLevel + 1);
                }
                else
                {
                    SetTuto(true);
                }
            }
        }
        else
        {
            if (waitTime > 0f)
            {
                waitTime -= Time.deltaTime;
            }
            else if (control.Accept())
            {
                if (lore)
                {
                    lore     = false;
                    waitTime = 0.5f;
                }
                else
                {
                    SetTuto(false);
                }
            }
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;

        if (time > firsTime)
        {
            if (firsTime > 0)
            {
                control  = GameObject.FindGameObjectWithTag("Control").GetComponent <Control>();
                firsTime = -1;
            }

            switch (state)
            {
            case IntroState.Detecting:
                if (WiiMoteControl.wiimote_count() > 1)
                {
                    SetState(IntroState.Studio);
                }
                break;

            case IntroState.Studio:
                if (time > studioTime)
                {
                    SetState(IntroState.Credits);
                }
                break;

            case IntroState.Credits:
                if (time > creditsTime)
                {
                    SetState(IntroState.Video);
                }
                break;

            case IntroState.Video:
                if (control.Accept())
                {
                    Application.LoadLevel(Application.loadedLevel + 1);
                }
                if (!((MovieTexture)renderer.material.mainTexture).isPlaying && !audio.isPlaying)
                {
                    Application.LoadLevel(Application.loadedLevel + 1);
                }
                break;
            }
        }
    }