Example #1
0
    void Start()
    {
        // initialising reference variables
        anim = GetComponent<Animator>();
        col = GetComponent<CapsuleCollider>();
        //enemy = GameObject.Find("Enemy").transform;

        if(anim.layerCount == 2)
            anim.SetLayerWeight(1, 1);

        leapManager = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<LeapManager>();
        debugText = GameObject.Find("DebugText");

        GameObject objButton = GameObject.Find("BtnJump");
        btnJump = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("BtnWave");
        btnWave = objButton ? objButton.GetComponent<LeapGuiButton>() : null;
    }
Example #2
0
    void Update()
    {
        GameObject objButton = GameObject.Find("PlayButton");
        buttonPlay = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("Game1");
        buttonGame1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("BackMainMenu");
        buttonBackMainMenu = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q1Option1");
        buttonQ1Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q1Option2");
        buttonQ1Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q1Option3");
        buttonQ1Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q1Option4");
        buttonQ1Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q2Option1");
        buttonQ2Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q2Option2");
        buttonQ2Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q2Option3");
        buttonQ2Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q2Option4");
        buttonQ2Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q3Option1");
        buttonQ3Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q3Option2");
        buttonQ3Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q3Option3");
        buttonQ3Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q3Option4");
        buttonQ3Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q4Option1");
        buttonQ4Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q4Option2");
        buttonQ4Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q4Option3");
        buttonQ4Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q4Option4");
        buttonQ4Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q5Option1");
        buttonQ5Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q5Option2");
        buttonQ5Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q5Option3");
        buttonQ5Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q5Option4");
        buttonQ5Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q6Option1");
        buttonQ6Option1 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q6Option2");
        buttonQ6Option2 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q6Option3");
        buttonQ6Option3 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("q6Option4");
        buttonQ6Option4 = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        objButton = GameObject.Find("CloseButton");
        buttonClose = objButton ? objButton.GetComponent<LeapGuiButton>() : null;

        if(buttonPlay && buttonPlay.IsButtonPressed()){
            audio.Play();
            Invoke("PlayGame", 0.25f);
        }
        if(buttonGame1 && buttonGame1.IsButtonPressed()){
            audio.Play();
            Invoke("Game1", 0.25f);
        }
        if(buttonBackMainMenu && buttonBackMainMenu.IsButtonPressed()){
            audio.Play();
            Invoke("BackMainMenu", 0.25f);
        }
        if(buttonQ1Option1 && buttonQ1Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q1Option1", 0.25f);
        }
        if(buttonQ1Option2 && buttonQ1Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q1Option2", 0.25f);
        }
        if(buttonQ1Option3 && buttonQ1Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q1Option3", 0.25f);
        }
        if(buttonQ1Option4 && buttonQ1Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q1Option4", 0.25f);
        }
        if(buttonQ2Option1 && buttonQ2Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q2Option1", 0.25f);
        }
        if(buttonQ2Option2 && buttonQ2Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q2Option2", 0.25f);
        }
        if(buttonQ2Option3 && buttonQ2Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q2Option3", 0.25f);
        }
        if(buttonQ2Option4 && buttonQ2Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q2Option4", 0.25f);
        }
        if(buttonQ3Option1 && buttonQ3Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q3Option1", 0.25f);
        }
        if(buttonQ3Option2 && buttonQ3Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q3Option2", 0.25f);
        }
        if(buttonQ3Option3 && buttonQ3Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q3Option3", 0.25f);
        }
        if(buttonQ3Option4 && buttonQ3Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q3Option4", 0.25f);
        }
        if(buttonQ4Option1 && buttonQ4Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q4Option1", 0.25f);
        }
        if(buttonQ4Option2 && buttonQ4Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q4Option2", 0.25f);
        }
        if(buttonQ4Option3 && buttonQ4Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q4Option3", 0.25f);
        }
        if(buttonQ4Option4 && buttonQ4Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q4Option4", 0.25f);
        }
        if(buttonQ5Option1 && buttonQ5Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q5Option1", 0.25f);
        }
        if(buttonQ5Option2 && buttonQ5Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q5Option2", 0.25f);
        }
        if(buttonQ5Option3 && buttonQ5Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q5Option3", 0.25f);
        }
        if(buttonQ5Option4 && buttonQ5Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q5Option4", 0.25f);
        }
        if(buttonQ6Option1 && buttonQ6Option1.IsButtonPressed()){
            audio.Play();
            Invoke("Q6Option1", 0.25f);
        }
        if(buttonQ6Option2 && buttonQ6Option2.IsButtonPressed()){
            audio.Play();
            Invoke("Q6Option2", 0.25f);
        }
        if(buttonQ6Option3 && buttonQ6Option3.IsButtonPressed()){
            audio.Play();
            Invoke("Q6Option3", 0.25f);
        }
        if(buttonQ6Option4 && buttonQ6Option4.IsButtonPressed()){
            audio.Play();
            Invoke("Q6Option4", 0.25f);
        }

        if(buttonClose && buttonClose.IsButtonPressed()){
            audio.Play();
            Invoke("CloseGame", 0.25f);
        }

        finalScore = (finalScore / 6) * 100;

        //		finalScoreText.Equals(finalScore.ToString());
    }
Example #3
0
    void Start()
    {
        try
        {

            GameObject thePlayer = GameObject.Find("DummyButton");
            LeapGUIButton = thePlayer.GetComponent<LeapGuiButton>();
            containsCursor = LeapGUIButton.isCursorIn;
            notContainCursor = LeapGUIButton.isCursorOut;

            leapController = new Leap.Controller();

            instance = this;
            leapInitialized = true;

            DontDestroyOnLoad(gameObject);

            string sMessage = leapController.Devices.Count > 0 ? "Ready." : "Please make sure the Leap-sensor is connected.";
            Debug.Log(sMessage);

        }
        catch(System.TypeInitializationException ex)
        {
            Debug.LogError(ex.ToString());
            if(debugText != null)
                debugText.guiText.text = "Please check the LeapMotion installation.";
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.ToString());
            if(debugText != null)
                debugText.guiText.text = ex.Message;
        }
    }