Game

Game

Game ์ „์—ญ ์˜ค๋ธŒ์ ํŠธ์—์š”.

์ด๋ฒคํŠธ

OnUpdateEvent

๋งค ํ”„๋ ˆ์ž„๋งˆ๋‹ค ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(updateTime), updateTime ์€ number ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local cube = Workspace.Cube
local playTime = 0

local function UpdateEvent(updateTime) --OnUpdateEvent๋กœ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋Š” updateTime ์ธ์ž๊ฐ€ ๊ณ ์ •์ ์œผ๋กœ ๋“ค์–ด๊ฐ€์š”.
    playTime = playTime + updateTime --์‹œ๊ฐ„์„ ๊ธฐ๋กํ•ด์š”.
end
cube.OnUpdateEvent:Connect(UpdateEvent) --Game์ด๋‚˜ ์˜ค๋ธŒ์ ํŠธ์— ๋งคํ”„๋ ˆ์ž„๋งˆ๋‹ค ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

OnEnterPlayer

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฒŒ์ž„์— ์ž…์žฅ ์‹œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(enterPlayer), enterPlayer ์€ Player ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function EnterPlayer(player) --OnEnterPlayer๋กœ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋Š” player ์ธ์ž๊ฐ€ ๊ณ ์ •์ ์œผ๋กœ ๋“ค์–ด๊ฐ€์š”.
    print("Enter " .. player.Name)
end
Game.OnEnterPlayer:Connect(EnterPlayer) --Game์— ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฒŒ์ž„์— ์ž…์žฅํ•˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

OnLeavePlayer

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฒŒ์ž„์—์„œ ๋‚˜๊ฐˆ ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(leavePlayer), leavePlayer ์€ Player ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function LeavePlayer(player) --OnLeavePlayer๋กœ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋Š” player ์ธ์ž๊ฐ€ ๊ณ ์ •์ ์œผ๋กœ ๋“ค์–ด๊ฐ€์š”.
    print("Leave " .. player.Name)
end
Game.OnLeavePlayer:Connect(LeavePlayer) --Game์— ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฒŒ์ž„์„ ์ข…๋ฃŒํ•˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

OnDeathCharacter

์บ๋ฆญํ„ฐ๊ฐ€ ์ฃฝ์„ ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(deathCharacter), deathCharacter ๋Š” Character ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function DeathCharacter(character) --OnDeathCharacter๋กœ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋Š” character ์ธ์ž๊ฐ€ ๊ณ ์ •์ ์œผ๋กœ ๋“ค์–ด๊ฐ€์š”.
    print("Death " .. character.Name)
end
Game.OnDeathCharacter:Connect(DeathCharacter) --Game์— ์บ๋ฆญํ„ฐ๊ฐ€ ์ฃฝ์œผ๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

OnSpawnCharacter

์บ๋ฆญํ„ฐ๊ฐ€ ์Šคํฐ ๋  ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(spawnCharacter), spawnCharacter ๋Š” Character ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function SpawnCharacter(character) --OnSpawnCharacter๋กœ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๋Š” character ์ธ์ž๊ฐ€ ๊ณ ์ •์ ์œผ๋กœ ๋“ค์–ด๊ฐ€์š”.
    print("Spawn " .. character.Name)
end
Game.OnSpawnCharacter:Connect(SpawnCharacter) --Game์— ์บ๋ฆญํ„ฐ๊ฐ€ ์ƒ์„ฑ๋˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

ํ•จ์ˆ˜

Phase AddPhase(string phasename)

๊ฒŒ์ž„์— ๋‹จ๊ณ„๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์–ด์š”. (์ถ”๊ฐ€ํ•  ๋‹จ๊ณ„ ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

--์„œ๋ฒ„ ์Šคํฌ๋ฆฝํŠธ์—์„œ-------------
local LobbyState = Game:AddPhase("Lobby") --์‚ฌ์šฉํ•  Phase๋ฅผ ๋“ฑ๋กํ•ด์š”.
local PlayState = Game:AddPhase("Play") --Phase๋Š” ์—ฌ๋Ÿฌ๊ฐœ๋„ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ์–ด์š”.
local ResultState = Game:AddPhase("Result")
Game:AddReplicateValue("GameState", "Lobby", Enum.ReplicateType.Changed, 0) --์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ๊ฐ„ ๋™๊ธฐํ™”๋˜๋Š” ๊ฐ’์„ ๋“ฑ๋กํ•˜๊ณ  ์ดˆ๊ธฐ๊ฐ’์„ ์„ค์ •ํ•œ๋’ค, ๊ฐ’์ด ๋ณ€๊ฒฝ๋ ๋•Œ๋งˆ๋‹ค ํ˜ธ์ถœ๋˜๊ฒŒ ํ•ด์š”.

--๊ฐ Phase๋กœ ์ „ํ™˜๋˜์—ˆ์„๋•Œ ์ฒ˜๋ฆฌํ•  ์ด๋ฒคํŠธ ํ•จ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•ด์š”.
local function EnterLobbyState()
    Game.GameState = "Lobby"
    print("Enter Lobby State")
end
LobbyState.EnterEvent:Connect(EnterLobbyState) --ํ•ด๋‹น Phase๋กœ ๋ณ€๊ฒฝ๋์„๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

local function UpdateLobbyState(UpdateTime)
    print("Update Lobby State")
end
LobbyState.UpdateEvent:Connect(UpdateLobbyState)  --ํ•ด๋‹น Phase์ผ๋•Œ ๋งคํ”„๋ ˆ์ž„๋งˆ๋‹ค ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

local function ExitLobbyState()
    print("End Lobby State")
end
LobbyState.ExitEvent:Connect(ExitLobbyState) --ํ•ด๋‹น Phase๊ฐ€ ๋๋‚ ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

local function EnterPlayState()
    Game.GameState = "Play"
    print("Enter Play State")
end
PlayState.EnterEvent:Connect(EnterPlayState)

local function EnterResultState()
    Game.GameState = "Result"
    print("Enter Result State")
end
ResultState.EnterEvent:Connect(EnterResultState)

wait(1)
Game:ChangePhaseByName("Game") --์ด๋ฆ„์œผ๋กœ Phase๋ฅผ ์ „ํ™˜ํ•ด์š”.
wait(1)
Game:ChangeToNextPhase() --๋‹ค์Œ Phase๋กœ ์ „ํ™˜ํ•ด์š”. (๋งŒ์•ฝ ๋งˆ์ง€๋ง‰ Phase๋ฉด ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์•„์š”.)

--ํด๋ผ ์Šคํฌ๋ฆฝํŠธ์—์„œ-------------
local LobbyState = Game:AddPhase("Lobby") --์„œ๋ฒ„ ์Šคํฌ๋ฆฝํŠธ์—์„œ ์ถ”๊ฐ€ํ•œ Phase๋ฅผ ๋˜‘๊ฐ™์ด ๋“ฑ๋กํ•ด์š”.
local PlayState = Game:AddPhase("Play")
local ResultState = Game:AddPhase("Result")

--๊ฐ Phase๋กœ ์ „ํ™˜๋˜์—ˆ์„๋•Œ ์ฒ˜๋ฆฌํ•  ์ด๋ฒคํŠธ ํ•จ์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•ด์š”.
--์„œ๋ฒ„ ์Šคํฌ๋ฆฝํŠธ์™€ ๋™์ผํ•˜๊ฒŒ ์ž‘์„ฑํ•˜๋˜, Game.GameState = "Lobby" ๊ฐ™์€ Phase ๋ณ€๊ฒฝ์€ ์ œ์™ธํ•ด์š”. (์„œ๋ฒ„์—์„œ๋งŒ ์ฒ˜๋ฆฌํ•ด์•ผ ํ•ด์š”.)
local function EnterLobbyState()
    print("Enter Lobby State")
end
LobbyState.EnterEvent:Connect(EnterLobbyState)

local function EnterPlayState()
    print("Enter Play State")
end
PlayState.EnterEvent:Connect(EnterPlayState)

local function EnterResultState()
    print("Enter Result State")
end
ResultState.EnterEvent:Connect(EnterResultState)

--์Šคํฌ๋ฆฝํŠธ ์ œ์ผ ์•„๋ž˜์— ์ƒํƒœ๊ฐ€ ๋ฐ”๋€”๋•Œ๋งˆ๋‹ค ๊ด€๋ จ๋œ Phase ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋  ์ˆ˜ ์žˆ๋„๋ก ์—ฐ๊ฒฐํ•ด์š”.
Game:ConnectChangeEventFunction("GameState", function(self, value)
    Game:ChangePhaseByName(Game.GameState)
end)

Phase GetPhase(string phasename)

๋‹จ๊ณ„ ์ด๋ฆ„์œผ๋กœ ๋‹จ๊ณ„๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”. (๋ถˆ๋Ÿฌ์˜ฌ ๋‹จ๊ณ„ ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

local phase = Game:GetPhase("Play") -- "Play" ๋‹จ๊ณ„๋ฅผ ๋ถˆ๋Ÿฌ์™€์š”.

Phase GetCurPhase()

ํ˜„์žฌ ๋‹จ๊ณ„๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local phase = Game:GetCurPhase()

Phase ChangePhaseByName(string changephasename)

๋‹จ๊ณ„ ์ด๋ฆ„์„ ํ†ตํ•ด ํ•ด๋‹น ๋‹จ๊ณ„๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์–ด์š”. (๋ณ€๊ฒฝํ•  ๋‹จ๊ณ„ ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

local phase = Game:ChangePhaseByName("Play") -- ๋‹จ๊ณ„๋ฅผ "Play" ๋‹จ๊ณ„๋กœ ๋ณ€๊ฒฝํ•ด์š”.

Phase ChangeToNextPhase()

๋‹ค์Œ ๋‹จ๊ณ„๋กœ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local phase = Game:ChangeToNextPhase()

void ConnectEventFunction(string customevent, function TargetFunction)

์œ ์ €๊ฐ€ ์ถ”๊ฐ€ํ•œ ์ด๋ฒคํŠธ์— ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์–ด์š”. (์ด๋ฒคํŠธ ์ด๋ฆ„, ์—ฐ๊ฒฐ ํ•จ์ˆ˜)

-- ์ƒ˜ํ”Œ --

--์„œ๋ฒ„ ์Šคํฌ๋ฆฝํŠธ์—์„œ
local cube = Workspace.cube

--์„œ๋ฒ„์—์„œ ์ด๋ฒคํŠธ ์ƒ์„ฑ์‹œ ์ฒซ ์ธ์ž๋กœ player๊ฐ€ ๋“ค์–ด๊ฐ€์š”.
local function ServerSomeFunc(player)
    print(player .. " - Call ServerSomeFunc")
end
Game:ConnectEventFunction("ServerSomeFunc", ServerSomeFunc) --Game์— "ServerSomeFunc"๋ผ๋Š” ์ด๋ฒคํŠธ ์ด๋ฆ„์œผ๋กœ ServerSomeFunc ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.
                                                            --Game์ด ์•„๋‹Œ ์˜ค๋ธŒ์ ํŠธ์—๋„ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์–ด์š”.
                                                            --๊ฐ™์€ ๋Œ€์ƒ์— ๋“ฑ๋ก๋œ ์ด๋ฒคํŠธ๋งŒ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์–ด์š”.
                                                            --๊ฐ™์€ ์ด๋ฆ„์œผ๋กœ ์—ฌ๋Ÿฌ ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ด ๊ฒฝ์šฐ ํ˜ธ์ถœํ• ๋•Œ ์—ฐ๊ฒฐ๋œ ํ•จ์ˆ˜๊ฐ€ ๋ชจ๋‘ ํ˜ธ์ถœ๋ผ์š”.

-----------------------------------
--ํด๋ผ ์Šคํฌ๋ฆฝํŠธ์—์„œ
local cube = Workspace.cube

--ํด๋ผ์—์„œ ์ด๋ฒคํŠธ ์ƒ์„ฑ์‹œ player ์ธ์ž๋ฅผ ์“ฐ์ง€ ์•Š์•„๋„ ๋ผ์š”.
local function ClientSomeFunc()
    print("Call ClientSomeFunc")
end
Game:ConnectEventFunction("ClientSomeFunc", ClientSomeFunc)

void DeleteObject(Object TargetObject)

์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์–ด์š”. (์‚ญ์ œํ•  ์˜ค๋ธŒ์ ํŠธ) ์„œ๋ฒ„์—์„œ ์‚ฌ์šฉํ•˜๋ฉด ์„œ๋ฒ„์™€ ํด๋ผ ์˜ค๋ธŒ์ ํŠธ ๋ชจ๋‘ ์‚ญ์ œ๋˜๊ณ  ํด๋ผ์—์„œ ์‚ฌ์šฉํ•˜๋ฉด ํด๋ผ ์˜ค๋ธŒ์ ํŠธ๋งŒ ์‚ญ์ œํ•ด์š”

-- ์ƒ˜ํ”Œ --

local cube = Workspace.Cube
Game:DeleteObject(cube) --์˜ค๋ธŒ์ ํŠธ๋ฅผ ํŒŒ๊ดดํ•ด์š”.

HitResultList LineTraceList(Vector Start, Vector Dir, number Distance)

์„ค์ •๋œ ์‹œ์ž‘ ์ง€์ ์—์„œ ์›ํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์ง€์ •๋œ ๊ฑฐ๋ฆฌ ๋งŒํผ์˜ ์ถฉ๋Œ ๋ฆฌ์ŠคํŠธ๋“ค์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”. (์‹œ์ž‘ ์ง€์  Vector, ๋ฐฉํ–ฅ Vector, ๊ฑฐ๋ฆฌ ๊ฐ’)

-- ์ƒ˜ํ”Œ --

local startPos = Workspace.Cube.Transform.Location
local dir = Vector.new(1, 0, 0)
local distance = 1000

local targetList = Game:LineTraceList(startPos, dir, distance) --์‹œ์ž‘ ์œ„์น˜์—์„œ ์ง€์ • ๋ฐฉํ–ฅ์˜ ๊ฑฐ๋ฆฌ์— ์ถฉ๋Œ์ฒด๊ฐ€ ์žˆ์œผ๋ฉด ์ถฉ๋Œ ์ •๋ณด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์š”.
for i = 1, #targetList do
    print(targetList[i].HitObject.Name) --์ถฉ๋Œํ•œ ์˜ค๋ธŒ์ ํŠธ์—์š”.
    print(targetList[i].HitLocation) --์ถฉ๋Œํ•œ ์˜ค๋ธŒ์ ํŠธ์˜ ์œ„์น˜์—์š”.
end

HitResultList LineTraceList(Vector Start, Vector Dir, number Distance, string UserCollisionName)

์„ค์ •๋œ ์‹œ์ž‘ ์ง€์ ์—์„œ ์›ํ•˜๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์ง€์ •๋œ ๊ฑฐ๋ฆฌ ๋งŒํผ์˜ ์œ ์ €๊ฐ€ ์ถ”๊ฐ€ํ•œ ์ถฉ๋Œ ํƒ€์ž…๊ณผ์˜ ์ถฉ๋Œ ๋ฆฌ์ŠคํŠธ๋“ค์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”. (์‹œ์ž‘ ์ง€์  Vector, ๋ฐฉํ–ฅ Vector, ๊ฑฐ๋ฆฌ ๊ฐ’, ์›ํ•˜๋Š” ์œ ์ € ์ถฉ๋Œ ํƒ€์ž… ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

--------์„œ๋ฒ„ ์Šคํฌ๋ฆฝํŠธ์—์„œ
Game:AddUserCollisionType("CollisionTag1") --์œ ์ € ์ถฉ๋Œ ํƒ€์ž…์„ ์ถ”๊ฐ€ํ•ด์š”.

--------์„œ๋ฒ„ ๋˜๋Š” ํด๋ผ ์Šคํฌ๋ฆฝํŠธ์—์„œ
Workspace.Cube.Collision:SetCollisionType("CollisionTag1") --ํ•ด๋‹น ์˜ค๋ธŒ์ ํŠธ์˜ ์ถฉ๋Œ ํƒ€์ž…์„ ์„ค์ •ํ•ด์š”.

local startPos = Workspace.Cube.Transform.Location
local dir = Vector.new(1, 0, 0)
local distance = 1000
local targetList = Game:LineTraceList(startPos, dir, distance, "CollisionTag1") --์‹œ์ž‘ ์œ„์น˜์—์„œ ์ง€์ • ๋ฐฉํ–ฅ์˜ ๊ฑฐ๋ฆฌ์— "CollisiongTag1"์˜
                                                                                --์ถฉ๋Œ ํƒ€์ž…์„ ๊ฐ€์ง„ ์ถฉ๋Œ์ฒด๊ฐ€ ์žˆ์œผ๋ฉด ์ถฉ๋Œ ์ •๋ณด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์š”.
for i = 1, #targetList do
    print(targetList[i].HitObject.Name) --์ถฉ๋Œํ•œ ์˜ค๋ธŒ์ ํŠธ์—์š”.
    print(targetList[i].HitLocation) --์ถฉ๋Œํ•œ ์˜ค๋ธŒ์ ํŠธ์˜ ์œ„์น˜์—์š”.
end

bool IsPublished()

๋ฐ˜ํ™˜๊ฐ’์ด false์ด๋ฉด ์ŠคํŠœ๋””์˜ค(์ŠคํŠœ๋””์˜ค๋กœ ์ ‘์†), true์ด๋ฉด ํผ๋ธ”๋ฆฌ์‰ฌ๋œ ์ƒํƒœ(ํ”Œ๋ ˆ์ด์–ด๋กœ ์ ‘์†)

-- ์ƒ˜ํ”Œ --

 if Game:IsPublished() == true then
		print("ํผ๋ธ”๋ฆฌ์‹œ ๊ฒŒ์ž„์ด๋ฏ€๋กœ Player์—์„œ ์‹คํ–‰ํ•œ๊ฒƒ.")
 else
		print("์•„๋‹ˆ๋ฏ€๋กœ Studio์—์„œ ์‹คํ–‰ํ•œ๊ฒƒ.")
 end

void SetEnableChatLog(bool Enable)

๋กœ๊ทธ ์ฑ„ํŒ…์ฐฝ ์ถœ๋ ฅ ๊ธฐ๋Šฅ ํ™œ์„ฑ, ๋น„ํ™œ์„ฑ ์„ค์ •(true๋กœ ์„ค์ • ์‹œ ์Šคํฌ๋ฆฝํŠธ print ๊ฐ€ ์ฑ„ํŒ…์ฐฝ์—๋„ ํ‘œ์‹œ๋จ)

ObjectList FindObjects(Object RootObject, string ObjectName)

RootObject ํ•˜์œ„์˜ ์˜ค๋ธŒ์ ํŠธ๋“ค ์ค‘ ObjectName ์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ ๋ฆฌ์ŠคํŠธ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local objList = Game:FindObjects(Workspace, "Cube") --Workspace์—์„œ ์ด๋ฆ„์ด Cube์ธ ๊ฐ์ฒด๋ฅผ ๋ชจ๋‘ ๊ฐ€์ ธ์™€์š”.

for i = 1, #objList do --๋ฆฌ์ŠคํŠธ์•ž์— #์„ ๋ถ™์—ฌ ๋ฆฌ์ŠคํŠธ์˜ ๊ธธ์ด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”.
    print(objList[i].Name)
end

ObjectList FindObjects(Object RootObject, ObjectType FindType)

RootObject ํ•˜์œ„์˜ ์˜ค๋ธŒ์ ํŠธ๋“ค ์ค‘ ObjectType ์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ ๋ฆฌ์ŠคํŠธ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local objList = Game:FindObjects(Workspace, Enum.ObjectType.StaticMesh) --Workspace์—์„œ StaticMesh ๊ฐ์ฒด๋ฅผ ๋ชจ๋‘ ๊ฐ€์ ธ์™€์š”.

for i = 1, #objList do --๋ฆฌ์ŠคํŠธ์•ž์— #์„ ๋ถ™์—ฌ ๋ฆฌ์ŠคํŠธ์˜ ๊ธธ์ด๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”.
    print(objList[i].Name)
end

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ถ€๋ชจ ์˜ค๋ธŒ์ ํŠธ ๊ธฐ๋Šฅ๋“ค

์†์„ฑ

์ด๋ฆ„

์„ค๋ช…

๋ถ€๋ชจ ๊ฐ์ฒด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

๊ฐ์ฒด์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

์ด๋ฒคํŠธ

์ด๋ฆ„

์„ค๋ช…

ํ•จ์ˆ˜

์ด๋ฆ„

์„ค๋ช…

์ถ”๊ฐ€๋œ ๊ฐ’์ด ๋ณ€๊ฒฝ ๋  ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ์—์š”. (Value ์ด๋ฆ„, ์—ฐ๊ฒฐ ํ•จ์ˆ˜)

์ด๋ฆ„์œผ๋กœ ์ž์‹ ๊ฐ์ฒด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”. (์ฐพ๊ณ ์‹ถ์€ ์ž์‹ ๊ฐ์ฒด ์ด๋ฆ„)

์ž์‹ ๊ฐ์ฒด์˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

์บ๋ฆญํ„ฐ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์Šคํ…Œํ‹ฑ ๋ฉ”์‹œ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

FX์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

Sound์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

ํฌ์ธํŠธ ๋ผ์ดํŠธ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ŠคํฌํŠธ ๋ผ์ดํŠธ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์„œํ”ผ์Šค UI์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์Šคํฌ๋ฆฐ UI์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

ํ„ฐ์น˜ UI์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์•„์ดํ…œ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

NPC์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ŠคํŠธ๋ฆฝํŠธ์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

Collider์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

Widget์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

Camera์ธ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

ํ•ด๋‹น ์˜ค๋ธŒ์ ํŠธ๊ฐ€ ์œ ํšจํ•œ์ง€ ํ™•์ธ ํ•  ์ˆ˜์žˆ์–ด์š”.

ํ•ด๋‹น ์˜ค๋ธŒ์ ํŠธ์˜ ๊ฐ’์ด ์œ ํšจํ•œ์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”.

ํ•ด๋‹น ๊ฐ์ฒด์— ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ ๋ฒกํ„ฐ๋ฅผ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  Value ์ด๋ฆ„, Vector ๋ฐ์ดํ„ฐ, Enum.ReplicateType.ํƒ€์ž… , ๋™๊ธฐํ™” ์‹œ๊ฐ„)

ํ•ด๋‹น ๊ฐ์ฒด์— ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ ์‹ค์ˆ˜๋ฅผ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  Value ์ด๋ฆ„, number ๋ฐ์ดํ„ฐ, Enum.ReplicateType.ํƒ€์ž… , ๋™๊ธฐํ™” ์‹œ๊ฐ„)

ํ•ด๋‹น ๊ฐ์ฒด์— ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ bool๋ฅผ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  Value ์ด๋ฆ„, bool ๋ฐ์ดํ„ฐ, Enum.ReplicateType.ํƒ€์ž… , ๋™๊ธฐํ™” ์‹œ๊ฐ„)

ํ•ด๋‹น ๊ฐ์ฒด์— ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ ๋ฌธ์ž์—ด์„ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  Value ์ด๋ฆ„, string ๋ฐ์ดํ„ฐ, Enum.ReplicateType.ํƒ€์ž… , ๋™๊ธฐํ™” ์‹œ๊ฐ„)

ํ•ด๋‹น ๊ฐ์ฒด์— ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ปฌ๋Ÿฌ๋ฅผ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  Value ์ด๋ฆ„, Color ๋ฐ์ดํ„ฐ, Enum.ReplicateType.ํƒ€์ž… , ๋™๊ธฐํ™” ์‹œ๊ฐ„)

์ผ์ • ์‹œ๊ฐ„๋’ค์— ์—ฐ๊ฒฐ ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๋Š” ์ด๋ฒคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•ด์š”. (์ถ”๊ฐ€ํ•  ์ด๋ฒคํŠธ ์ด๋ฆ„, ์‹œ๊ฐ„, ์—ฐ๊ฒฐ ํ•จ์ˆ˜)

๋“ฑ๋ก๋œ ์‹œ๊ฐ„ ์ด๋ฒคํŠธ๋ฅผ ์‚ญ์ œํ•ด์š”. (์‚ญ์ œํ•  ์ด๋ฒคํŠธ ์ด๋ฆ„)

Last updated