Пример #1
0
        private void TryInitialize()
        {
            if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped))
            {
                this.eIdleSpin.Cue.Stop(false);
            }
            this.eIdleSpin        = (SoundEmitter)null;
            this.rgbPlanes        = (Mesh)null;
            this.particles        = (PlaneParticleSystem)null;
            this.Phase            = LesserWarp.Phases.None;
            this.sinceInitialized = 0.0f;
            this.GateAo           = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => x.ArtObject.ActorType == ActorType.LesserGate));
            if (this.GateAo == null)
            {
                return;
            }
            this.InitializeRgbGate();
            LesserWarp lesserWarp = this;
            Mesh       mesh1      = new Mesh();
            Mesh       mesh2      = mesh1;

            DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
            textured1.Fullbright = true;
            DefaultEffect.Textured textured2 = textured1;
            mesh2.Effect      = (BaseEffect)textured2;
            mesh1.DepthWrites = false;
            mesh1.Texture     = (Dirtyable <Texture>)((Texture)this.WhiteTexture);
            mesh1.Rotation    = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f);
            Mesh mesh3 = mesh1;

            lesserWarp.MaskMesh = mesh3;
            this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true);
            this.MaskMesh.BakeTransformWithNormal <FezVertexPositionNormalTexture>();
            this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f;
            this.HasCubeShard      = Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, (Func <TrileInstance, bool>)(x =>
            {
                if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type))
                {
                    return((double)Vector3.Distance(x.Center, this.GateAo.Position) < 3.0);
                }
                else
                {
                    return(false);
                }
            }));
            this.OriginalPosition = this.GateAo.Position;
            this.sRise            = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpRise");
            this.sLower           = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpLower");
            this.sActivate        = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/WarpGateActivate");
            this.eIdleSpin        = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true);
        }
Пример #2
0
 private void DoLoad(bool dummy)
 {
     this.LevelManager.ChangeLevel(this.GateAo.ActorSettings.DestinationLevel);
     this.Phase = LesserWarp.Phases.FadeIn;
     this.GameState.SaveData.Ground      = Enumerable.First <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => x.ArtObject.ActorType == ActorType.WarpGate)).Position + Vector3.Down + FezMath.AsVector(FezMath.VisibleOrientation(this.GameState.SaveData.View)) * 2f;
     this.DotManager.PreventPoI          = false;
     this.PlayerManager.Hidden           = false;
     this.PlayerManager.CheckpointGround = (TrileInstance)null;
     this.PlayerManager.RespawnAtCheckpoint();
     this.CameraManager.Center = this.PlayerManager.Position + Vector3.Up * this.PlayerManager.Size.Y / 2f + Vector3.UnitY;
     this.CameraManager.SnapInterpolation();
     this.LevelMaterializer.CullInstances();
     this.GameState.ScheduleLoadEnd = true;
     this.SinceStarted = TimeSpan.Zero;
 }
Пример #3
0
 private void TryInitialize()
 {
   if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped))
     this.eIdleSpin.Cue.Stop(false);
   this.eIdleSpin = (SoundEmitter) null;
   this.rgbPlanes = (Mesh) null;
   this.particles = (PlaneParticleSystem) null;
   this.Phase = LesserWarp.Phases.None;
   this.sinceInitialized = 0.0f;
   this.GateAo = Enumerable.FirstOrDefault<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.LesserGate));
   if (this.GateAo == null)
     return;
   this.InitializeRgbGate();
   LesserWarp lesserWarp = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.Fullbright = true;
   DefaultEffect.Textured textured2 = textured1;
   mesh2.Effect = (BaseEffect) textured2;
   mesh1.DepthWrites = false;
   mesh1.Texture = (Dirtyable<Texture>) ((Texture) this.WhiteTexture);
   mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f);
   Mesh mesh3 = mesh1;
   lesserWarp.MaskMesh = mesh3;
   this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true);
   this.MaskMesh.BakeTransformWithNormal<FezVertexPositionNormalTexture>();
   this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f;
   this.HasCubeShard = Enumerable.Any<TrileInstance>((IEnumerable<TrileInstance>) this.LevelManager.Triles.Values, (Func<TrileInstance, bool>) (x =>
   {
     if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type))
       return (double) Vector3.Distance(x.Center, this.GateAo.Position) < 3.0;
     else
       return false;
   }));
   this.OriginalPosition = this.GateAo.Position;
   this.sRise = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpRise");
   this.sLower = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpLower");
   this.sActivate = this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/WarpGateActivate");
   this.eIdleSpin = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load<SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true);
 }
Пример #4
0
 private void DoLoad(bool dummy)
 {
   this.LevelManager.ChangeLevel(this.GateAo.ActorSettings.DestinationLevel);
   this.Phase = LesserWarp.Phases.FadeIn;
   this.GameState.SaveData.Ground = Enumerable.First<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObject.ActorType == ActorType.WarpGate)).Position + Vector3.Down + FezMath.AsVector(FezMath.VisibleOrientation(this.GameState.SaveData.View)) * 2f;
   this.DotManager.PreventPoI = false;
   this.PlayerManager.Hidden = false;
   this.PlayerManager.CheckpointGround = (TrileInstance) null;
   this.PlayerManager.RespawnAtCheckpoint();
   this.CameraManager.Center = this.PlayerManager.Position + Vector3.Up * this.PlayerManager.Size.Y / 2f + Vector3.UnitY;
   this.CameraManager.SnapInterpolation();
   this.LevelMaterializer.CullInstances();
   this.GameState.ScheduleLoadEnd = true;
   this.SinceStarted = TimeSpan.Zero;
 }
Пример #5
0
 protected override void TestConditions()
 {
   if (this.PlayerManager.Action == ActionType.LesserWarp || this.GateAo == null || this.Phase == LesserWarp.Phases.FadeIn)
     return;
   Vector3 b = FezMath.SideMask(this.CameraManager.Viewpoint);
   Vector3 a = FezMath.Abs(this.OriginalPosition - this.PlayerManager.Position);
   if (this.LevelManager.Name == "ZU_CODE_LOOP" && this.GameState.SaveData.ThisLevel.ScriptingState == "NOT_COLLECTED")
     this.HasCubeShard = true;
   bool flag = (double) FezMath.Dot(a, b) < 3.0 && (double) a.Y < 4.0 && !this.HasCubeShard;
   if (flag && (this.Phase == LesserWarp.Phases.None || this.Phase == LesserWarp.Phases.Lower))
   {
     if (this.Phase != LesserWarp.Phases.Lower)
     {
       this.RiseAxis = FezMath.RightVector(this.CameraManager.Viewpoint);
       this.RisePhi = FezMath.ToPhi(this.CameraManager.Viewpoint);
       this.SinceRisen = TimeSpan.Zero;
       this.SinceStarted = TimeSpan.Zero;
     }
     this.Phase = LesserWarp.Phases.Rise;
     SoundEffectExtensions.EmitAt(this.sRise, this.GateAo.Position);
   }
   else if (!flag && this.Phase != LesserWarp.Phases.Lower && this.Phase != LesserWarp.Phases.None)
   {
     if (this.Phase != LesserWarp.Phases.Rise)
     {
       this.RiseAxis = FezMath.RightVector(this.CameraManager.Viewpoint);
       this.RisePhi = FezMath.ToPhi(this.CameraManager.Viewpoint);
     }
     this.Phase = this.Phase == LesserWarp.Phases.Rise ? LesserWarp.Phases.Lower : LesserWarp.Phases.Decelerate;
     this.SinceStarted = TimeSpan.Zero;
     if (this.Phase == LesserWarp.Phases.Lower)
       SoundEffectExtensions.EmitAt(this.sLower, this.GateAo.Position);
   }
   else if (!flag && this.Phase == LesserWarp.Phases.None && (this.eIdleSpin != null && !this.eIdleSpin.Dead) && this.eIdleSpin.Cue.State == SoundState.Playing)
     this.eIdleSpin.Cue.Pause();
   if (this.HasCubeShard && (double) FezMath.Dot(a, b) < 3.0 && ((double) a.Y < 4.0 && this.PlayerManager.LastAction == ActionType.FindingTreasure))
     this.HasCubeShard = false;
   if (!this.PlayerManager.Grounded || !flag || (this.InputManager.Up != FezButtonState.Pressed || !this.SpeechBubble.Hidden))
     return;
   this.PlayerManager.Action = ActionType.LesserWarp;
   if (this.Phase == LesserWarp.Phases.None)
   {
     this.RiseAxis = FezMath.RightVector(this.CameraManager.Viewpoint);
     this.RisePhi = FezMath.ToPhi(this.CameraManager.Viewpoint);
     this.SinceRisen = TimeSpan.Zero;
     this.SinceStarted = TimeSpan.Zero;
     this.Phase = LesserWarp.Phases.Rise;
     SoundEffectExtensions.EmitAt(this.sRise, this.GateAo.Position);
   }
   else
   {
     if (this.Phase != LesserWarp.Phases.SpinWait)
       return;
     if (this.eIdleSpin.Cue.State == SoundState.Playing)
     {
       if (this.fader != null)
         this.fader.Cancel();
       this.eIdleSpin.FadeOutAndPause(1f);
     }
     this.DotManager.PreventPoI = true;
     this.DotManager.Burrow();
     foreach (SoundEmitter soundEmitter in this.SoundManager.Emitters)
       soundEmitter.FadeOutAndDie(2f);
     this.SoundManager.FadeFrequencies(true, 2f);
     this.SoundManager.FadeVolume(this.SoundManager.MusicVolumeFactor, 0.0f, 3f);
     SoundEffectExtensions.EmitAt(this.sActivate, this.GateAo.Position);
     this.Phase = LesserWarp.Phases.Accelerate;
     this.CameraManager.Constrained = true;
     this.OriginalCenter = this.CameraManager.Center;
     this.PlayerManager.LookingDirection = HorizontalDirection.Left;
     this.PlayerManager.Velocity = Vector3.Zero;
   }
 }
Пример #6
0
        protected override void TestConditions()
        {
            if (this.PlayerManager.Action == ActionType.LesserWarp || this.GateAo == null || this.Phase == LesserWarp.Phases.FadeIn)
            {
                return;
            }
            Vector3 b = FezMath.SideMask(this.CameraManager.Viewpoint);
            Vector3 a = FezMath.Abs(this.OriginalPosition - this.PlayerManager.Position);

            if (this.LevelManager.Name == "ZU_CODE_LOOP" && this.GameState.SaveData.ThisLevel.ScriptingState == "NOT_COLLECTED")
            {
                this.HasCubeShard = true;
            }
            bool flag = (double)FezMath.Dot(a, b) < 3.0 && (double)a.Y < 4.0 && !this.HasCubeShard;

            if (flag && (this.Phase == LesserWarp.Phases.None || this.Phase == LesserWarp.Phases.Lower))
            {
                if (this.Phase != LesserWarp.Phases.Lower)
                {
                    this.RiseAxis     = FezMath.RightVector(this.CameraManager.Viewpoint);
                    this.RisePhi      = FezMath.ToPhi(this.CameraManager.Viewpoint);
                    this.SinceRisen   = TimeSpan.Zero;
                    this.SinceStarted = TimeSpan.Zero;
                }
                this.Phase = LesserWarp.Phases.Rise;
                SoundEffectExtensions.EmitAt(this.sRise, this.GateAo.Position);
            }
            else if (!flag && this.Phase != LesserWarp.Phases.Lower && this.Phase != LesserWarp.Phases.None)
            {
                if (this.Phase != LesserWarp.Phases.Rise)
                {
                    this.RiseAxis = FezMath.RightVector(this.CameraManager.Viewpoint);
                    this.RisePhi  = FezMath.ToPhi(this.CameraManager.Viewpoint);
                }
                this.Phase        = this.Phase == LesserWarp.Phases.Rise ? LesserWarp.Phases.Lower : LesserWarp.Phases.Decelerate;
                this.SinceStarted = TimeSpan.Zero;
                if (this.Phase == LesserWarp.Phases.Lower)
                {
                    SoundEffectExtensions.EmitAt(this.sLower, this.GateAo.Position);
                }
            }
            else if (!flag && this.Phase == LesserWarp.Phases.None && (this.eIdleSpin != null && !this.eIdleSpin.Dead) && this.eIdleSpin.Cue.State == SoundState.Playing)
            {
                this.eIdleSpin.Cue.Pause();
            }
            if (this.HasCubeShard && (double)FezMath.Dot(a, b) < 3.0 && ((double)a.Y < 4.0 && this.PlayerManager.LastAction == ActionType.FindingTreasure))
            {
                this.HasCubeShard = false;
            }
            if (!this.PlayerManager.Grounded || !flag || (this.InputManager.Up != FezButtonState.Pressed || !this.SpeechBubble.Hidden))
            {
                return;
            }
            this.PlayerManager.Action = ActionType.LesserWarp;
            if (this.Phase == LesserWarp.Phases.None)
            {
                this.RiseAxis     = FezMath.RightVector(this.CameraManager.Viewpoint);
                this.RisePhi      = FezMath.ToPhi(this.CameraManager.Viewpoint);
                this.SinceRisen   = TimeSpan.Zero;
                this.SinceStarted = TimeSpan.Zero;
                this.Phase        = LesserWarp.Phases.Rise;
                SoundEffectExtensions.EmitAt(this.sRise, this.GateAo.Position);
            }
            else
            {
                if (this.Phase != LesserWarp.Phases.SpinWait)
                {
                    return;
                }
                if (this.eIdleSpin.Cue.State == SoundState.Playing)
                {
                    if (this.fader != null)
                    {
                        this.fader.Cancel();
                    }
                    this.eIdleSpin.FadeOutAndPause(1f);
                }
                this.DotManager.PreventPoI = true;
                this.DotManager.Burrow();
                foreach (SoundEmitter soundEmitter in this.SoundManager.Emitters)
                {
                    soundEmitter.FadeOutAndDie(2f);
                }
                this.SoundManager.FadeFrequencies(true, 2f);
                this.SoundManager.FadeVolume(this.SoundManager.MusicVolumeFactor, 0.0f, 3f);
                SoundEffectExtensions.EmitAt(this.sActivate, this.GateAo.Position);
                this.Phase = LesserWarp.Phases.Accelerate;
                this.CameraManager.Constrained      = true;
                this.OriginalCenter                 = this.CameraManager.Center;
                this.PlayerManager.LookingDirection = HorizontalDirection.Left;
                this.PlayerManager.Velocity         = Vector3.Zero;
            }
        }