Пример #1
0
    IEnumerator Lerp(Collider collider)
    {
        Debug.LogError("Lerping");
        float t        = 0f;
        float duration = 2f;

        Vector3 startPostition = collider.transform.position;
        Vector3 endPostition   = disc.transform.position;

        Quaternion startRotation = collider.transform.rotation;
        Quaternion endRotation   = disc.transform.rotation;


        while (t < 1)
        {
            t += Time.deltaTime / duration;

            collider.transform.position = Vector3.Lerp(startPostition, endPostition, t);
            collider.transform.rotation = Quaternion.Lerp(startRotation, endRotation, t);

            yield return(null);
        }

        VinylScript    vinylScript    = collider.gameObject.GetComponent <VinylScript>();
        PlaylistScript playlistScript = vinylScript.playlistScript;

        playlistScript.PlaySomething();
    }
Пример #2
0
    /// <summary>
    /// Logic for when a raycast line collides with a collider and and the input button is pressed
    /// </summary>
    void RayCastInput()
    {
        RaycastHit hit;

        if (Physics.Raycast(this.transform.position, this.transform.forward, out hit, raycastDistance))
        {
            Debug.Log(hit.transform.name);

            ResumePlayback resumePlayback = hit.transform.GetComponent <ResumePlayback>();
            PausePlayback  pausePlayback  = hit.transform.GetComponent <PausePlayback>();
            PlaylistScript playlistScript = hit.transform.GetComponent <PlaylistScript>();
            LeftHandUI     leftHandUI     = hit.transform.GetComponent <LeftHandUI>();

            if (hit.transform.gameObject.tag == "key")
            {
                Text text = hit.transform.gameObject.GetComponentInChildren <Text>();

                keyboardManagerScript.GenerateInput(text.text);
            }

            if (resumePlayback != null)
            {
                resumePlayback.ResumePlaybackFunction();
            }
            else if (leftHandUI != null)
            {
                leftHandUI.OnRayCastHit();
            }
            else if (pausePlayback != null)
            {
                pausePlayback.PausePlaybackFunction();
            }
            else if (playlistScript != null)
            {
                if (playOnClick)
                {
                    playlistScript.PlaySomething();
                }

                if (GameObject.FindWithTag("vinyl") != null)
                {
                    Destroy(GameObject.FindWithTag("vinyl"));
                }

                if (GameObject.FindWithTag("followCube") != null)
                {
                    Destroy(GameObject.FindWithTag("followCube"));
                }

                InstansiateVinylWorking(hit, playlistScript);

                Debug.Log("Spawning Vinyl");
            }
        }
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        PlaylistScript playlistScript = (PlaylistScript)target;

        if (GUILayout.Button("Play Track"))
        {
            playlistScript.PlaySomething();
        }

        if (GUILayout.Button("Spawn Vinyl"))
        {
            playlistScript.SpawnVinyl();
        }
    }