音乐文件路径管理
2017-11-01 本文已影响0人
貪狼大人
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ResourseLoad : SingletonMono<ResourseLoad>
{
public T ResourceLoadObj<T>(/*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<T>(filePath);
}
}