Esempio n. 1
0
    private void Update()
    {
        if (selected != null)
        {
            if (changeColor)
            {
                crosshair.color = defaultColor;
            }
            if (showImage)
            {
                crosshair.sprite = defaultImage;
            }

            popUpText.gameObject.SetActive(false);
            selected = null;
        }

        var        ray = Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2));
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, aimRange))
        {
            var selection = hit.transform;
            var video     = selection.GetComponent <VideoPlayerHelper>();
            if (video == null)
            {
                return;
            }

            if (changeColor)
            {
                crosshair.color = newColor;
            }
            if (showImage)
            {
                crosshair.sprite = targetingImage;
            }

            popUpText.gameObject.SetActive(true);
            selected = video;
        }

        if (selected != null)
        {
            if (Input.GetMouseButtonDown(0))
            {
                selected.Play();
                DatabaseManager.currentUser.score += 10;
                DatabaseManager.instance.SaveData();
            }
        }
    }
Esempio n. 2
0
 void Play()
 {
     mVideoPlayer.Play(-1);
 }