Game

Game

๊ฒŒ์ž„ ์ „๋ฐ˜์ ์ธ ์—ญํ• ์„ ํ•˜๋Š” ๊ฐ์ฒด์—์š”. ์—ฌ๊ธฐ ์žˆ๋Š” ๊ธฐ๋Šฅ๋“ค์€ ํด๋ผ์ด์–ธํŠธ์—์„œ๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด์š”.

์ด๋ฒคํŠธ

ReceiveGameStatisticsDataEvent

์„œ๋ฒ„๋กœ ๋ถ€ํ„ฐ ๊ฒŒ์ž„ ํ†ต๊ณ„ ๋ฐ์ดํ„ฐ ๋ฐ›์•˜์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(keystring, offset, data ) keystring ์ €์žฅํ•  ๋•Œ์˜ keystring, offset ๋Š” number , data ๋Š” ํ†ต๊ณ„๋ฐ์ดํ„ฐ ์ž…๋‹ˆ๋‹ค.

EnterSelfCamera

Selfcamera Mode๊ฐ€ ์—ด๋ฆด ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function( ) ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function EnterSelfCam()
    local selfCamState = LocalPlayer:IsSelfCamera()
    print(LocalPlayer:GetRemotePlayer().Name, " Self Camera State : ", selfCamState)
end
Game.EnterSelfCamera:Connect(EnterSelfCam) --Game์— ์…€ํ”„์นด๋ฉ”๋ผ ์ƒํƒœ๊ฐ€ ๋˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

LeaveSelfCamera

Selfcamera Mode๊ฐ€ ๋‹ซํž ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function( ) ์ž…๋‹ˆ๋‹ค.

-- ์ƒ˜ํ”Œ --

local function LeaveSelfCam()
    local selfCamState = LocalPlayer:IsSelfCamera()
    print(LocalPlayer:GetRemotePlayer().Name, " Self Camera State : ", selfCamState)
end
Game.LeaveSelfCamera:Connect(LeaveSelfCam) --Game์— ์…€ํ”„์นด๋ฉ”๋ผ ์ƒํƒœ๊ฐ€ ํ•ด์ œ๋˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

OnLuckyDraw

๋Ÿญํ‚ค๋“œ๋กœ์šฐ ์ •๋ณด ์ด๋ฒคํŠธ์—์š”. ์—ฐ๊ฒฐํ•จ์ˆ˜ ํ˜•์‹์€ function(LuckyDrawInfo), LuckyDrawInfo ์€ LuckyDrawInfo ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค.

์†์„ฑ

MasterVolume

MasterVolume์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local CurrentVolume = Game.MasterVolume
Game.MasterVolume = 0.1

MusicVolume

MusicVolume์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local CurrentVolume = Game.MusicVolume
Game.MusicVolume = 0.1

EffectVolume

EffectVolume์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local CurrentVolume = Game.EffectVolume
Game.EffectVolume = 0.1

EtcVolume

EtcVolume์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local CurrentVolume = Game.EtcVolume
Game.EtcVolume = 0.1

TextChatVisible

TextChatVisible ์ฑ„ํŒ…์ฐฝ์„ ์ผœ๊ณ  ๋Œ ์ˆ˜ ์žˆ์–ด์š”

-- ์ƒ˜ํ”Œ --

Game.TextChatVisible = false

ํ•จ์ˆ˜

RemotePlayer GetRemotePlayer(number PlayerID)

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

-- ์ƒ˜ํ”Œ --

local player = Game:GetRemotePlayer(PlayerID) --ํ”Œ๋ ˆ์ด์–ด ์•„์ด๋””์— ํ•ด๋‹นํ•˜๋Š” ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๋ฐ˜ํ™˜ํ•ด์š”.

Character GetRemotePlayerCharacter(number PlayerID)

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

-- ์ƒ˜ํ”Œ --

local character = Game:GetRemotePlayerCharacter(PlayerID) --ํ”Œ๋ ˆ์ด์–ด ์•„์ด๋””์— ํ•ด๋‹นํ•˜๋Š” ์บ๋ฆญํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์š”.

number GetPlayerCount()

ํ˜„์žฌ ๊ฒŒ์ž„์— ์ฐธ์—ฌํ•˜๊ณ  ์žˆ๋Š” ํ”Œ๋ ˆ์ด์–ด์˜ ์ˆ˜๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

print(Game:GetPlayerCount())

PlayerList GetAllPlayer()

์›”๋“œ์— ์ ‘์†ํ•œ ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

local allPlayerList = Game:GetAllPlayer() --๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ํ•ด์š”.

for i = 1, #allPlayerList do
    print(allPlayerList[i].Name)
end

void SendEventToServer(string EventName, Args ...)

์„œ๋ฒ„์— ์ปค์Šคํ…€ ์ด๋ฒคํŠธ๋ฅผ ๋ณด๋‚ด๋Š” ํ•จ์ˆ˜์—์š”. (์ด๋ฒคํŠธ ์ด๋ฆ„, ์ „๋‹ฌํ•˜๊ณ  ์‹ถ์€ ๋ณ€์ˆ˜๋“ค ...)

-- ์ƒ˜ํ”Œ --

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

wait(1)
cube:SendEventToServer("SomeFunc", 1) --์ž์‹  ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ SomeFunc() ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•ด์š”.

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

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

AnimStateMachineSetting AddAnimStateMachineSetting(string StateMachineName)

์บ๋ฆญํ„ฐ์— ์‚ฌ์šฉ๋  ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ๋จธ์‹  ์„ค์ •์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์–ด์š”. (์„ค์ •ํ•  ์ƒํƒœ๋จธ์‹  ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

--์บ๋ฆญํ„ฐ์— ์‚ฌ์šฉ๋  ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ๋จธ์‹  ์„ค์ •์„ ์ถ”๊ฐ€ํ•ด์š”.
local AnimStateMachineSetting = Game:AddAnimStateMachineSetting("DefaultCharacterAnim")

AnimStateMachineSetting GetAnimStateMachineSetting(string StateMachineName)

์„ค์ •๋œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ๋จธ์‹ ์„ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”. (์–ป๊ณ  ์‹ถ์€ ์ƒํƒœ๋จธ์‹  ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

wait(1)
local AnimStateMachineSetting = Game:GetAnimStateMachineSetting("DefaultCharacterAnim")
print(AnimStateMachineSetting)

void SetCharacterAnimStateMachine(CharacterSetting CharacterSetting, AnimStateMachineSetting AnimSetting)

ํ•ด๋‹น ์บ๋ฆญํ„ฐ ์„ค์ •์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” ์บ๋ฆญํ„ฐ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ๋จธ์‹ ์„ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์–ด์š”. (๋Œ€์ƒ ์บ๋ฆญํ„ฐ ์„ค์ •, ์‚ฌ์šฉ ํ•  ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ์„ค์ •)

-- ์ƒ˜ํ”Œ --

Game:SetCharacterAnimStateMachine(AnimationSetting, AnimStateMachineSetting) --์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ๋จธ์‹ ์„ ์‚ฌ์šฉ ํ•  ์บ๋ฆญํ„ฐ(Object)๋ฅผ ์„ค์ •ํ•ด์š”.

void SetNPCAnimStateMachine(string NPCSettingName, string AnimStateMachineSettingName1)

ํ•ด๋‹น NPC์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ๋จธ์‹  ์‚ฌ์šฉํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์–ด์š”. (์„ค์ •ํ•œ NPC ์ด๋ฆ„, ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ๋จธ์‹  ์ด๋ฆ„)

void ChangeCharacterAnimStateMachine(Character Character, AnimStateMachineSetting AnimSetting, AnimationSetting AnimationSetting)

ํ•ด๋‹น ์บ๋ฆญํ„ฐ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ๋จธ์‹ ์„ ์ฃผ์–ด์ง„ ์ƒํƒœ ๋จธ์‹ ๊ณผ ์บ๋ฆญํ„ฐ ์„ธํŒ…์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ ๊ต์ฒดํ•ด์š”. (๋ณ€๊ฒฝํ•  ์บ๋ฆญํ„ฐ, ์ ์šฉํ•  ์ƒํƒœ ๋จธ์‹ , ์ ์šฉํ•  ์• ๋‹ˆ๋ฉ”์ด์…˜ ์„ธํŒ…)

-- ์ƒ˜ํ”Œ --

local FPSCharacter = Toybox.FPSCharacterSetting
local AniStateMachine = Game:GetAnimStateMachineSetting("FPSCharacterAnim") --FPSCharacter์˜ DefaultCharacterAnimSetting์—์„œ ์„ค์ •ํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ๋จธ์‹ ์˜ ์ด๋ฆ„์ด์–ด์•ผ ํ•ด์š”

--ํ•ด๋‹น ์บ๋ฆญํ„ฐ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ƒํƒœ ๋จธ์‹ ์„ ๊ต์ฒดํ•ด์š”. (๋ณ€๊ฒฝํ•  ์บ๋ฆญํ„ฐ, ์ ์šฉํ•  ์ƒํƒœ ๋จธ์‹ , ์ ์šฉํ•  ์• ๋‹ˆ๋ฉ”์ด์…˜ ์„ธํŒ…)
Game:ChangeCharacterAnimStateMachine(character, AniStateMachine, FPSCharacter.AnimationSetting)

void ResetRespawnCharacterAnimStateMachine(Character Character, bool IsReset)

ํ•ด๋‹น ์บ๋ฆญํ„ฐ์˜ ๋ณ€๊ฒฝ๋œ ์ƒํƒœ ๋จธ์‹ ์„ ๋ฆฌ์Šคํฐ ์‹œ ์ดˆ๊ธฐํ™” ์‹œํ‚ฌ์ง€ ๊ฒฐ์ •ํ•ด์š”.

-- ์ƒ˜ํ”Œ --

--ํ•ด๋‹น ์บ๋ฆญํ„ฐ์˜ ๋ณ€๊ฒฝ๋œ ์ƒํƒœ ๋จธ์‹ ์„ ๋ฆฌ์Šคํฐ ์‹œ ์ดˆ๊ธฐํ™” ์‹œํ‚ฌ์ง€ ๊ฒฐ์ •ํ•ด์š”.
--๋‘๋ฒˆ์งธ ๊ฐ’์ด false์ด๋ฉด, ํ•ด๋‹น ์บ๋ฆญํ„ฐ๋Š” ๋ฆฌ์Šคํฐ์‹œ์—๋„ ๊ธฐ๋ณธ ์• ๋‹ˆ๋กœ ์ดˆ๊ธฐํ™”๋˜์ง€ ์•Š์•„์š”.
Game:ResetRespawnCharacterAnimStateMachine(character, false)

FX CreateFX(ObjectFX FXObject, Vetor Location)

FX๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š”. (์ƒ์„ฑ ํ•  FX ์˜ค๋ธŒ์ ํŠธ, ์ƒ์„ฑํ•  ์œ„์น˜)

-- ์ƒ˜ํ”Œ --

local spawnPos = Workspace.Cube.Transform.Location
Game:CreateFX(Workspace.Effect, spawnPos) --์ดํŽ™ํŠธ๋ฅผ ์ง€์ • ์œ„์น˜์— ์ƒ์„ฑํ•ด์š”.

void DeleteFX(FX FXObject)

FX๋ฅผ ์ œ๊ฑฐ์‹œ์ผœ์š”. (์ œ๊ฑฐํ•  FX ์˜ค๋ธŒ์ ํŠธ)

-- ์ƒ˜ํ”Œ --

Game:DeleteFX(Workspace.Effect)

ObjectSound PlaySound(ObjectSound SoundObject, Vetor Location)

์‚ฌ์šด๋“œ๋ฅผ ํ”Œ๋ ˆ์ดํ•ด์š”. (ํ”Œ๋ ˆ์ด ํ•  Sound ์˜ค๋ธŒ์ ํŠธ, ํ”Œ๋ ˆ์ด ํ•  ์œ„์น˜ Vector)

-- ์ƒ˜ํ”Œ --

Game:PlaySound(Workspace.Sound, Vector.new(0, 0, 0))

void StopSound(ObjectSound SoundObject)

ํ”Œ๋ ˆ์ด ์ค‘์ธ ์‚ฌ์šด๋“œ๋ฅผ ์ •์ง€์‹œ์ผœ์š”. (์ •์ง€ํ•  Sound)

-- ์ƒ˜ํ”Œ --

Game:StopSound(Workspace.Sound)

ObjectSound CreateObject(Object SourceObject, Vector Location)

์ง€์ •๋œ ์œ„์น˜์— ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ƒ์„ฑ ์‹œ์ผœ์š”. (์ƒ์„ฑ ํ•  Object, ์ƒ์„ฑ ํ•  ์œ„์น˜ Vector)

-- ์ƒ˜ํ”Œ --

local cube = Workspace.Cube
local createPos = Vector.new(0, 0, 0)

local temp = Game:CreateObject(cube, createPos) --์˜ค๋ธŒ์ ํŠธ๋ฅผ ์ง€์ •๋œ ์œ„์น˜์— ์ƒ์„ฑํ•ด์š”. (์ƒ์„ฑํ•œ ํด๋ผ์ด์–ธํŠธ์—์„œ๋งŒ ๋ณด์—ฌ์š”.)
print(temp.Name) --CreateObject๋กœ ์ƒ์„ฑํ•œ ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ณ€์ˆ˜์— ๋‹ด์€ ๋’ค ํ›„์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์–ด์š”.

UIScene CreateUIScene(UIScene SourceUIScene)

(deprecate) CreateUIWidget ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์„ธ์š”.

UIScene CreateUIScene(string UISceneName, UIScene SourceUIScene)

(deprecate) CreateUIWidget ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์„ธ์š”.

-- ์ƒ˜ํ”Œ --

local uiScene = Game:CreateUIScene(Workspace.ScreenUI) --๋Œ€์ƒ UI๋ฅผ ๋ณต์ œํ•ด์š”.
print(uiScene.Name)

local uiScene = Game:CreateUIScene("NewScreenUI", Workspace.ScreenUI) --์ƒˆ๋กœ์šด ์ด๋ฆ„์œผ๋กœ ๋Œ€์ƒ UI๋ฅผ ๋ณต์ œํ•ด์š”.
print(uiScene.Name)

UIWidget CreateUIWidget(UIWidget SourceUIWidget)

SourceUIWidgetObject์™€ ๊ฐ™์€ UIWidget์„ ์ƒ์„ฑํ•œ๋‹ค. ์ž์‹๊ด€๊ณ„์˜ Widget๊นŒ์ง€ ๋˜‘๊ฐ™์ด ๋งŒ๋“ญ๋‹ˆ๋‹ค. (์ƒ์„ฑํ•  ์ตœ์ƒ์œ„ ์œ„์ ฏ์˜ ์ด๋ฆ„, ์ƒ์„ฑ ํ•  ์›๋ณธ ์œ„์ ฏ)

-- ์ƒ˜ํ”Œ --

local WidgetImage1 = Game:CreateUIWidget(Workspace.ScreenUI.Image) --๋Œ€์ƒ UI Widget๋ฅผ ๋˜‘๊ฐ™์ด ๋งŒ๋“ค์–ด์š”.
local WidgetImage2 = Game:CreateUIWidget("NewUIWidget", Workspace.ScreenUI.Image) --๋Œ€์ƒ UI Widget๋ฅผ ๋˜‘๊ฐ™์ด ๋งŒ๋“ค์–ด์š”.

Vector GetMouseHitLocation()

์ž์‹ ์˜ ๋งˆ์šฐ์Šค 2D ์œ„์น˜์—์„œ ์›”๋“œ์— ์ถฉ๋Œ๋œ 3D์œ„์น˜ ์ขŒํ‘œ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

MouseInput = Input:AddGroup("MouseInput")
MouseInput:AddActionKeyEvent("ClickKey", Enum.Key.LeftMouseButton)
Input:ActiveGroup("MouseInput")

MouseInput:ProcessInputActionEvent("ClickKey", Enum.KeyInputType.Released, function()
    local pos = Game:GetMouseHitLocation() --๋งˆ์šฐ์Šค๋ฅผ ํด๋ฆญํ•œ ์œ„์น˜๋ฅผ Vector๋กœ ๋ฐ˜ํ™˜ํ•ด์š”.
    print("Click Position : " .. pos)
end

HitObject GetMouseHitObject()

์ž์‹ ์˜ ๋งˆ์šฐ์Šค 2D ์œ„์น˜์—์„œ ์›”๋“œ์— ์ถฉ๋Œ๋œ Object๋ฅผ ์–ป์–ด ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”.

-- ์ƒ˜ํ”Œ --

while true do
    local hitObj = Game:GetMouseHitObject() --๋งˆ์šฐ์Šค ์ปค์„œ ์œ„์น˜์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์š”.
    if hitObj ~= nil then
        print(hitObj.Name)
    else
        print("nil")
    end
    wait(0.5)
end

void OnChatNormalMessage(number TargetID, string Message, ChatVisibleType ChatVisibleType)

๋‚ด ์ฑ„ํŒ… ์ฐฝ์— ์ผ๋ฐ˜ ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€. (์—ฐ์ถœ์šฉ)

-- ์ƒ˜ํ”Œ --

local PlayerID = character:GetPlayerID()

wait(2)
Game:OnChatNormalMessage(PlayerID, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowChatOnly) --์ฑ„ํŒ…์ฐฝ์—๋งŒ ํ‘œ์‹œํ•ด์š”

wait(2)
Game:OnChatNormalMessage(PlayerID, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowBalloonOnly) --๋งํ’์„ ์œผ๋กœ๋งŒ ํ‘œ์‹œํ•ด์š”

wait(2)
Game:OnChatNormalMessage(PlayerID, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowBoth) --์ฑ„ํŒ…์ฐฝ๊ณผ ๋งํ’์„ ์œผ๋กœ ํ‘œ์‹œํ•ด์š”

void OnChatSystemMessage(number PlayerID, string Message)

๋‚ด ์ฑ„ํŒ… ์ฐฝ์— ์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€.

-- ์ƒ˜ํ”Œ --

wait(2)
Game:OnChatSystemMessage(playerID, "์ถœ๋ ฅ ๋‚ด์šฉ") --์ฑ„ํŒ…์ฐฝ์—๋งŒ ํ‘œ์‹œํ•ด์š”

void OnChatSystemMessage(string Name, string Message)

๋‚ด ์ฑ„ํŒ… ์ฐฝ์— ์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€.

-- ์ƒ˜ํ”Œ --

wait(2)
Game:OnChatSystemMessage("์šด์˜์ž", "์ถœ๋ ฅ ๋‚ด์šฉ") --์ฑ„ํŒ…์ฐฝ์—๋งŒ ํ‘œ์‹œํ•ด์š”

void OnChatNPCMessage(ObjectNPC NPC, string Message, ChatVisibleType ChatVisibleType)

๋‚ด ์ฑ„ํŒ… ์ฐฝ์— NPC ๋ฉ”์‹œ์ง€ ์ถ”๊ฐ€.

-- ์ƒ˜ํ”Œ --

local npc = Script.Parent

wait(2)
Game:OnChatNPCMessage(npc, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowChatOnly) --์ฑ„ํŒ…์ฐฝ์—๋งŒ ํ‘œ์‹œํ•ด์š”

wait(2)
Game:OnChatNPCMessage(npc, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowBalloonOnly) --๋งํ’์„ ์œผ๋กœ๋งŒ ํ‘œ์‹œํ•ด์š”

wait(2)
Game:OnChatNPCMessage(npc, "์ถœ๋ ฅ ๋‚ด์šฉ", Enum.ChatVisibleType.ShowBoth) --์ฑ„ํŒ…์ฐฝ๊ณผ ๋งํ’์„ ์œผ๋กœ ํ‘œ์‹œํ•ด์š”

FiniteStateMachine AddFSM(string StateMachineName)

์˜ค๋ธŒ์ ํŠธ๋‚˜ NPC์— ์‚ฌ์šฉ๋  FSM์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์–ด์š”. (์ƒํƒœ๋จธ์‹  ์ด๋ฆ„)

-- ์ƒ˜ํ”Œ --

local FSM = Game:AddFSM("FSM")

FiniteStateMachine GetOrCreateFSM(string StateMachineName, number key)

์ด๋ฏธ ์กด์žฌํ•˜๋Š” FSM์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์–ด์š”.(์—†์œผ๋ฉด ๋งŒ๋“ญ๋‹ˆ๋‹ค.) (์ƒํƒœ๋จธ์‹  ์ด๋ฆ„, FSM ํ• ๋‹น๋œ Object Key)

-- ์ƒ˜ํ”Œ --

local NPC = Script.Parent
local FSM = Game:GetOrCreateFSM("FSM", NPC:GetKey()) --Server์— ์žˆ๋Š” FSM๋ฅผ ๊ฐ€์ ธ์™€์š”.

Enum GetPlayerDevice()

ํ˜„์žฌ ์ ‘์†ํ•œ ๊ธฐ๊ธฐ์˜ Type์„ ๋ฐ˜ํ™˜

-- ์ƒ˜ํ”Œ --

	local PlayerDevice = Game:GetPlayerDevice()

	if PlayerDevice == Enum.PlayerDevice.PC then
		print("Desktop")
	elseif PlayerDevice == Enum.PlayerDevice.Android then
		print("Android")
elseif PlayerDevice == Enum.PlayerDevice.iOS then
		print("iOS")
	end

Vector2D GetScreenResolution()

ํ™”๋ฉด์˜ ํ•ด์ƒ๋„๋ฅผ ์–ป๋Š”๋‹ค.

-- ์ƒ˜ํ”Œ --

local function FuncViewportResized(width, hight)
    print("Viewport Size๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")
end
Game.OnViewportResizedEvent:Connect(FuncViewportResized) --Game์—  Viewport Size๊ฐ€ ๋ณ€๊ฒฝ๋˜๋ฉด ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜๋ฅผ ์—ฐ๊ฒฐํ•ด์š”.

WidgetList FindWidgets(Object RootObject, WidgetType Type)

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

-- ์ƒ˜ํ”Œ --

local widgetList = Game:FindWidgets(Workspace, Enum.UIWidgetType.Text)

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

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

์†์„ฑ

์ด๋ฆ„

์„ค๋ช…

์ด๋ฒคํŠธ

์ด๋ฆ„

์„ค๋ช…

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

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

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

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

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

ํ•จ์ˆ˜

์ด๋ฆ„

์„ค๋ช…

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

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

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

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

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

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

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

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

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

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

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

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

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

Last updated