示例#1
0
 def E2_CheckAnimatorEnd(self):
     if not self.Logo.Animator.Active:
         self.CurrentFunction = None
         self.Space.SoundSpace.PlayCue("RavenCue")
         sequence = Action.Sequence(self.Owner.Actions)
         Action.Delay(sequence, self.LogoDisplayDelay)
         Action.Call(sequence, self.GoToE3)
示例#2
0
    def Initialize(self, initializer):
        Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
        #Zero.Connect(self.Owner, "WeatherDestory", self.OnWeatherDestory)

        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, self.MaxLife)
        Action.Call(sequence, self.Death)
示例#3
0
    def Ending(self):
        
        
        self.Owner.SphericalParticleEmitter.Size *= 1.05
        self.Owner.SphericalParticleEmitter.EmitRate = 35
        if self.Owner.SphericalParticleEmitter.Size > 25:
            
            d = self.DestinationObject.Transform.WorldTranslation
            z = self.Player.Transform.WorldTranslation.z
            self.Player.Transform.WorldTranslation = Vec3(d.x, d.y, z)
            
            z = self.camera.Transform.WorldTranslation.z
            self.camera.Transform.WorldTranslation = Vec3(d.x, d.y, z)
            
            
            
            
            def showit():
                self.camera.CameraFunction.SetCameraFade(self.ShadingColor,self.ShadingColor*Vec4(1,1,1,0),0.005,0)
                self.Player.RigidBody.Kinematic = False
            
            self.CurrentUpdater = self.Fading
                
            if self.ExtendedDelay:
                self.camera.CameraFunction.SetCameraFade(self.ShadingColor, self.ShadingColor,2,0)
                self.Owner.DestroyInterface.Destroy()

                seq = Action.Sequence(self.Player.Actions)
                Action.Delay(seq, 2)
                Action.Call(seq, showit)
            else:
                self.camera.CameraFunction.SetCameraFade(self.ShadingColor, self.ShadingColor*Vec4(1,1,1,0),0.0025,0)
                self.CurrentUpdater = self.Fading
                self.Player.RigidBody.Kinematic = False
                self.Owner.DestroyInterface.Destroy()
示例#4
0
 def Test(self):
     self.Max = self.MaxRange + random.uniform(0, self.MaxVariation)
     self.Owner.SphereCollider.Radius = self.Max
     sequence = Action.Sequence(self.Owner.Actions)
     Action.Delay(sequence,
                  random.uniform(self.MaxTimeMinVar, self.MaxTimeMaxVar))
     Action.Call(sequence, self.Test)
示例#5
0
 def E1_ActivateLogo(self):
     if self.Camera.CameraFunction.FadeDone :
         self.CurrentFunction = None
         self.Camera.ThunderGenerator.ActivateThunder()
         sequence = Action.Sequence(self.Owner.Actions)
         Action.Delay(sequence, self.E1ToE2Delay)
         Action.Call(sequence, self.GoToE2)
示例#6
0
    def Respawn(self, target):
        self.Owner.Actions.Clear()
        seq = Action.Sequence(self.Owner)

        seq = Action.Sequence(self.Owner)
        Action.Delay(seq, self.RespawnDelay)
        Action.Call(seq, self.PerformRespawn, (target, ))
示例#7
0
    def TeleportThis(self, target):

        if not self.teleporting:
            if self.NextLevel.Name != "DefaultLevel":
                self.Space.FindObjectByName(
                    "Camera").CameraFunction.SetCameraFade(
                        self.TransitionColor * Vec4(1, 1, 1, 0),
                        self.TransitionColor, .03, 0)

                ls = self.Space.FindObjectByName("LevelSettings").LevelStart
                if ls:
                    ls.HUDManager.HideBoxes()
                    hm = ls.HUDManager
                    hm.CacheSkills()

                sequence = Action.Sequence(self.Owner.Actions)
                Action.Delay(sequence, 1.5)
                Action.Call(sequence,
                            lambda: self.Space.LoadLevel(self.NextLevel))
                self.teleporting = True

        if self.Teleport:
            camera = self.Space.FindObjectByName("Camera")

            dest = self.Teleport.Transform.Translation
            ct = camera.Transform.Translation
            pt = target.Transform.Translation

            #camera.CameraFunction.SetCameraFade(Vec4(0,0,0,1),Vec4(0,0,0,0),.03,0)
            #camera.Transform.Translation = VectorMath.Vec3(dest.x, dest.y,ct.z)
            target.Transform.Translation = VectorMath.Vec3(
                dest.x, dest.y, pt.z)
示例#8
0
    def Thunder_1(self):
        self.NumberTimes -= 1
        if self.NumberTimes < 0:
            self.CurrentUpdate = None
            self.Space.SoundSpace.PlayCue(self.ThunderCue)
            sequence = Action.Sequence(self.Owner.Actions)
            Action.Delay(sequence, self.ActiveCD)
            Action.Call(sequence, self.ActiveThunder)
            return

        self.ThunderLayer.Sprite.Color = Vec3(self.ThunderLayer.Sprite.Color.x,
                                              self.ThunderLayer.Sprite.Color.y,
                                              self.ThunderLayer.Sprite.Color.z,
                                              self.Alpha_Upper)
        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, random.uniform(self.CD_Lower, self.CD_Upper))
        Action.Call(sequence, self.Thunder_2)
示例#9
0
    def OpenDoor(self):
        self.Owner.Sprite.SpriteSource = self.DoorTable.FindResource("Black")
        self.Space.FindObjectByName("Camera").CameraFunction.SetCameraFade(
            Vec4(1, 1, 1, 0), Vec4(1, 1, 1, 1), .03, 0)

        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, 1.5)
        Action.Call(sequence, lambda: self.Space.LoadLevel(self.NextLevel))
示例#10
0
 def Untrigger():
     self.Trigger(False)
     self.Owner.SoundEmitter.Stop()
     self.Owner.SoundEmitter.PlayCue("DingCue")
     
     def TurnTriggerable():
         self.triggerable = True
     Action.Delay(seq, .5)
     Action.Call(seq, TurnTriggerable)
示例#11
0
 def ReUntrigger(target):
     
     for ch in target.Collider.Contacts:
         if ch.OtherObject.PlayerController:
             target.Collider.Ghost = True
             Action.Delay(seq,0.05)
             Action.Call(seq, ReUntrigger, target)
             return
     target.Collider.Ghost = False
示例#12
0
    def Thunder_2(self):
        self.ThunderLayer.Sprite.Color = Vec3(self.ThunderLayer.Sprite.Color.x,
                                              self.ThunderLayer.Sprite.Color.y,
                                              self.ThunderLayer.Sprite.Color.z,
                                              self.Alpha_Lower)

        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, random.uniform(self.CD_Lower, self.CD_Upper))
        Action.Call(sequence, self.Thunder_1)
示例#13
0
 def OnCollision(self, CollisionEvent):
     CollisionEvent.OtherObject.RigidBody.Kinematic = True
     seq = Action.Sequence(self.Owner.Actions)
     Action.Delay(seq,1)
     
     
     def Blacker():
         self.Space.FindObjectByName("Camera").CameraFunction.SetCameraFade(VectorMath.Vec4(0,0,0,0),VectorMath.Vec4(0,0,0,1),0.15,0)
         self.Space.FindObjectByName("LevelSettings").LevelStart.HUDManager.HideBoxes()
     Action.Call(seq, Blacker)
     
     Action.Delay(seq,3)
     
     def DestroyAll():
         self.Space.LoadLevel("MenuScreen")
         self.Space.FindObjectByName("LevelSettings").LevelStart.HUDManager.Space.Destroy()
     Action.Call(seq, DestroyAll)
     
     Zero.Disconnect(self.Owner, Events.CollisionStarted, self)
示例#14
0
 def OnCollision(self, CollisionEvent):
     if CollisionEvent.OtherObject.AbilityStatus:
         CollisionEvent.OtherObject.AbilityStatus.SwapPhysSkill("")
         CollisionEvent.OtherObject.AbilityStatus.SwapTreeSkill("")
         camera = self.Space.FindObjectByName("Camera")
             
         seq = Action.Sequence(self.Owner.Actions)
         camera.CameraFunction.SetCameraFade(Vec4(0, 0, 0, 0), Vec4(1, 0, 0, .9), .2, 0)
         Action.Delay(seq, .3)
         Action.Call(seq, lambda: camera.CameraFunction.SetCameraFade(Vec4(1, 0, 0, .9), Vec4(0, 0, 0, 0), .03, 0))
示例#15
0
    def ExplodeState(self, UpdateEvent):
        #self.Owner.SphericalParticleEmitter.Size -= UpdateEvent.Dt * 10
        #if self.Owner.SphericalParticleEmitter.Size <= 1:
        self.CurrentUpdate = None
        sequence = Action.Sequence(self.Owner)
        Action.Delay(sequence, 0.5)

        def SetState():
            self.CurrentUpdate = self.EndState

        Action.Call(sequence, SetState)
示例#16
0
    def Test(self):
        self.Max = self.MaxRange + random.uniform(0, self.MaxVariation)
        self.Owner.SphereCollider.Radius = self.Max

        self.LightStart.Min = self.Min
        self.LightStart.Max = self.Max
        self.LightStart.Source = self.Owner
        self.LightStart.Center = self.Owner.Transform.Translation

        Action.Delay(self.sequence,
                     random.uniform(self.MaxTimeMinVar, self.MaxTimeMaxVar))
        Action.Call(self.sequence, self.Test)
示例#17
0
    def UpUpdate(self):
        self.Owner.Transform.Scale *= 1.02
        if self.Owner.RigidBody.Velocity.y < 0:
            self.CurrentUpdate = self.WaitUpdate

            seq = Action.Sequence(self.Owner.Actions)
            Action.Delay(seq, self.FlyingDelay)

            def ToDown():
                self.CurrentUpdate = self.DownUpdate

            Action.Call(seq, ToDown)
示例#18
0
    def Test2(self):
        self.Min = self.MinRange + random.uniform(0, self.MinVariation)
        sequence = Action.Sequence(self.Owner.Actions)

        self.LightStart.Min = self.Min
        self.LightStart.Max = self.Max
        self.LightStart.Source = self.Owner
        self.LightStart.Center = self.Owner.Transform.Translation

        Action.Delay(self.sequence,
                     random.uniform(self.MinTimeMinVar, self.MinTimeMaxVar))
        Action.Call(self.sequence, self.Test2)
示例#19
0
    def OnCollision(self, CollideEvent):
        if CollideEvent.OtherObject == self.Target:

            def DestroyIt():
                self.Space.CreateAtPosition(
                    "SoulHitEffect", self.Owner.Transform.WorldTranslation)
                self.Owner.Destroy()

            seq = Action.Sequence(self.Owner.Actions)
            Action.Delay(seq, 0.1)
            Action.Call(seq, DestroyIt)
            Zero.Disconnect(self.Owner, Events.CollisionStarted, self)
    def OnLogicUpdate(self, UpdateEvent):

        #if(self.Start == True):

        #self.Owner.SoundEmitter.Volume = 1
        #self.Owner.SoundEmitter.PlayCue("AllOnline")

        #self.Start = False

        sequence = Action.Sequence(self.Owner.Actions)

        if (self.CurrentHealth <= 0):
            self.CurrentHealth = 0
            Position = self.Owner.Transform.WorldTranslation

            if (self.DeathSpawn == False):
                PivotBody = self.Owner.FindChildByName("BodyPivot")
                Body = self.Owner.FindChildByName("HeavyGunManBody")
                Weapon1 = self.Owner.FindChildByName("Look")
                Weapon2 = self.Owner.FindChildByName("GiantMiniGun1")
                Weapon3 = self.Owner.FindChildByName("GiantMiniGun2")
                Weapon4 = self.Owner.FindChildByName("GiantMiniGun3")

                PivotBody.RemoveComponentByName("HeavyGunManBody")
                Weapon1.RemoveComponentByName("Look")
                Weapon1.RemoveComponentByName("Look2")
                Weapon1.RemoveComponentByName("Look3")
                Weapon1.RemoveComponentByName("Look4")
                Weapon1.RemoveComponentByName("Look5")
                Weapon1.RemoveComponentByName("Look6")
                Weapon1.RemoveComponentByName("Look7")
                Weapon1.RemoveComponentByName("Look8")
                Weapon1.RemoveComponentByName("Look9")
                Weapon2.RemoveComponentByName("GiantMiniGun1")
                Weapon3.RemoveComponentByName("GiantMiniGun1")
                Weapon4.RemoveComponentByName("GiantMiniGun1")

                self.Owner.RemoveComponentByName("HeavyGunManController")

                self.Owner.Sprite.SpriteSource = "HeavyGunManIdle"
                Body.Sprite.SpriteSource = "HeavyGunManBody"

                if (self.LayDead is False):
                    self.Owner.RigidBody.RotationLocked = False
                    self.Owner.RigidBody.Velocity = Vector3(0, 0, 0)
                    self.Owner.Transform.Rotation = Quaternion(0, 0, 1.5)
                    PivotBody.Transform.WorldRotation = Quaternion(0, 0, 1.5)
                    self.LayDead = True
                self.DeathSpawn = True

            Action.Delay(sequence, 5.0)
            Action.Call(sequence, self.OnDeath)
示例#21
0
    def OnCollision(self, CollisionEvent):
        if self.Active and CollisionEvent.OtherObject.CanTeleport:
            CollisionEvent.OtherObject.CanTeleport.Teleport(self.Owner)
            self.Active = False

            # set dumb duration
            seq = Action.Sequence(self.Owner.Actions)
            Action.Delay(seq, self.TeleportDelay)

            def Activate():
                self.Active = True

            Action.Call(seq, Activate)
示例#22
0
    def Die(self):
        if not self.DeathActive:
            return

        self.DeathActive = False
        self.Owner.Sprite.Visible = False
        self.Owner.BoxCollider.Ghost = True
        self.Owner.PlayerController.Active = False
        self.Owner.Sprite.AnimationActive = False
        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, self.Delay_Die)
        Action.Call(sequence, self.DelayDie)
        self.Death_Stage1()
示例#23
0
    def SetCameraShake(self, x_Enable, x_Radius, y_Enable, y_Radius, time, cd):
        if self.ShakeEnable: return

        self.ShakeEnable = True
        self.ShakeCenter = self.Owner.Transform.Translation
        self.ShakeInX = x_Enable
        self.ShakeInY = y_Enable
        self.ShakeRadiusX = x_Radius
        self.ShakeRadiusY = y_Radius
        self.ShakeDelay = cd
        self.ShakeTimer = 0
        sequence = Action.Sequence(self.Owner.Actions)
        Action.Delay(sequence, time)
        Action.Call(sequence, self.TurnOffCameraShake)
示例#24
0
    def FreezeThem(self, poss):
        for pair in poss:
            target = self.RecArray[pair[1]][pair[0]]
            if not target.FreezeAnimReceiver.IsActivated():
                target.FreezeAnimReceiver.Freeze()

        nextset = set(sum([self.GetNeighbor(pair) for pair in poss], tuple()))
        nextset -= self.frozen_set
        print(nextset)
        self.frozen_set.update(nextset)

        if nextset:
            seq = Action.Sequence(self.Owner.Actions)
            Action.Delay(seq, 0.1)
            Action.Call(seq, self.FreezeThem, (nextset, ))
示例#25
0
    def Play(self):
        self.EnsureSoundEmitter()
        if self.Active:
            self.Owner.SoundEmitter.PlayCue(self.nowplay)
            self.nowplay, self.nextplay = self.nextplay, self.nowplay

            if self.nowplay.Volume > 0.5:
                self.nowplay.Volume *= 0.9
            self.nextplay.Volume = self.nowplay.Volume
        else:
            self.nowplay.Volume *= 1.03 if self.nowplay.Volume <= 1 else 1
            self.nextplay.Volume = self.nowplay.Volume

        Action.Delay(self.seq, self.Duration)
        Action.Call(self.seq, self.Play)
示例#26
0
    def OnLogicUpdate(self, UpdateEvent):

        #if(self.Start == True):

        #self.Owner.SoundEmitter.Volume = 1
        #self.Owner.SoundEmitter.PlayCue("AllOnline")

        #self.Start = False

        sequence = Action.Sequence(self.Owner.Actions)

        if (Zero.Keyboard.KeyIsPressed(Zero.Keys.L)):
            self.CurrentHealth -= 25

        if (self.CurrentHealth <= 0):
            self.CurrentHealth = 0
            Position = self.Owner.Transform.Translation

            if (self.DeathSpawn == False):
                PivotBody = self.Owner.FindChildByName("BodyPivot")
                Body = self.Owner.FindChildByName("PeytonBody")
                Weapon1 = self.Owner.FindChildByName("MiniMachineGun1")
                Weapon2 = self.Owner.FindChildByName("MiniMachineGun2")
                Weapon3 = self.Owner.FindChildByName("MiniMachineGun3")

                PivotBody.RemoveComponentByName("PeytonBody")
                Body.RemoveComponentByName("PeytonBodyShoot")
                Weapon1.RemoveComponentByName("MiniMachineGun1")
                Weapon2.RemoveComponentByName("MiniMachineGun1")
                Weapon3.RemoveComponentByName("MiniMachineGun1")

                self.Owner.RemoveComponentByName("PeytonPlayerController")

                self.Owner.Sprite.SpriteSource = "PeytonIdle"
                Body.Sprite.SpriteSource = "PeytonBody"

                if (self.LayDead is False):
                    self.Owner.RigidBody.RotationLocked = False
                    self.Owner.RigidBody.Velocity = Vector3(0, 0, 0)
                    #self.Owner.RigidBody.ApplyAngularVelocity(Vector3(0, 0, 5))
                    #self.Owner.RigidBody.AngularVelocity = Vector3(0, 0, 10)
                    self.Owner.Transform.Rotation = Quaternion(0, 0, 1.5)
                    PivotBody.Transform.WorldRotation = Quaternion(0, 0, 1.5)
                    self.LayDead = True
                self.DeathSpawn = True

            Action.Delay(sequence, 5.0)
            Action.Call(sequence, self.OnDeath)
示例#27
0
    def ContinueHurt(self):
        self.Owner.HealthStatus.AddHealth(self.HurtRate)

        if not self.Owner.HealthStatus.IsDead():

            Action.Delay(self.sequence, 0.2)
            Action.Call(self.sequence, self.ContinueHurt)
            if self.Owner.Sprite.Color == Color.Red:
                self.Owner.Sprite.Color = Color.White
            else:
                self.Owner.Sprite.Color = Color.Red
        else:
            self.Owner.ClickReceiver.PerformDie()
            self.Owner.BurnAnim.Active = False
            self.Owner.CanBurn.Active = False
            self.Owner.Sprite.Color = Color.White
示例#28
0
 def Die(self):
     self.IsImmune = True
     if not self.DeathActive:
         return
     if self.Owner.CanHook:
         self.Owner.CanHook.ForceUnhooked()
     if self.Owner.PlayerController.Mouse:
         self.Owner.PlayerController.Mouse.MouseLocationIndicator.Deactivated = True
     self.DeathActive = False
     self.Owner.Sprite.Visible = False
     self.Owner.Collider.Ghost = True
     self.Owner.PlayerController.Active = False
     self.Owner.Sprite.AnimationActive = False
     sequence = Action.Sequence(self.Owner.Actions)
     Action.Delay(sequence, self.Delay_Die)
     Action.Call(sequence, self.DelayDie)
     self.Death_Stage1()
示例#29
0
    def OnTrigger(self, TriggerEvent):     
        should_trigger = TriggerEvent.Trigger
        
        target_list = [self.Owner]
        if self.Owner.Hierarchy:
            target_list += list(self.Owner.Hierarchy.Children)

        seq = Action.Sequence(self.Owner.Actions)


        def ReUntrigger(target):
            
            for ch in target.Collider.Contacts:
                if ch.OtherObject.PlayerController:
                    target.Collider.Ghost = True
                    Action.Delay(seq,0.05)
                    Action.Call(seq, ReUntrigger, target)
                    return
            target.Collider.Ghost = False
                            

        def startfade(target):
            target.FadeAnim.Active = True
            target.FadeAnim.FadeDirection = -3 if should_trigger else +3
            if target.Collider:
                if should_trigger:
                    target.Collider.Ghost = True
                else:
                    target.Collider.Ghost = False
                    for ch in target.Collider.Contacts:
                        if ch.OtherObject.PlayerController:
                            ReUntrigger(target)
                
            if should_trigger and target.IsSentry:
                target.RemoveComponentByName("IsSentry")
            elif not should_trigger and not target.IsSentry:
                target.AddComponentByName("IsSentry")
        
        
        for target in target_list:
            if target.FadeAnim:
                Action.Delay(seq, random.random()/5)
                Action.Call(seq, startfade, target)
            elif target.Sprite:
                c = target.Sprite.Color
                target.Sprite.Color = Vec4(c.x,c.y,c.z,0) if should_trigger else Vec4(c.x,c.y,c.z,1)
示例#30
0
    def OnCollision(self, CollisionEvent):
        if self.Active and CollisionEvent.OtherObject.Bounceable:

            self.EnsureSoundEmitter()
            self.Owner.SoundEmitter.PlayCue("BounceCue")
            self.Owner.SoundEmitter.Volume *= 0.9

            def RecoverVolume():
                self.Owner.SoundEmitter.Volume /= 0.9

            seq = Action.Sequence(self.Owner.Actions)
            Action.Delay(seq, 2)
            Action.Call(seq, RecoverVolume)

            modifier = -1 if self.UpdateBasedOnSprite and self.Owner.Sprite.FlipX else 1
            adder = 0
            if self.TopModify:
                boxloc = self.Owner.Transform.Translation + self.Owner.BoxCollider.Offset

                boxdims = self.Owner.BoxCollider.Size
                angle = self.Owner.Transform.EulerAngles.z
                normal = VectorMath.Vec3.RotateVector(VectorMath.Vec3(0, 1, 0),
                                                      VectorMath.Vec3(0, 0, 1),
                                                      angle)

                shifter = (boxloc + boxdims * .5 *
                           normal) - CollisionEvent.FirstPoint.WorldPoint

                adder = shifter.y if shifter.y > 0 else 0
                #if self.Owner.Name == "Mushroom":
                #    print(adder)
                ##rigid = CollisionEvent.OtherObject.RigidBody

                #def Modifying():
                #    rigid.Velocity += VectorMath.Vec3(0, shifter.y,0)

                #seq = Action.Sequence(CollisionEvent.OtherObject.Actions)
                #Action.Call(seq, Modifying)
                #Action.Delay(seq, 0.1)

            if CollisionEvent.OtherObject.Bounceable:
                impulseEvent = Zero.ScriptEvent()
                impulseEvent.ForcedVx = self.ForcedVx * modifier
                impulseEvent.ForcedVy = self.ForcedVy + adder
                CollisionEvent.OtherObject.DispatchEvent(
                    "BounceEvent", impulseEvent)