Python微信订餐小程序课程视频
https://edu.csdn.net/course/detail/36074
Python实战量化交易理财系统
https://edu.csdn.net/course/detail/35475阅读目录(Content)
1.前言
一转眼离Book of the Dead Environment Demo开放下载已过去多年,当时因为技术力有限,以及对HDRP理解尚浅,
所以这篇文章一直搁浅到了现在。如今工作重心已转向UE。Unity方面也对新版本的HDRP有了一些认知,故感触颇多。
Book of the Dead——死者之书,是Unity2018年展示的Demo作品。
主要展现HDRP的运用、源码修改展示,音频处理方案等。
该Demo已传百度网盘:
链接:https://pan.baidu.com/s/1UBY0EcAGLwRJEW1VaDyUgQ 提取码:f47c
打开使用版本:unity2018.2.21f1
2.Feature
下面直接对Demo中Feature文件夹中的技术内容进行展开。
2.1 PropertyMaster
该模块链接了Volume数值与具体组件对象,贯穿整个项目,
因此提前讲解。
脚本中的PropertyVolumeComponentBase
、PropertyVolumeComponent
继承自VolumeComponent
继承了VolumeComponent
也就是说可以在Volume中被加载,因此项目里继承了PropertyVolumeComponent
的那些组件也就可以挂载于Volume中:
而Volume绑定的是通用组件,无法和场景中的具体对象绑定或是数值同步。这时候
扩展的PropertyVolumeComponent
就出现作用了:
public abstract class PropertyVolumeComponent : PropertyVolumeComponentBase
where X : PropertyVolumeComponent {
static PropertyVolumeComponent() {
PropertyMaster.componentTypes.Add(typeof(X));
}
}
PropertyMaster.componentTypes会记录需要和场景中具体对象绑定的所有类型,然后做这一步操作:
public void UpdateProperties() {//在PropertyMaster类里
var manager = VolumeManager.instance;
var stack = manager.stack;//拿到当前Volume
if (updateVolumes && volumeTrigger && volumeLayerMask != 0)
manager.Update(volumeTrigger, volumeLayerMask);
foreach (var type in componentTypes) {//刚刚缓存的类型
var component = (PropertyVolumeComponentBase) stack.GetComponent(type);
if (component.active)
component.OverrideProperties(this);
}
}
PropertyMaster实现了IExposedPropertyTable
接口,在上述代码的OverrideProperties处,
将自己注入进去,再通过ExposedReference
和名称的Guid匹配,拿到对应场景对象。
关于ExposedRenference
具体可以看这篇测试:https://blog.csdn.net/hont/p/15815344.html
PropertyInspector
则提供Volume信息的Debug,在编辑器下获取到属于当前Layer的Volume,以方便查看: