Exemplo n.º 1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            _startRay = true;
        }

        if (Input.GetMouseButtonUp(0))
        {
            _startRay = false;
        }

        if (_startRay)
        {
            Debug.DrawLine(transform.position * 2, transform.forward * -4);
            RaycastHit hit;
            if (Physics.Raycast(transform.position * 2, transform.forward * -4, out hit))
            {
                if (hit.collider.name == "UpRayControler")
                {
                    if (Game.CurrentPictogram == System.Convert.ToInt16(transform.GetComponentInChildren <Renderer>().material.name))
                    {
                        Game.PlayerGuessedPictogram();
                        PictogramElapsedTime.StartTheClock();
                        DrawnPictogram.ResetRandomPictogram();
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void GetRandomPictogram()
    {
        int currentRandomPictogramValue = 0;

        do
        {
            currentRandomPictogramValue = Random.Range(0, 6);
        } while (_lastRandomPictogramValue == currentRandomPictogramValue);

        int curentPictogramValue = Game.GetRandomPictogram(currentRandomPictogramValue);

        Game.CurrentPictogram = curentPictogramValue;

        GetComponent <GUITexture>().texture = Resources.Load("PictogramTextures/" + curentPictogramValue) as Texture;
        GetComponent <GUITexture>().enabled = true;

        PictogramElapsedTime.StartTheClock();

        _lastRandomPictogramValue = currentRandomPictogramValue;
    }