Esempio n. 1
0
 private void TestCodePattern(Volume volume)
 {
     if (PatternTester.Test((IList <CodeInput>) this.Input, volume.ActorSettings.CodePattern))
     {
         this.Input.Clear();
         Waiters.Wait((Func <bool>)(() => this.CameraManager.ViewTransitionReached), (Action)(() =>
         {
             this.VolumeService.OnCodeAccepted(volume.Id);
             this.GameState.SaveData.AnyCodeDeciphered = true;
             this.LevelService.ResolvePuzzle();
         }));
     }
     this.SinceInput = TimeSpan.Zero;
 }
Esempio n. 2
0
 private void CheckForPattern()
 {
     if (!this.Enabled || this.GameState.Loading)
     {
         return;
     }
     this.Input.Add(FezMath.GetDistance(this.CameraManager.Viewpoint, this.CameraManager.LastViewpoint) == 1 ? VibrationMotor.LeftLow : VibrationMotor.RightHigh);
     if (this.Input.Count > 16)
     {
         this.Input.RemoveAt(0);
     }
     if (!PatternTester.Test((IList <VibrationMotor>) this.Input, this.ArtObject.ActorSettings.VibrationPattern))
     {
         return;
     }
     this.Input.Clear();
     this.Enabled = false;
     Waiters.Wait((Func <bool>)(() => this.CameraManager.ViewTransitionReached), new Action(this.Solve));
 }
Esempio n. 3
0
        private void TestInput()
        {
            CodeInput codeInput = CodeInput.None;

            if (this.InputManager.Jump == FezButtonState.Pressed)
            {
                codeInput = CodeInput.Jump;
            }
            else if (this.InputManager.RotateRight == FezButtonState.Pressed)
            {
                codeInput = CodeInput.SpinRight;
            }
            else if (this.InputManager.RotateLeft == FezButtonState.Pressed)
            {
                codeInput = CodeInput.SpinLeft;
            }
            else if (this.InputManager.Left == FezButtonState.Pressed)
            {
                codeInput = CodeInput.Left;
            }
            else if (this.InputManager.Right == FezButtonState.Pressed)
            {
                codeInput = CodeInput.Right;
            }
            else if (this.InputManager.Up == FezButtonState.Pressed)
            {
                codeInput = CodeInput.Up;
            }
            else if (this.InputManager.Down == FezButtonState.Pressed)
            {
                codeInput = CodeInput.Down;
            }
            if (codeInput == CodeInput.None)
            {
                return;
            }
            this.Input.Add(codeInput);
            if (this.Input.Count > 16)
            {
                this.Input.RemoveAt(0);
            }
            if (!this.isAchievementCode && !this.GameState.SaveData.AchievementCheatCodeDone && (!this.GameState.SaveData.FezHidden && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.AchievementCode)) && this.LevelManager.Name != "ELDERS")
            {
                this.Input.Clear();
                this.isAchievementCode = true;
                this.LevelService.ResolvePuzzleSoundOnly();
                Waiters.Wait((Func <bool>)(() =>
                {
                    if (this.CameraManager.ViewTransitionReached && this.PlayerManager.Grounded)
                    {
                        return(!this.PlayerManager.Background);
                    }
                    else
                    {
                        return(false);
                    }
                }), (Action)(() =>
                {
                    Vector3 local_0 = this.PlayerManager.Center + new Vector3(0.0f, 2f, 0.0f);
                    Trile local_1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube));
                    if (local_1 == null)
                    {
                        return;
                    }
                    Vector3 local_2 = local_0 - Vector3.One / 2f;
                    NearestTriles local_3 = this.LevelManager.NearestTrile(local_0);
                    TrileInstance local_4 = local_3.Surface ?? local_3.Deep;
                    if (local_4 != null)
                    {
                        local_2 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) * local_2 + local_4.Center * FezMath.DepthMask(this.CameraManager.Viewpoint) - FezMath.ForwardVector(this.CameraManager.Viewpoint) * 2f;
                    }
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, this.waitingForTrile = new TrileInstance(Vector3.Clamp(local_2, Vector3.Zero, this.LevelManager.Size - Vector3.One), local_1.Id)));
                    this.GomezService.CollectedAnti += new Action(this.GotTrile);
                }));
            }
            if (!this.isMapQr && !this.GameState.SaveData.MapCheatCodeDone && (this.GameState.SaveData.Maps.Contains("MAP_MYSTERY") && this.LevelManager.Name != "WATERTOWER_SECRET") && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.MapCode))
            {
                this.Input.Clear();
                this.GameState.SaveData.AnyCodeDeciphered = true;
                this.isMapQr = true;
                if (this.GameState.SaveData.World.ContainsKey("WATERTOWER_SECRET"))
                {
                    this.GameState.SaveData.World["WATERTOWER_SECRET"].FilledConditions.SecretCount = 1;
                }
                this.LevelService.ResolvePuzzleSoundOnly();
                Waiters.Wait((Func <bool>)(() =>
                {
                    if (this.CameraManager.ViewTransitionReached && this.PlayerManager.Grounded)
                    {
                        return(!this.PlayerManager.Background);
                    }
                    else
                    {
                        return(false);
                    }
                }), (Action)(() =>
                {
                    Vector3 local_0 = this.PlayerManager.Center + new Vector3(0.0f, 2f, 0.0f);
                    Trile local_1 = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube));
                    if (local_1 == null)
                    {
                        return;
                    }
                    Vector3 local_2 = local_0 - Vector3.One / 2f;
                    NearestTriles local_3 = this.LevelManager.NearestTrile(local_0);
                    TrileInstance local_4 = local_3.Surface ?? local_3.Deep;
                    if (local_4 != null)
                    {
                        local_2 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) * local_2 + local_4.Center * FezMath.DepthMask(this.CameraManager.Viewpoint) - FezMath.ForwardVector(this.CameraManager.Viewpoint) * 2f;
                    }
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, this.waitingForTrile = new TrileInstance(Vector3.Clamp(local_2, Vector3.Zero, this.LevelManager.Size - Vector3.One), local_1.Id)));
                    this.GomezService.CollectedAnti += new Action(this.GotTrile);
                }));
            }
            if (this.GameState.SaveData.HasNewGamePlus && PatternTester.Test((IList <CodeInput>) this.Input, GameWideCodes.JetpackCode))
            {
                this.Input.Clear();
                this.GameState.JetpackMode = true;
            }
            this.SinceInput = TimeSpan.Zero;
        }