Smoke

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

烟雾是几个粒子

Smoke.Enabled 关闭时,此

烟雾粒子仅从BasePart的中心发出,它们的父级是一个Attachment。父级 Smoke 对象到一个Class.附加器而不是直接到父级 Smoke 对象,允许自定义粒子的开始位置。

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

概要

属性

属性

Color

读取并联

颜色属性确定所有粒子发射的颜色,通过 Smoke 对象(现有和未来粒子)。它与 ParticleEmitter.Color 相同,除了它是一个颜色而不是一个 ColorSequence 。一个

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Enabled

读取并联

启用属性,与 ParticleEmitter.Enabled 一样,决定是否发出烟雾粒。任何粒子已发出的粒子都会继续渲染直到它们的生命时间结束。 此属性有助于在以后将预制烟雾效果关闭直到


local Debris = game:GetService("Debris")
local part = script.Parent
function stopSmoke(smoke)
smoke.Enabled = false -- No more new particles
Debris:AddItem(smoke, 10) -- Remove the object after a delay (after existing particles have expired)
end
stopSmoke(part.Smoke)

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

LocalTransparencyModifier

隐藏
未复制
读取并联

Opacity

未复制
读取并联

不透明度决定烟雾粒的不透明度。它必须在 [0, 1] 范围内。 此属性在与零部件的 BasePart.Transparency 或 ParticleEmitter 的 ParticleEmitter.Transparency 相比是完全隐藏的:一个值为 0 是完全隐藏的, 1 是完全显示的。

Roblox 使用的材质有些是半透明的,因此将此属性设置为 1 仍然会在渲染烟雾中产生透明度。

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

RiseVelocity

未复制
读取并联

RiseVelocity 与 ParticleEmitter.SpeedFire.Heat 一样行为:它确定烟雾粒子在其生命时间内移动的速度。它必须在范围 [-25, 25] 下穿射到父级 BasePart 下。负值会导致粒子在父级的底部(-Y)方向发射。

使用 Smoke 效果生成雾时,将此属性设置为 0。对于大型烟雾效果,请使雾渐变(2到8)。对于烟囱和烟囱,更高的值是合适的。

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

Size

未复制
读取并联

Class.Smoke 的大小属性确定新发射的烟雾粒子的大小。与 Smoke.Color 不同,这个属性不会

代码示例

Add Smoke to All Fire

local function recurseForFire(object)
-- Check if we found a Fire object that has no Smoke
if object:IsA("Fire") and not object.Parent:FindFirstChildOfClass("Smoke") then
-- Create a smoke effect for this fire
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(0, 0, 0)
smoke.Opacity = 0.15
smoke.RiseVelocity = 4
smoke.Size = object.Size / 4
smoke.Parent = object.Parent
end
-- Continue search for Fire objects
for _, child in pairs(object:GetChildren()) do
recurseForFire(child)
end
end
recurseForFire(workspace)

TimeScale

读取并联

一个值在 0-1 之间控制粒子效果的速度。在 1 上它以正常速度运行,在 0.5 上它以半速运行,而在 0 上它以冻结时间。

方法

活动