Beispiel #1
0
    public void HandleCollisionWithVinyl2(GameObject vinylGameObject)
    {
        Debug.Log("In HandleCollisionWithVinyl2");

        if (playlistScript.trackType == PlaylistScript.TrackType.artist)
        {
            spotifyManagerScript.Follow(FollowType.Artist, playlistScript.artistId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Followed " + playlistScript.playlistName + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.track)
        {
            spotifyManagerScript.SaveTrack(playlistScript.trackId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Saved " + playlistScript.getPlaylistName() + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.playlist)
        {
            spotifyManagerScript.FollowPlaylist(playlistScript.ownerId, playlistScript.playlistId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Followed  " + playlistScript.getPlaylistName() + "!";
        }

        else if (playlistScript.trackType == PlaylistScript.TrackType.album)
        {
            spotifyManagerScript.SaveAlbum(playlistScript.albumId);

            GameObject spawnedUIConfirmation = Instantiate(uiConfirmation,
                                                           gameObject.transform.position + new Vector3(0, 0.3f, 0), Quaternion.identity);

            spawnedUIConfirmation.transform.Find("Follow Confirmation Text").GetComponent <TextMeshProUGUI>().text =
                "Saved " + playlistScript.getPlaylistName() + "!";
        }

        Destroy(vinylGameObject);
        Destroy(gameObject);
    }