音乐文件路径管理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ResourseLoad : SingletonMono 
{

    public T ResourceLoadObj(/*meiju*/object obj) where T:Object
    {
        string currentName = obj.GetType().Name;
        //路径
        string filePath = string.Empty;
        switch (currentName)
        {
            case "Music_Main":                
                {
                    filePath = "Music/Main/" + obj.ToString();
                    break;
                }
            case "Music_Item":
                {
                    filePath = "Music/Items/" + obj.ToString();
                    break;
                }
            case "Music_Feeds":
                {
                    filePath = "Music/Feeds/" + obj.ToString();
                    break;
                }
            case "Monsters":
                {
                    filePath = "Music/Monsters/" + obj.ToString();
                    break;
                }
            case "Towers":
                {
                    filePath = "Music/Towers/" + obj.ToString();
                    break;
                }
            default:
                break;
        }
        return Resources.Load(filePath);
    }
}

你可能感兴趣的:(音乐文件路径管理)