justinheinen
New member
Hi, iam trying to set a float variable from behavior tree to a one in my script.
Iam comparing that float to 0, if yes the left side should be played which lets the enemy die. Can i compare to <1 ? Or do i have to limit that in code ?
When would you sync this float ? After taking damage ? And how would you do this properly ?
with m_behaviortree.SetValue("Health" , currenthealth ); ? Or is there a better way ? I guess mapping that variable would be a little bit too much because its not nescessary every frame.
Second question:
Is this generally a good approach for this ? When should you use tasks for disabling rigidbodies etc. and when should you just invoke a method which does all that ? My enemies need to get a weapon disabled. Will i do this via a task which disables a unity gameobject, or would i call it in the "onDeath" Function which is already getting invoked ?
I guess when doing every single line of code in tasks it gets messy fast. Is there any hint how to start right at this ?
Third question:
how to properly use behavior trees. Would you create one tree for each enemy type ? Would it make sense to separate trees ? Like one tree which does the seeking for player, and one which handles the shooting ? Or would you do this all in one tree ?
Thank you
Justin
Iam comparing that float to 0, if yes the left side should be played which lets the enemy die. Can i compare to <1 ? Or do i have to limit that in code ?
When would you sync this float ? After taking damage ? And how would you do this properly ?
with m_behaviortree.SetValue("Health" , currenthealth ); ? Or is there a better way ? I guess mapping that variable would be a little bit too much because its not nescessary every frame.
Second question:
Is this generally a good approach for this ? When should you use tasks for disabling rigidbodies etc. and when should you just invoke a method which does all that ? My enemies need to get a weapon disabled. Will i do this via a task which disables a unity gameobject, or would i call it in the "onDeath" Function which is already getting invoked ?
I guess when doing every single line of code in tasks it gets messy fast. Is there any hint how to start right at this ?
Third question:
how to properly use behavior trees. Would you create one tree for each enemy type ? Would it make sense to separate trees ? Like one tree which does the seeking for player, and one which handles the shooting ? Or would you do this all in one tree ?
Thank you
Justin
Last edited: