Hello!
I’d love help trouble shooting for getting my SingleNodeBlocker to work (same from TBS example). I feel like I have everything required yet it is still not blocking other single node blockers in the scene.
I’ve changed a few lines of code and tested them in the TBS Example that was given to us. I just made it so the TurnBasedAI and SingleNodeBlocker scripts set the BlockManager automatically-- since I can’t set the BlockManager manually due to instantiating objects. They still work in the TBS example-- so I am assuming this is not an issue. I’ve copied the changes below (new lines in bold).
I have a TurnBasedManager GameObject with a TurnBasedManager (this is a copy of the original TBM script with a new name) and BlockManager script, my Units have a TurnBasedAI and SingleNodeBlocker, and my obstacles have a SingleNodeBlocker as well. Any help would be greatly appreciated! I can try to give additional information if needed as well.
TurnBasedAI Change:
protected override void Awake () {
base.Awake();
blockManager = FindObjectOfType();
// Set the traversal provider to block all nodes that are blocked by a SingleNodeBlocker
// except the SingleNodeBlocker owned by this AI (we don’t want to be blocked by ourself)
traversalProvider = new BlockManager.TraversalProvider(blockManager,
BlockManager.BlockMode.AllExceptSelector, new List() { blocker });
}
SingleNodeBlocker Change:
public void BlockAtCurrentPosition () {
manager = FindObjectOfType();
BlockAt(transform.position);
}