Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private IStrategy currStrategy;
- private Queue<IStrategy> strategies;
- public void SetStrategy(IStrategy[] strategy)
- {
- currStrategy?.Stop();
- strategies = new Queue<IStrategy>(strategy);
- }
- void Update()
- {
- if (currStrategy.Execute())
- {
- currStrategy?.Stop();
- currStrategy = strategies.Dequeue();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement