主题
BaseSky
概览
| 字段 | 值 |
|---|---|
| Kind | Unit · 单位 Unit |
| Realm | common |
继承关系
- Unit(4 属性 / 25 函数 / 6 事件)
- [BaseSky](1 属性)
- GradientSky(5 属性)
- PresetSky(2 属性)
- QuadGradientSky(12 属性)
- Sky(7 属性)
- [BaseSky](1 属性)
继承成员
1 个来源 / 4 属性 / 25 函数 / 6 事件
- 来自 Unit(4 属性 / 25 函数 / 6 事件)
- 属性:
AssetId、Name、Desc、Parent - 函数:
ClearAllChildren、GetChildren、GetDescendants、IsAncestorOf、IsDescendantOf、FindFirstAncestor、FindFirstAncestorWhichIsA、FindFirstAncestorOfClass、FindFirstChild、FindFirstChildWhichIsA、FindFirstChildOfClass、HasChildren、GetChildCount、GetChildAtIndex、SetAttribute、GetAttribute、GetAllProps、Clone、IsA、Destroy、GetPropertyChangedSignal、GetAttributeChangedSignal、FindFromPath、GetFullPath、GetDebugId - 事件:
ChildAdded、ChildRemoved、DescendantAdded、DescendantRemoving、AncestryChanged、Destroying
- 属性:
BaseSky 是公开天空类型的抽象基类,统一提供是否受雾影响的 AffectedByFog 属性。
适用场景
需要让具体天空效果参与或忽略全局雾效时,创建 Sky、PresetSky、GradientSky 等公开子类并设置 AffectedByFog。
使用要点
不要创建 BaseSky;创建具体天空子类后将 Parent 设置为 LightingService,再读写继承的 AffectedByFog 属性。
注意事项
BaseSky 本身不可直接创建。具体天空实例必须挂载到 LightingService 下才参与天空选举与渲染。
代码示例
创建具体天空子类并启用雾效影响
lua
-- @runtime client
local Lighting = game:GetService('LightingService')
local sky = game:CreateUnit('Sky', {
Parent = Lighting,
AffectedByFog = true,
})
print('天空是否受雾影响:', sky.AffectedByFog)属性 (1)
| Name | 类型 | 默认值 | 说明 |
|---|---|---|---|
AffectedByFog | Bool | false | 控制天空是否受全局雾效影响。 |
