コード例 #1
0
ファイル: entry.py プロジェクト: fgrandhomme/pylayers
    def generate(self):
        while True:
            start = uniform(1, 199)

            if not prts_only:
                p = Person(interval=interval)
                p.behaviors = [Seek(), Separation()]
                p.position = vec3(0.0, start)
                platform_position = start * 54 / 199 - 27
                p.destination = vec3(28, 100 + platform_position)
                p.manager = self.rail_station.person_at_platform
                activate(p, p.move(), 0.0)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(100.0, start)
            platform_position = start * 8 / 199
            if start < 100:
                p.destination = self.destination1.copy()
                p.manager = self.station1.person_at_station
                p.manager_args = []
            else:
                p.destination = self.destination2.copy()
                p.manager = self.station2.person_at_station
                p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 7
コード例 #2
0
ファイル: stadium.py プロジェクト: fgrandhomme/pylayers
    def generate(self):
        """
        creates a Person at the same time and same relative place on each
        of the PRT and LRT lines.
        """
        prt_platform_length = self.p1_y2 - self.p1_y1
        rail_platform_length = self.r_y2 - self.r_y1
        people = 0
        # http://findarticles.com/p/articles/mi_m1215/is_9_204/ai_108788436
        event_max = 5000
        while people < event_max:
            people += 1
            if (people % 100) == 0:
                print "people: ", people

            start = uniform(0, 100)

            if start < 33.33:
                p = Person(interval=interval)
                p.behaviors = [Seek(), Separation()]
                p.manager_args = []
                if start < 16.66:
                    p_start = self.p1_y1 + start * 6 * prt_platform_length / 100
                    p.position = vec3(self.p1_x, p_start)
                    platform_position = (p_start - self.p1_y1) * 0.7
                    p.destination = vec3(28., self.p1_y1 + 4 + platform_position)
                    p.manager = self.prt_station1.person_at_station
                else:
                    p_start = self.p2_y1 + (start - 16.66) * 6 * prt_platform_length / 100
                    p.position = vec3(self.p2_x, p_start)
                    platform_position = (p_start - self.p2_y1) * 0.7
                    p.destination = vec3(28., self.p2_y1 + 4 + platform_position)
                    p.manager = self.prt_station2.person_at_station
                activate(p, p.move(), 0.0)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(self.r_x, self.r_y1 + 12 + start * 0.6 * rail_platform_length / 100)
            platform_position = start * (self.r_y2 - self.r_y1) / 100
            p.destination = vec3(78., self.r_y1 + platform_position)
            p.manager = self.rail_station.person_at_platform
            p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 0.25

        yield passivate, self
コード例 #3
0
ファイル: flood.py プロジェクト: fgrandhomme/pylayers
    def generate(self):
        while True:
            start = uniform(5, 40)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(100.0, start)
            platform_position = start * 8 / 199
            p.destination = self.destination1.copy()
            p.manager = self.station1.person_at_station
            p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 3.5