Mastahg,
While playing around a bit with a combat routine for pet classes, I've come to realize that when I'm doing both my players rotation, along with trying to handle the casting for pets....I can only actually cast 1 of the abilities at a time.
What I am looking to do is create my own "PetCombatBehavior".
It would look something like:
I can get this code to work just fine. What I'm realizing is that I will need to actually start a new worker thread and actually pulse that Composite myself on that new worker thread.
I'm not worried about the details of starting up a new thread and making sure I don't have syncing issues, but where I would like a little help is in actually starting the Composite itself and doing the ticks.
I see that ActionRunCoroutine has a Start() method, but it takes an Object as a parameter and I really don't know what I should be passing into it.
The idea I have is that in my event handler for OnBotStart, I would create a new thread while passing it a cancellation source. In this new thread is where I'd call the Start method on the PetCombatBehavior and handle anything else I need to.
Then in my event handler for OnBotStop, I would call cancel on my cancellation source so that I can gracefully exit the Pet thread.
Do you see any problems with the above ideas?
What do you pass into the Start() method on a Composite?
Thanks in advance,
-Rahl
While playing around a bit with a combat routine for pet classes, I've come to realize that when I'm doing both my players rotation, along with trying to handle the casting for pets....I can only actually cast 1 of the abilities at a time.
What I am looking to do is create my own "PetCombatBehavior".
It would look something like:
Code:
private ActionRunCoroutine _petCombatBehavior;
public ActionRunCoroutine PetCombatBehavior
{
get { return _petCombatBehavior ?? (_petCombatBehavior = new ActionRunCoroutine(ctx => PetRotation.Combat()));
}
I can get this code to work just fine. What I'm realizing is that I will need to actually start a new worker thread and actually pulse that Composite myself on that new worker thread.
I'm not worried about the details of starting up a new thread and making sure I don't have syncing issues, but where I would like a little help is in actually starting the Composite itself and doing the ticks.
I see that ActionRunCoroutine has a Start() method, but it takes an Object as a parameter and I really don't know what I should be passing into it.
The idea I have is that in my event handler for OnBotStart, I would create a new thread while passing it a cancellation source. In this new thread is where I'd call the Start method on the PetCombatBehavior and handle anything else I need to.
Then in my event handler for OnBotStop, I would call cancel on my cancellation source so that I can gracefully exit the Pet thread.
Do you see any problems with the above ideas?
What do you pass into the Start() method on a Composite?
Thanks in advance,
-Rahl