Skip to content

Commit fc137b1

Browse files
committed
3.6.32
1 parent d5e71e2 commit fc137b1

File tree

153 files changed

+3761
-1772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3761
-1772
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cmake_minimum_required (VERSION 2.8)
3131
# set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Profile" CACHE STRING "" FORCE)
3232
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
3333

34-
set (BEHAVIAC_PACKAGE_VERSION 3.6.31)
34+
set (BEHAVIAC_PACKAGE_VERSION 3.6.32)
3535

3636
#option( BUILD_SHARED_LIBS "set to OFF to build static libraries" ON )
3737
SET(BUILD_SHARED_LIBS ON CACHE BOOL "set to OFF to build static libraries")
@@ -443,6 +443,7 @@ if (NOT BEHAVIAC_ANDROID_STUDIO)
443443
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_10/cpp")
444444
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_11/cpp")
445445
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_12/cpp")
446+
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_13/cpp")
446447
else()
447448
add_subdirectory ("${PROJECT_SOURCE_DIR}/tutorials/tutorial_11/cpp")
448449
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/Tencent/behaviac/blob/master/license.txt)
2-
[![Release Version](https://img.shields.io/badge/release-3.6.31-red.svg)](https://github.com/Tencent/behaviac/releases)
2+
[![Release Version](https://img.shields.io/badge/release-3.6.32-red.svg)](https://github.com/Tencent/behaviac/releases)
33
[![Updates](https://img.shields.io/badge/Platform-%20iOS%20%7C%20OS%20X%20%7C%20Android%20%7C%20Windows%20%7C%20Linux%20-brightgreen.svg)](https://github.com/Tencent/behaviac/blob/master/history.txt)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/behaviac/pulls)
55

docs/behaviac.chm

226 Bytes
Binary file not shown.

history.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2017-4-26 3.6.32
2+
Support resetting the children for the SelectorLoop node.
3+
Add the tutorial_13.
4+
15
2017-4-24 3.6.31
26
Fix a bug for generating the codes of the Task and Event.
37
Fix a bug for the hotreload of the meta file.

inc/behaviac/behaviac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
#include "behaviac/behaviortree/behaviortree.h"
2525
#include "behaviac/common/workspace.h"
2626
#include "behaviac/common/file/filemanager.h"
27+
#include "behaviac/common/randomgenerator/randomgenerator.h"
2728

2829
#endif // _BEHAVIAC_BEHAVIAC_H_

inc/behaviac/behaviortree/nodes/composites/selectorloop.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ namespace behaviac {
3939
virtual ~SelectorLoop();
4040
virtual void load(int version, const char* agentType, const properties_t& properties);
4141
virtual bool IsManagingChildrenAsSubTrees() const;
42+
4243
protected:
4344
virtual bool IsValid(Agent* pAgent, BehaviorTask* pTask) const;
45+
4446
private:
4547
virtual BehaviorTask* createTask() const;
46-
//protected:
47-
// Nodes* m_preconditions;
48-
// Nodes* m_actions;
48+
49+
protected:
50+
bool m_bResetChildren;
51+
52+
friend class SelectorLoopTask;
4953
};
5054

5155
class BEHAVIAC_API SelectorLoopTask : public CompositeTask {

inc/behaviac/common/_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
#define BEHAVIAC_RELEASE 0
1212
#endif
1313

14-
#define BEHAVIAC_VERSION_STRING "3.6.31"
14+
#define BEHAVIAC_VERSION_STRING "3.6.32"
1515

inc/behaviac/common/randomgenerator/randomgenerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#endif//#if _SYS_RANDOM_
2323

2424
namespace behaviac {
25-
class RandomGenerator {
25+
class BEHAVIAC_API RandomGenerator {
2626
public:
2727
static RandomGenerator* GetInstance() {
2828
RandomGenerator* pRandomGenerator = RandomGenerator::_GetInstance();

integration/demo_running/behaviac/BehaviorTree/Nodes/Composites/Selectorloop.cs

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,22 @@ namespace behaviac
1717
{
1818
public class SelectorLoop : BehaviorNode
1919
{
20+
protected bool m_bResetChildren = false;
21+
2022
protected override void load(int version, string agentType, List<property_t> properties)
2123
{
2224
base.load(version, agentType, properties);
25+
26+
for (int i = 0; i < properties.Count; ++i)
27+
{
28+
property_t p = properties[i];
29+
30+
if (p.name == "ResetChildren")
31+
{
32+
this.m_bResetChildren = (p.value == "true");
33+
break;
34+
}
35+
}
2336
}
2437

2538
public override bool IsValid(Agent pAgent, BehaviorTask pTask)
@@ -44,9 +57,6 @@ protected override BehaviorTask createTask()
4457
return pTask;
4558
}
4659

47-
//List<BehaviorNode> m_preconditions;
48-
//List<BehaviorNode> m_actions;
49-
5060
// ============================================================================
5161
/**
5262
behavives similarly to SelectorTask, i.e. executing chidren until the first successful one.
@@ -157,15 +167,29 @@ protected override EBTStatus update(Agent pAgent, EBTStatus childStatus)
157167
//clean up the current ticking action tree
158168
if (index != (int) - 1)
159169
{
160-
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex &&
161-
this.m_activeChildIndex != index)
170+
if (this.m_activeChildIndex != CompositeTask.InvalidChildIndex)
162171
{
163-
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
164-
//BehaviorTask action = pCurrentSubTree.ActionNode;
165-
pCurrentSubTree.abort(pAgent);
172+
bool abortChild = (this.m_activeChildIndex != index);
173+
if (!abortChild)
174+
{
175+
SelectorLoop pSelectorLoop = (SelectorLoop)(this.GetNode());
176+
Debug.Check(pSelectorLoop != null);
177+
178+
if (pSelectorLoop != null)
179+
{
180+
abortChild = pSelectorLoop.m_bResetChildren;
181+
}
182+
}
183+
184+
if (abortChild)
185+
{
186+
WithPreconditionTask pCurrentSubTree = (WithPreconditionTask)this.m_children[this.m_activeChildIndex];
187+
//BehaviorTask action = pCurrentSubTree.ActionNode;
188+
pCurrentSubTree.abort(pAgent);
166189

167-
//don't set it here
168-
//this.m_activeChildIndex = index;
190+
//don't set it here
191+
//this.m_activeChildIndex = index;
192+
}
169193
}
170194

171195
for (int i = index; i < this.m_children.Count; ++i)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.6.31
1+
3.6.32

0 commit comments

Comments
 (0)