Update the NavMesh test case

This commit is contained in:
samuele3hu 2015-06-17 09:49:31 +08:00
parent e20a35508a
commit 2da760b655
2 changed files with 24 additions and 31 deletions

View File

@ -33,7 +33,7 @@ function NavMeshBaseTestDemo:ctor()
local function onNodeEvent(event)
if "enter" == event then
-- self:onEnter()
self:onEnter()
elseif "exit" == event then
self:onExit()
end
@ -89,6 +89,14 @@ function NavMeshBaseTestDemo:init()
self:extend()
end
function NavMeshBaseTestDemo:onEnter()
local hitResult = {}
local ret = false
local physicsWorld = self:getPhysics3DWorld()
ret, hitResult = physicsWorld:rayCast(cc.vec3(0.0, 50.0, 0.0), cc.vec3(0.0, -50.0, 0.0), hitResult)
self:createAgent(hitResult.hitPosition)
end
function NavMeshBaseTestDemo:onExit()
self:unscheduleUpdate()
end
@ -300,12 +308,6 @@ function NavMeshBasicTestDemo:extend()
local menu = cc.Menu:create(menuItem)
menu:setPosition(cc.p(0.0, 0.0))
self:addChild(menu)
local hitResult = {}
local ret = false
local physicsWorld = self:getPhysics3DWorld()
ret, hitResult = physicsWorld:rayCast(cc.vec3(0.0, 50.0, 0.0), cc.vec3(0.0, -50.0, 0.0), hitResult)
self:createAgent(hitResult.hitPosition)
end
----------------------------------------
----NavMeshAdvanceTestDemo
@ -378,9 +380,7 @@ function NavMeshAdvanceTestDemo:extend()
menuItem0:registerScriptTapHandler(function (tag, sender)
local scene = cc.Director:getInstance():getRunningScene()
local x = math.random(-50, 50)
print("x value is ", x)
local z = math.random(-50.0, 50.0)
print("z value is ", z)
local hitResult = {}
local ret = false
@ -424,13 +424,6 @@ function NavMeshAdvanceTestDemo:extend()
local menu = cc.Menu:create(menuItem0, menuItem1, menuItem2)
menu:setPosition(cc.p(0.0, 0.0))
self:addChild(menu)
local hitResult = {}
local ret = false
local physicsWorld = cc.Director:getInstance():getRunningScene():getPhysics3DWorld()
ret,hitResult = physicsWorld:rayCast(cc.vec3(0.0, 50.0, 0.0), cc.vec3(0.0, -50.0, 0.0), hitResult)
self:createAgent(hitResult.hitPosition)
end
----------------------------------------

View File

@ -134,21 +134,21 @@ def main():
output_dir = '%s/cocos/scripting/lua-bindings/auto' % project_root
cmd_args = {'cocos2dx.ini' : ('cocos2d-x', 'lua_cocos2dx_auto'), \
# 'cocos2dx_extension.ini' : ('cocos2dx_extension', 'lua_cocos2dx_extension_auto'), \
# 'cocos2dx_ui.ini' : ('cocos2dx_ui', 'lua_cocos2dx_ui_auto'), \
# 'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \
# 'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \
# 'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \
# 'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'lua_cocos2dx_experimental_video_auto'), \
# 'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'lua_cocos2dx_experimental_auto'), \
# 'cocos2dx_controller.ini' : ('cocos2dx_controller', 'lua_cocos2dx_controller_auto'), \
# 'cocos2dx_cocosbuilder.ini': ('cocos2dx_cocosbuilder', 'lua_cocos2dx_cocosbuilder_auto'), \
# 'cocos2dx_cocosdenshion.ini': ('cocos2dx_cocosdenshion', 'lua_cocos2dx_cocosdenshion_auto'), \
# 'cocos2dx_3d.ini': ('cocos2dx_3d', 'lua_cocos2dx_3d_auto'), \
# 'cocos2dx_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \
# 'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
# 'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \
# 'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'lua_cocos2dx_physics3d_auto'), \
'cocos2dx_extension.ini' : ('cocos2dx_extension', 'lua_cocos2dx_extension_auto'), \
'cocos2dx_ui.ini' : ('cocos2dx_ui', 'lua_cocos2dx_ui_auto'), \
'cocos2dx_studio.ini' : ('cocos2dx_studio', 'lua_cocos2dx_studio_auto'), \
'cocos2dx_spine.ini' : ('cocos2dx_spine', 'lua_cocos2dx_spine_auto'), \
'cocos2dx_physics.ini' : ('cocos2dx_physics', 'lua_cocos2dx_physics_auto'), \
'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'lua_cocos2dx_experimental_video_auto'), \
'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'lua_cocos2dx_experimental_auto'), \
'cocos2dx_controller.ini' : ('cocos2dx_controller', 'lua_cocos2dx_controller_auto'), \
'cocos2dx_cocosbuilder.ini': ('cocos2dx_cocosbuilder', 'lua_cocos2dx_cocosbuilder_auto'), \
'cocos2dx_cocosdenshion.ini': ('cocos2dx_cocosdenshion', 'lua_cocos2dx_cocosdenshion_auto'), \
'cocos2dx_3d.ini': ('cocos2dx_3d', 'lua_cocos2dx_3d_auto'), \
'cocos2dx_audioengine.ini': ('cocos2dx_audioengine', 'lua_cocos2dx_audioengine_auto'), \
'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \
'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'lua_cocos2dx_physics3d_auto'), \
'cocos2dx_navmesh.ini' : ('cocos2dx_navmesh', 'lua_cocos2dx_navmesh_auto'), \
}
target = 'lua'