26#ifndef _NAVMESH_TEST_H_
27#define _NAVMESH_TEST_H_
29#include "../BaseTest.h"
30#include "navmesh/CCNavMesh.h"
35#if ( CC_USE_NAVMESH == 0 ) || ( CC_USE_PHYSICS == 0 )
41 virtual void onEnter()
override;
45class NavMeshBaseTestDemo :
public TestCase
48 CREATE_FUNC(NavMeshBaseTestDemo);
49 NavMeshBaseTestDemo();
50 virtual ~NavMeshBaseTestDemo();
53 virtual bool init()
override;
54 virtual void update(
float delta)
override;
55 virtual void onTouchesBegan(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
56 virtual void onTouchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
57 virtual void onTouchesEnded(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
62 void createAgent(
const cocos2d::Vec3 &pos);
63 void createObstacle(
const cocos2d::Vec3 &pos);
64 void moveAgents(
const cocos2d::Vec3 &des);
65 virtual void touchesBegan(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event){};
66 virtual void touchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event){};
67 virtual void touchesEnded(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event){};
70 cocos2d::Camera *_camera;
72 std::vector<std::pair<cocos2d::NavMeshAgent *, cocos2d::Animate3D *> > _agents;
76class NavMeshBasicTestDemo :
public NavMeshBaseTestDemo
79 CREATE_FUNC(NavMeshBasicTestDemo);
80 NavMeshBasicTestDemo();
81 virtual ~NavMeshBasicTestDemo();
84 virtual bool init()
override;
85 virtual std::string title()
const override;
86 virtual std::string subtitle()
const override;
88 virtual void onEnter()
override;
92 virtual void touchesBegan(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override{};
93 virtual void touchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override{};
94 virtual void touchesEnded(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override;
97 cocos2d::Label *_debugLabel;
100class NavMeshAdvanceTestDemo :
public NavMeshBaseTestDemo
103 CREATE_FUNC(NavMeshAdvanceTestDemo);
104 NavMeshAdvanceTestDemo();
105 virtual ~NavMeshAdvanceTestDemo();
108 virtual bool init()
override;
109 virtual std::string title()
const override;
110 virtual std::string subtitle()
const override;
112 virtual void onEnter()
override;
116 virtual void touchesBegan(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override{};
117 virtual void touchesMoved(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override{};
118 virtual void touchesEnded(
const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event)
override;
121 cocos2d::Label *_obstacleLabel;
122 cocos2d::Label *_agentLabel;
123 cocos2d::Label *_debugLabel;
DEFINE_TEST_SUITE(NavMeshTests)
CREATE_FUNC(NavMeshDisabled)
virtual void onEnter() override