本文整理汇总了Python中interfaces.NPCObject.NPCObject.onTimer方法的典型用法代码示例。如果您正苦于以下问题:Python NPCObject.onTimer方法的具体用法?Python NPCObject.onTimer怎么用?Python NPCObject.onTimer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interfaces.NPCObject.NPCObject
的用法示例。
在下文中一共展示了NPCObject.onTimer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onTimer
# 需要导入模块: from interfaces.NPCObject import NPCObject [as 别名]
# 或者: from interfaces.NPCObject.NPCObject import onTimer [as 别名]
def onTimer(self, tid, userArg):
"""
KBEngine method.
引擎回调timer触发
"""
#DEBUG_MSG("%s::onTimer: %i, tid:%i, arg:%i" % (self.getScriptName(), self.id, tid, userArg))
NPCObject.onTimer(self, tid, userArg)
示例2: onTimer
# 需要导入模块: from interfaces.NPCObject import NPCObject [as 别名]
# 或者: from interfaces.NPCObject.NPCObject import onTimer [as 别名]
def onTimer(self, tid, userArg):
"""
KBEngine method.
引擎回调timer触发
"""
#DEBUG_MSG("%s::onTimer: %i, tid:%i, arg:%i" % (self.getScriptName(), self.id, tid, userArg))
NPCObject.onTimer(self, tid, userArg)
if SCDefine.TIMER_TYPE_HEARDBEAT == userArg:
#DEBUG_MSG("[CellApp] %s::onTimer: %i, position:(%f,%f,%f), velocity(%f, %f, %f)" % (self.getScriptName(), self.id, self.position.x, self.position.y, self.position.z, self.velocity.x, self.velocity.y, self.velocity.z))
if self.velocity != Math.Vector3(0,0,0):
#movePosition = Math.Vector3(self.velocity.x * deltaTime, self.velocity.y * deltaTime, self.velocity.z * deltaTime)
movePosition = self.velocity * deltaTime
self.position = self.position + movePosition
self.velocity.y = self.velocity.y + (-gravity * deltaTime)
if self.position.y < 0:
self.delTimer(tid)
self.destroy()