Ejemplo n.º 1
0
    def build_final_score_grower(self):
        # Build fading interpolator
        self.final_score_grower = ts = hgn.TimeSensor(
            cycleInterval = 2.0,
            loop = False
        )

        ei = hgn.EaseInEaseOut(
            key = [0, 1],
            easeInEaseOut = [0.1, 0.9, 0.5, 0.5],
        )

        pi = hgn.PositionInterpolator(
            key = [0, 1],
            keyValue = [
                Vec3f(1, 1, 1),
                Vec3f(1, 1, 1) * 2.0,
            ],
        )

        for n in [ts, ei, pi]:
            self.add_child(n)

        ts.h3dNode.fraction_changed.route(
            ei.h3dNode.set_fraction
        )
        ei.h3dNode.modifiedFraction_changed.route(
            pi.h3dNode.set_fraction
        )
        pi.h3dNode.value_changed.routeNoEvent(
            space.nodes["Transform_Score"].h3dNode.scale
        )
Ejemplo n.º 2
0
    def build_feedback_label(self):
        # "Hide" feedback label
        space.nodes["Text_FeedbackLabel"].string = [""]

        # Build fading interpolator
        self.feedback_fader = ts = hgn.TimeSensor(cycleInterval=2.0,
                                                  loop=False)

        si = hgn.ScalarInterpolator(
            key=[0, 0.1, 1],
            keyValue=[1, 0, 1],
        )

        pi = hgn.PositionInterpolator(
            key=[0, 1],
            keyValue=[
                Vec3f(1, 1, 1),
                Vec3f(1, 1, 1) * 1.5,
            ],
        )

        self.add_child(ts)
        self.add_child(si)
        self.add_child(pi)

        ts.h3dNode.fraction_changed.route(si.h3dNode.set_fraction)
        si.h3dNode.value_changed.routeNoEvent(
            space.nodes["Material_YellowChalky"].h3dNode.transparency)

        ts.h3dNode.fraction_changed.route(pi.h3dNode.set_fraction)
        pi.h3dNode.value_changed.routeNoEvent(
            space.nodes["Transform_FeedbackLabel"].h3dNode.scale)
Ejemplo n.º 3
0
    def build(self):
        self.time_sensor = hgn.TimeSensor(cycleInterval=self.duration,
                                          loop=False)

        si = hgn.ScalarInterpolator(
            key=[0, 0.1, 1],
            keyValue=[1, 0, 1],
        )
        self.topnode.add_child(self.time_sensor)
        self.topnode.add_child(si)

        self.time_sensor.h3dNode.fraction_changed.routeNoEvent(
            si.h3dNode.set_fraction)
        si.h3dNode.value_changed.routeNoEvent(
            self.material_node.h3dNode.transparency)
        """
        ei = hgn.EaseInEaseOut(
            key = [0, 1],
            easeInEaseOut = [0.1, 0.9, 0.5, 0.5],
        )

        pi = hgn.PositionInterpolator(
            key = [0, 1],
            keyValue = [
                Vec3f(1, 1, 1),
                Vec3f(1, 1, 1) * 1.3,
            ],
        )
        """
        """
Ejemplo n.º 4
0
    def build_fog(self):
        vr = 1e-3

        self.fog = hgn.Fog(color=FOG_COLOR, visibilityRange=vr)
        self.add_topnode(self.fog)

        self.fogTimer = hgn.TimeSensor(
            cycleInterval=FADE_TIME,
            loop=False,
            enabled=True,
        )

        self.defogTimer = hgn.TimeSensor(
            cycleInterval=FADE_TIME,
            loop=False,
            enabled=True,
        )

        fogInterpolator = hgn.ScalarInterpolator(
            key=[0, 0.9999, 1],
            keyValue=[vr, 1, 0],
        )

        defogInterpolator = hgn.ScalarInterpolator(
            key=[0, 1],
            keyValue=[1, vr],
        )

        self.add_node(self.fogTimer)
        self.add_node(self.defogTimer)
        self.add_node(fogInterpolator)
        self.add_node(defogInterpolator)

        self.fogTimer.h3dNode.fraction_changed.routeNoEvent(
            fogInterpolator.h3dNode.set_fraction)
        self.defogTimer.h3dNode.fraction_changed.routeNoEvent(
            defogInterpolator.h3dNode.set_fraction)
        fogInterpolator.h3dNode.value_changed.routeNoEvent(
            self.fog.h3dNode.visibilityRange)
        defogInterpolator.h3dNode.value_changed.routeNoEvent(
            self.fog.h3dNode.visibilityRange)
Ejemplo n.º 5
0
    def build_enemy_flashers(self):
        self.enemy_flashers = []

        for i in range(self.number_of_enemies):
            ts = hgn.TimeSensor(
                cycleInterval = 0.5,
                loop = False
            )

            si = hgn.ScalarInterpolator(
                key = [0, 0.5, 1],
                keyValue = [0.5, 0, 0.5],
            )

            ci = hgn.ColorInterpolator(
                key = [0, 0.5, 1],
                keyValue = [
                    RGB(0, 0, 0),
                    RGB(1, 1, 1),
                    RGB(0, 0, 0),
                ]
            )

            self.add_child(ts)
            self.add_child(si)
            self.add_child(ci)

            ts.h3dNode.fraction_changed.route(
                si.h3dNode.set_fraction
            )
            si.h3dNode.value_changed.routeNoEvent(
                space.nodes["Material_Enemy.%03d" % i].h3dNode.transparency
            )

            ts.h3dNode.fraction_changed.route(
                ci.h3dNode.set_fraction
            )
            ci.h3dNode.value_changed.routeNoEvent(
                space.nodes["Material_Enemy.%03d" % i].h3dNode.emissiveColor
            )

            self.enemy_flashers.append(ts)
Ejemplo n.º 6
0
    def build_glass_flasher(self):
        self.glass_flasher = ts = hgn.TimeSensor(
            cycleInterval = 0.5,
            loop = False
        )

        si = hgn.ScalarInterpolator(
            key = [0, 0.5, 1],
            keyValue = [1, 0, 1],
        )

        self.add_child(ts)
        self.add_child(si)

        ts.h3dNode.fraction_changed.route(
            si.h3dNode.set_fraction
        )
        si.h3dNode.value_changed.routeNoEvent(
            space.nodes["Material_OuterGlass"].h3dNode.transparency
        )
Ejemplo n.º 7
0
    def build_arrow_fader(self):
        self.arrow_fader = ts = hgn.TimeSensor(
            cycleInterval = 1.5,
            loop = False
        )

        si = hgn.ScalarInterpolator(
            key = [0, 0.5, 1],
            keyValue = [1, 1, 0],
        )

        self.add_child(ts)
        self.add_child(si)

        ts.h3dNode.fraction_changed.route(
            si.h3dNode.set_fraction
        )
        si.h3dNode.value_changed.routeNoEvent(
            space.nodes["Material_GuideArrow"].h3dNode.transparency
        )