Exemple #1
0
        private static GOInfo GetGOInfo(string name)
        {
            var iter = goTable.GetEnumerator();

            while (iter.MoveNext())
            {
                GOInfo info = iter.Current.Key;
                if (info.name == name)
                {
                    return(info);
                }
            }

            // 没有就创建
            GOInfo goInfo = new GOInfo()
            {
                name = name, prefab = ResourceUtil.Load <GameObject>(name)
            };
            Queue <GameObject> queue = new Queue <GameObject>();

            goTable.Add(goInfo, queue);
            return(goInfo);
        }
Exemple #2
0
 /// <summary>
 /// 播放一段声音
 /// </summary>
 /// <param name="soundName">声音名</param>
 public void PlaySound(string soundName, float volumn = 1f)
 {
     mAudioSource.PlayOneShot(ResourceUtil.Load <AudioClip>(soundName), volumn * this.volumn);
     ResourceUtil.Unload(soundName);
 }
 public override void Dispose()
 {
     ResourceUtil.UnLoadGameObjectFromAb(PREFAB_NAME_ALERTBG);
     base.Dispose();
 }
Exemple #4
0
        public static T Create <T>(string prefabName, Vector3 generatePos) where T : Entity
        {
            GameObject go = ResourceUtil.Load <GameObject>(prefabName).Instantiate().Position(generatePos);

            return(Create <T>(go));
        }
Exemple #5
0
 public void Awake()
 {
     GameObject = ResourceUtil.Load <GameObject>("ResHold").Instantiate();
     GameObject.AddComponent <ComponentView>().Component = this;
     Collector = GameObject.GetComponent <ReferenceCollector>();
 }
Exemple #6
0
 /// <summary>
 /// 播放一段声音
 /// </summary>
 /// <param name="soundName">声音名</param>
 public void PlaySound(string soundName)
 {
     mAudioSource.PlayOneShot(ResourceUtil.Load <AudioClip>(soundName));
     ResourceUtil.Unload(soundName);
 }