PGRData/Script/matrix/xentity/xdoomsday/XDoomsdayAttribute.lua
2024-09-01 22:49:41 +02:00

31 lines
834 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local Default = {
_Type = 0, --属性类型1-健康2-饱腹3-精神)
_Value = 0, --属性值
_Threshold = 0 --临界值(大于等于此值每日属性增加,否则减少)
}
--末日生存玩法-居民属性
local XDoomsdayAttribute = XClass(XDataEntityBase, "XDoomsdayAttribute")
function XDoomsdayAttribute:Ctor(attrType)
self:Init(Default)
self._Type = attrType
end
function XDoomsdayAttribute:SetProperty(name, value)
if name == "_Value" then
value = math.floor(value)
end
XDoomsdayAttribute.Super.SetProperty(self, name, value)
end
--是否处于不健康状态
function XDoomsdayAttribute:IsBad()
--if self._Type == XDoomsdayConfigs.ATTRUBUTE_TYPE.SAN then
-- return false
--end
return self._Value <= self._Threshold
end
return XDoomsdayAttribute