Followers 0

# Unity Decision Tree Delays

## 1 post in this topic

I've graduated from using a cluttered FSM for my AI to a Decision Tree of my own creation. I'm using Unity3d and C# for this pet project. I've structured my tree in the following manner without pointer capabilities. However my question, could apply to any decision tree which might implement coroutines.

	protected virtual void Update()
{
StartCoroutine(TriggerTree());
}

IEnumerator TriggerTree()
{
yield return rootDecisionNode.StartCoroutine(rootDecisionNode.TriggerPath());
}


Currently every Update() call a run through of the tree's branches is triggered and it checks branch logic paths to see what leaf should be reached. The last Action leaves at the end of each branch return new WaitForSeconds.

I'm interested in learning the best way to halt the decision tree or perform an animation but still be able to run the tree and check if another leaf has been reached. So if my character is idling, wait for the idle animation to finish before playing another idle animation but if the character is damaged then trigger the damage animation. Is my code design for a decision tree without pointers sound enough as it is?

0

##### Share on other sites

Upon further thought, a structure could be returned with the Action type that was run and the amount of seconds to wait. Store the last Action type, if the new Action type is the same as the last Action type do nothing, if it's a different action type then trigger it.

0

## Create an account

Register a new account

Followers 0

• ### Similar Content

• Are you ready to become the best truck driver?
If the answer is yes then this game is for you!
Various loads of cargo need to be delivered safely. Be careful or things might get broken.
Your driving skills and accuracy will be tested in practice.
Get in your truck and go!

If you passionately adore speed and cars, and most of all dream about tearing around in a large and powerful jeep, this game was made for you. First locate the finish line on the map to complete the level. Map or no map, you have to navigate the terrain like a pro. But you aren’t limited to performing tasks in the game as you are free to explore the area just enjoying the machine and the beautiful scenery.

• By TeoMakao
Hello there!
I am Theo and I am looking for an evil minion/partner in crime to help me with making games. Currently I am working on my first "official" game, which is point&click 2D adventure in Unity with Fungus extension, and I will need some help with that. More about the project and future goals in private.
I need somebody who:
- First and foremost is interested in making games, but since you are on this forum... yeah.
- Is a 2D artist(amateur will do, but must be willing to improve)
- Has at least some grasp around Unity(or is willing to learn)
- Has at least some grasp around Fungus extension for Unity(or is willing to learn)
- Is interested in talking about various concepts of imaginary worlds/characters(I need somebody to help me developing my universe and talking to myself proves inefficient)
And optionally:
- Is interested in fantasy worlds
- Is interested in mythology
- Is interested in sci-fi worlds
- Is interested in talking about interesting ideas, even if they are completly abstract
I am offering up to 50% of any profit made, depending on how engaged you'll be.
This is the first time I am looking for someone to work with me by forums, so if I chose wrong place to announce I am sorry.
If you are interested in working with me - feel free to PM.
I do not expect you to sacrifice all the time for the project. For now it's pretty lightweighted.
• By RobbyT15
I'm a front end web developer trying to get into game development and I was hoping that someone has a project they would like some assistance on.  I've mostly done tutorials in Unity and made a couple games, roll-a-ball, space shooter, but would like to get more experience.  If anyone is willing to give me a chance, please reply to this message or shoot me an email at robbyt15@bmail.com.

• I've recently made Fidget Spinner Unity Template which is available in most online stores. Buy and learn 2D game development with it or make your own reskin of the game.
https://www.gamegorillaz.com/index.php/catalog/product/view/id/2779/s/fidget-spinner-unity-template/
https://www.codester.com/items/4439/fidget-spinner-unity-template

• 11
• 18
• 18
• 15
• 13