Fire

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

火焰 是一些預製粒子發射類別中的一個。像其他粒子發射對象一樣,火焰會在與BasePartAttachment 的對象相親時發出粒子。這個對象有助於在

火焰粒子從BasePart的中心發射到它們的父親。粒子向上 (+Y) 方向發射;但使用Fire.Heat的父親來發射在底部(-Y)方向來發射。使用Attachment作為父親而不是發射在

Class.Fire.Enabled|Enabled 關閉時,現

火焰物件體本擁有不發光。要幫助創建一個堅強的環境,請尝试添加 PointLight 與橙色 Color 。這可以幫助你的火焰顯示更實際。

火焰物體由兩個發射器組成。 兩個都受到 SizeHeatColor 和 2>

與實際火焰不同, 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 對象的外部。

一般來說,火焰在火焰外面。因此,火焰看起來更逼真,如果外部層是紅色或橙色-黃色。一個閃亮的火焰,在周圍環境中提供光,使其感覺更黏合。因此,將 <

範例程式碼

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 的上限 (-25, 25) 決定的。正向值在 <

範例程式碼

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 不同,火焰的實際大小不會與相當大小的 Stud 匹配;它是稍微小一點。

要讓您的環境更有凝聚力,請將 PointLight 作為兄弟添加到 Fire 對物件。設置 PointLight.Brightness 和 1> Class.PointLight.Range1> 比例到此屬性,以便大型火焰產生更多光。

範例程式碼

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 凍結時間。

方法

活動