Fire

显示已弃用

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

火焰 是几个预制粒子发射类别之一。 像其他粒子发射对象,火焰会在父级关联到BasePartAttachment ,并且在0> Class.Fire.Enabled|Enabled0> 中

火焰粒子从BasePart的中心发射到其父辈,它们是由Fire.Heat的子集。粒子向上 (+Y) 发射,但使用Attachment作为父辈可以修改发射位置/方向。使用1>Class.附件

Enabled 关闭时,现有

火焰对象体本拥有不会发光。要帮助创建一个粘合环境,请尝试添加一个 PointLight 用橙色 Color 。这可以帮助你的火焰更具现实感。

火对象由两个发射器组成。 两个都受到 SizeHeatColor 和 2> Class.Fire.SecondaryColor|Second

与实际火焰不同, Fire 对象 不会在自己的头部部署。 如果您在游戏中发现此行为,它是因为Script 引发的。

代码示例

This code sample adds Fire to all BasePart in the Workspace named "Torch".

Lighting Torches

for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end

概要

属性

属性

Color

读取并联

颜色属性由 Fire 对象的大小 Class.Fire 发射的颜色决定。它是基于火焰外部的颜色。

一通用来说,更凉爽的火焰在火触发的外部。因此,火焰的外部部分是红色或橙色-黄色的。如果整个环境都是红色的,火焰将不再感觉逼真,因此,请将 PointLight 设置为

代码示例

This code sample adds Fire to all BasePart in the Workspace named "Torch".

Lighting Torches

for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end

Enabled

读取并联

启用属性,与 ParticleEmitter.Enabled 一样,确定是否发射火焰粒子。任何发射的粒子都会继续渲染直到其有效期过期。 此属性对于在预制火焰效果消失直到需要它们的时候有用。 由于火焰


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

代码示例

This code sample allows a player to click the parent BasePart to toggle a fire effect.

Toggle Fire Effect

local part = script.Parent
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
local fire = Instance.new("Fire")
fire.Parent = part
local light = Instance.new("PointLight")
light.Parent = part
local function onClick()
fire.Enabled = not fire.Enabled
light.Enabled = fire.Enabled
end
clickDetector.MouseClick:Connect(onClick)

Heat

未复制
读取并联

热属性决定了热粒子从 Fire 对象发射的速度。它受到 BasePartAttachment 的上限。正向值在 1>Class.ParticleEmitter.Acceleration1>

代码示例

This code sample adds Fire to all BasePart in the Workspace named "Torch".

Lighting Torches

for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end

LocalTransparencyModifier

隐藏
未复制
读取并联

SecondaryColor

读取并联

SecondaryColor 属性确定小粒子发射的颜色由 Fire 对象设置。它是基本上是烈火的颜色。下面,您可以看到烈火的 SecondaryColor 设置为白色,与大型, 外部粒子,

代码示例

This code sample adds Fire to all BasePart in the Workspace named "Torch".

Lighting Torches

for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end

Size

未复制
读取并联

这个属性决定火焰粒子的大小。它必须在 2 到 30 之间。与 ParticleEmitter.Size 不同,火焰的实际大小不会与相当大小的等同;它是稍微小一点。

要使您的环境更有凝聚力,请尝试将 PointLight 作为兄弟添加到 Fire 对象。设置 PointLight.Brightness 和 2>Class.PointLight.Range2> 比例为此属性,以便大型火焰产生更多光。

代码示例

This code sample adds Fire to all BasePart in the Workspace named "Torch".

Lighting Torches

for _, child in pairs(workspace:GetChildren()) do
if child.Name == "Torch" and child:IsA("BasePart") then
local fire = Instance.new("Fire")
fire.Heat = 10
fire.Color = child.Color
fire.SecondaryColor = Color3.new(1, 1, 1) -- White
fire.Size = math.max(child.Size.X, child.Size.Z) -- Pick the larger of the two dimensions
fire.Parent = child
end
end

TimeScale

读取并联

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

方法

活动