整理Player类代码,准备将玩家更新改为基于时间
This commit is contained in:
@@ -131,6 +131,7 @@ local function _newEmptyPlayer(id,mini)
|
|||||||
P.alive=true
|
P.alive=true
|
||||||
P.control=false
|
P.control=false
|
||||||
P.timing=false
|
P.timing=false
|
||||||
|
P.trigTime=0
|
||||||
P.result=false--String: 'finish'|'win'|'lose'
|
P.result=false--String: 'finish'|'win'|'lose'
|
||||||
P.stat=_getNewStatTable()
|
P.stat=_getNewStatTable()
|
||||||
P.modeData=setmetatable({},modeDataMeta)--Data use by mode
|
P.modeData=setmetatable({},modeDataMeta)--Data use by mode
|
||||||
|
|||||||
@@ -2135,15 +2135,7 @@ local function update_dead(P,dt)
|
|||||||
end
|
end
|
||||||
_updateMisc(P,dt)
|
_updateMisc(P,dt)
|
||||||
end
|
end
|
||||||
function Player:update(dt)
|
function Player:_die()
|
||||||
(
|
|
||||||
self.alive and(
|
|
||||||
self.type=='remote'and update_remote_alive
|
|
||||||
or update_alive
|
|
||||||
)or update_dead
|
|
||||||
)(self,dt)
|
|
||||||
end
|
|
||||||
function Player:die()--Called both when win/lose!
|
|
||||||
self.alive=false
|
self.alive=false
|
||||||
self.timing=false
|
self.timing=false
|
||||||
self.control=false
|
self.control=false
|
||||||
@@ -2167,6 +2159,18 @@ function Player:die()--Called both when win/lose!
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function Player:update(dt)
|
||||||
|
-- self.trigTime=self.trigTime+dt
|
||||||
|
-- while self.trigTime>.016666666666666666 do
|
||||||
|
(
|
||||||
|
self.alive and(
|
||||||
|
self.type=='remote'and update_remote_alive
|
||||||
|
or update_alive
|
||||||
|
)or update_dead
|
||||||
|
)(self,dt)
|
||||||
|
-- self.trigTime=self.trigTime-.016666666666666666
|
||||||
|
-- end
|
||||||
|
end
|
||||||
function Player:revive()
|
function Player:revive()
|
||||||
self.waiting=62
|
self.waiting=62
|
||||||
local h=#self.field
|
local h=#self.field
|
||||||
@@ -2197,7 +2201,7 @@ function Player:revive()
|
|||||||
end
|
end
|
||||||
function Player:win(result)
|
function Player:win(result)
|
||||||
if self.result then return end
|
if self.result then return end
|
||||||
self:die()
|
self:_die()
|
||||||
self.result='win'
|
self.result='win'
|
||||||
if GAME.modeEnv.royaleMode then
|
if GAME.modeEnv.royaleMode then
|
||||||
self.modeData.place=1
|
self.modeData.place=1
|
||||||
@@ -2236,12 +2240,9 @@ function Player:lose(force)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:die()
|
self:_die()
|
||||||
do
|
|
||||||
local p=TABLE.find(PLY_ALIVE,self)
|
|
||||||
if p then rem(PLY_ALIVE,p)end
|
|
||||||
end
|
|
||||||
self.result='lose'
|
self.result='lose'
|
||||||
|
do local p=TABLE.find(PLY_ALIVE,self)if p then rem(PLY_ALIVE,p)end end
|
||||||
if GAME.modeEnv.royaleMode then
|
if GAME.modeEnv.royaleMode then
|
||||||
self:changeAtk()
|
self:changeAtk()
|
||||||
self.modeData.place=#PLY_ALIVE+1
|
self.modeData.place=#PLY_ALIVE+1
|
||||||
|
|||||||
Reference in New Issue
Block a user