public void OnRecognize(RecognitionResult result, DrawDetector detector)
    {
        if (result != RecognitionResult.Empty)
        {
            StartCoroutine(DeleteCoroutine(detector));

            spawnOffset = transform.forward * 0.1f;

            Debug.Log(result.gesture.id + "\n" + Mathf.RoundToInt(result.score.score * 100) + "%");


            if (result.gesture.id == "Glyph1")
            {
                Instantiate(kekPrefab, transform.position + spawnOffset, Quaternion.identity);
            }
            else
            {
                player.GetComponent <PlayerScript>().GetDamageBuff();
                Instantiate(malPrefab, transform.position + spawnOffset, Quaternion.identity);
            }
        }
        else
        {
            detector.ClearLines();
            Debug.Log("? ? ?");
        }
    }
    void Start()
    {
        detectors     = FindObjectsOfType <DrawDetector>();
        playerDrawDet = GetComponentInChildren <DrawDetector>();

        DisableDrawing();

        m_CharacterController = GetComponent <CharacterController>();
        m_Camera = Camera.main;
        m_OriginalCameraPosition = m_Camera.transform.localPosition;
        m_StepCycle   = 0f;
        m_NextStep    = m_StepCycle / 2f;
        m_Jumping     = false;
        m_AudioSource = GetComponent <AudioSource>();

        spraying = false;
    }
Ejemplo n.º 3
0
    GameObject mainMenuScreen;             //Main menu screen

    // Use this for initialization
    void Start()
    {
        countTilCor = 0;

        //Initialize variables
        pageSB    = new List <GameObject>();
        pages     = GameObject.FindGameObjectsWithTag("page").OrderBy(go => go.name).ToArray();
        totalPage = pages.Count();

        Recognizer          = GameObject.Find("Recognizer").gameObject.GetComponent <Recognizer>();
        dd                  = GameObject.Find("DrawArea_Free").gameObject.GetComponent <DrawDetector>();
        drawArea            = GameObject.Find("freeDraw");
        eraser              = GameObject.Find("Eraser");
        rightTurnPageButton = GameObject.Find("forwardPage");
        mainMenuScreen      = GameObject.Find("mainMenu");
        target              = GameObject.Find("target");


        //Start at page 0 (main menu)
        page = 0;
        turnOnPage(page);
        mainMenuOn = true;
        mainMenuScreen.SetActive(false);

        //Turn off the right turn button in the beginning
        rightTurnPageButton.SetActive(false);

        //Speech Bubbles
        speech = 0;

        //Determining which pages can be turned immediately
        for (int i = 0; i < totalPage; i++)
        {
            canTurnPage.Add(false);
        }

        //Determining which pages are diary pages
        for (int i = 0; i < totalPage; i++)
        {
            isDiaryPage.Add(false);
        }
        isDiaryPage[2]  = true;
        isDiaryPage[6]  = true;
        isDiaryPage[10] = true;
        isDiaryPage[14] = true;
        isDiaryPage[18] = true;
        isDiaryPage[22] = true;
        isDiaryPage[26] = true;

        //Determining which pages are puzzle
        for (int i = 0; i < totalPage; i++)
        {
            isPuzzlePage.Add(false);
        }
        isPuzzlePage[3]  = true;
        isPuzzlePage[7]  = true;
        isPuzzlePage[11] = true;
        isPuzzlePage[15] = true;
        isPuzzlePage[19] = true;
        isPuzzlePage[23] = true;
        isPuzzlePage[27] = true;

        //Set false on all puzzle pages, drawAreas needs to be set by hand
        drawArea.SetActive(false);
        eraser.SetActive(false);
    }
    IEnumerator DeleteCoroutine(DrawDetector det)
    {
        yield return(new WaitForSeconds(1.0f));

        det.ClearLines();
    }
 void Start()
 {
     _drawDetector = GetComponent <DrawDetector>() as DrawDetector;
 }