Fire

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

ไฟ Classเช่นเดียวกับวัตถุปาร์ติลเอมิตเตอร์อื่น ๆ ไฟจะปล่อย

อนุภาคไฟจะปล่อยจากศูนย์กลางของ BasePart ไปยังที่พวกเขาเป็นลูกพี่ลูกน้อง อนุภาคจะปล่อยไปทางด้านบน (+Y) แต่

เมื่อ Enabled ถู

เป็นเจ้าของเพื่อช่วยสร้างสภาพแวดล้อมที่เป็นเหมือนกันรอบวัตถุไฟ ลองเพิ่ม PointLight ด้วยสีส้ม Color เพื่อช่วยให้ดูเหมือนจริงมากขึ้น สิ่งนี้สามา

วัตถุไฟประกอบด้วยสองตัวอิมิตเตอร์ ทั้งสองจะได้รับผลกระทบจาก Size ของไฟ Class

ในขณะที่ไฟจริงไม่ได้แพร่กระจายไปทั่วไป ไฟ วัตถุ ไม่ได้แพร่กระจายไปทั่วไปในเกมของคุณ หากคุณสังเกตพฤติกรรมนี้ในเกมของคุณ มันกำลังเกิดขึ้นเนื่องจาก 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

สรุป

คุณสมบัติ

  • อ่านพร้อมๆ กัน

    กำหนดสีของอนุภาคไฟฉลอง (ภายนอก)

  • อ่านพร้อมๆ กัน

    กำหนดว่าอนุภาคไฟไหม้จะปล่อย

  • ไม่ซ้ำ
    อ่านพร้อมๆ กัน

    กำหนดความเร็วที่อนุภาคจะปล่อย

  • ซ่อนอยู่
    ไม่ซ้ำ
    อ่านพร้อมๆ กัน
  • อ่านพร้อมๆ กัน

    กำหนดสีของอนุภาคเปลวไฟที่รอง (ใน)

  • ไม่ซ้ำ
    อ่านพร้อมๆ กัน

    กำหนดขนาดอนุภาคไฟ

  • อ่านพร้อมๆ กัน

    มีค่าระหว่าง 0-1 ที่ควบคุมความเร็วของเอฟเฟ็กต์อนุภาค

คุณสมบัติ

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 เร็วแค่ไหน มันจำกั

ตัวอย่างโค้ด

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 อย่างไรก็ตาม สีนี้จะแตก

ตัวอย่างโค้ด

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 ขนาดของเปลวไฟจะไม่ตรงกับ 1:1 ขนาดใน studs ที่เล็กกว่า

เพื่อทำให้สภาพแวดล้อมของคุณเหมาะสมกันมากขึ้น ลองเพิ่ม PointLight เป็นพี่น้องของวัตถุ Fire ตั้งแต่นี้ต่อไป ตั้งค่า PointLight.Brightness

ตัวอย่างโค้ด

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 มันแช่แข็งเวลา

วิธีการ

อีเวนต์