Exemple #1
0
    def update(self, time):
        self.last_scan += 1
        if self.last_scan > 200:
            [ self.look(agent) for agent in self.agents ]
            self.last_scan = 0

        Environment.update(self, time)
Exemple #2
0
 def __init__(self, area):
     Environment.__init__(self)
     self.area = area
     self.last_scan = 99999
Exemple #3
0
 def add(self, agent, entity):
     agent.entity = entity
     Environment.add(self, agent)
Exemple #4
0
from pygoap.goals import *

from pygoap.agent import GoapAgent
from pygoap.environment import Environment


class PrintActionContext(CalledOnceContext):
    def enter(self):
        print "hello world"

class PrintAction(ActionBuilder):
    def get_actions(self, caller, memory):
        action = PrintActionContext(caller)
        action.effects.append(SimpleGoal(introduced_self=True))
        yield action



agent = GoapAgent()
agent.add_action(PrintAction())

friendly_goal = SimpleGoal(introduced_self=True)
agent.add_goal(friendly_goal)

env = Environment()
env.add(agent)

env.update(1)