Beispiel #1
0
 def __init__(self, radius, locations, extragoal=None):
     Goal.__init__(self, "roam randomly", false, [
         self.check_move_valid,
         MoveMe(None),
         goal_create(extragoal), self.do_roaming
     ])
     self.list = locations
     self.radius = radius
     self.count = len(locations)
     self.vars = ["radius", "list"]
Beispiel #2
0
 def goals_updated(self, entity):
     # For now just clear and recreate all goals when _goals changes. We would probably rather only recreate those that have changed though.
     goals = entity.props['_goals']
     # First clear all goals
     while len(self.goals):
         self.remove_goal(self.goals[0])
     if goals:
         for goal_element in goals:
             goal = goal_create(goal_element)
             self.insert_goal(goal)
Beispiel #3
0
 def __init__(self, radius, locations, extragoal=None):
     Goal.__init__(self, "roam randomly", false,
                   [self.check_move_valid,
                    move_me(None),
                    goal_create(extragoal),
                    self.do_roaming])
     self.list = locations
     self.radius = radius
     self.count = len(locations)
     self.vars = ["radius", "list"]
Beispiel #4
0
 def goals_updated(self, entity):
     print('Goals updated.')
     # For now just clear and recreate all goals when _goals changes. We would probably rather only recreate those that have changed though.
     goals = entity.props._goals
     # First clear all goals
     while len(self.goals):
         self.remove_goal(self.goals[0])
     if goals:
         for goal_element in goals:
             goal = goal_create(goal_element)
             self.insert_goal(goal)