Last active
August 29, 2015 13:56
-
-
Save dadon/9133945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BehaviorSource(object): | |
def get_behavior(self, unit_data, state_data): | |
raise NotImplementedError | |
class LocalAIBehaviorSource(BehaviorSource): | |
pass | |
class GlobalAIBehaviorSource(BehaviorSource): | |
pass | |
class UserInputBehaviorSource(BehaviorSource): | |
pass | |
class BehaviorSourceManager(BehaviorSource): | |
def __init__(self, sources): | |
self.sources = sources | |
def get_behavior(self, unit_data, state_data): | |
current_behavior = None | |
for source in self.sources: | |
current_behavior = source.get_behavior(unit_data, state_data) | |
if current_behavior: | |
break | |
return current_behavior | |
hero_pve_manager = BehaviorSourceManager([UserInputSource(), LocalAISource()]) | |
hero_pvp_manager = BehaviorSourceManager([GlobalAISource(), LocalAISource()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment