forked from Tencent/UnLua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatCharacter.lua
More file actions
39 lines (29 loc) · 802 Bytes
/
ChatCharacter.lua
File metadata and controls
39 lines (29 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require "UnLua"
local M = Class()
local Screen = require "Tutorials.Screen"
function M:UserConstructionScript()
self.Name = ""
self.NameTextRender:SetText("")
end
function M:ReceivePossessed()
self.Name = string.format("PLAYER_%d", self:GetController().PlayerState.PlayerId)
self:Say("我来了")
end
function M:Say_RPC(text)
local msg = string.format("[%s]说:%s", self.Name, text)
Screen.Print(msg)
end
function M:OnRep_Name()
self.NameTextRender:SetText(self.Name)
end
function M:SpaceBar_Pressed()
self:Jump()
self:Say("我跳~")
end
function M:MoveForward(AxisValue)
self:AddMovementInput(UE4.FVector(AxisValue, 0, 0), 100, false)
end
function M:MoveRight(AxisValue)
self:AddMovementInput(UE4.FVector(0, AxisValue, 0), 100, false)
end
return M