예제 #1
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.FrontClimbingLadder:
     case ActionType.BackClimbingLadder:
     case ActionType.SideClimbingLadder:
     case ActionType.FrontClimbingVine:
     case ActionType.SideClimbingVine:
     case ActionType.BackClimbingVine:
     case ActionType.GrabCornerLedge:
     case ActionType.GrabLedgeFront:
     case ActionType.GrabLedgeBack:
     case ActionType.LowerToLedge:
     case ActionType.ToCornerFront:
     case ActionType.ToCornerBack:
     case ActionType.FromCornerBack:
         if ((this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f))
         {
             break;
         }
         this.PlayerManager.HeldInstance  = (TrileInstance)null;
         this.PlayerManager.Action        = ActionType.Dropping;
         this.PlayerManager.CanDoubleJump = false;
         break;
     }
 }
예제 #2
0
        public void Update(GameTime time)
        {
            MouseState state = Mouse.GetState();

            this.wheelTurns      = state.ScrollWheelValue - this.lastState.ScrollWheelValue;
            this.wheelTurnedUp   = FezButtonStateExtensions.NextState(this.wheelTurnedUp, this.wheelTurns > 0);
            this.wheelTurnedDown = FezButtonStateExtensions.NextState(this.wheelTurnedDown, this.wheelTurns < 0);
            if (this.renderPanelHandle != this.parentFormHandle)
            {
                state = Mouse.GetState();
            }
            this.movement = new Point(state.X - this.position.X, state.Y - this.position.Y);
            this.position = new Point(state.X, state.Y);
            if (state != this.lastState)
            {
                bool hasMoved = this.movement.X != 0 || this.movement.Y != 0;
                this.leftButton   = this.DeduceMouseButtonState(this.leftButton, this.lastState.LeftButton, state.LeftButton, hasMoved);
                this.middleButton = this.DeduceMouseButtonState(this.middleButton, this.lastState.MiddleButton, state.MiddleButton, hasMoved);
                this.rightButton  = this.DeduceMouseButtonState(this.rightButton, this.lastState.RightButton, state.RightButton, hasMoved);
                this.lastState    = state;
            }
            else
            {
                this.ResetButton(ref this.leftButton);
                this.ResetButton(ref this.middleButton);
                this.ResetButton(ref this.rightButton);
            }
        }
예제 #3
0
        public void Update(KeyboardState state, GameTime time)
        {
            KeyboardState state1 = Keyboard.GetState();

            this.activeKeys.Clear();
            lock (this)
                this.activeKeys.AddRange((IEnumerable <Keys>) this.registeredKeys);
            foreach (Keys key in this.activeKeys)
            {
                bool           pressed = state1.IsKeyDown(key);
                FezButtonState state2;
                if (this.keyStates.TryGetValue(key, out state2))
                {
                    if ((pressed || state2 != FezButtonState.Up) && FezButtonStateExtensions.NextState(state2, pressed) != state2)
                    {
                        this.keyStates.Remove(key);
                        this.keyStates.Add(key, FezButtonStateExtensions.NextState(state2, pressed));
                    }
                }
                else
                {
                    this.keyStates.Add(key, FezButtonStateExtensions.NextState(state2, pressed));
                }
            }
        }
예제 #4
0
 protected override void Begin()
 {
     this.PlayerManager.Position = this.PlayerManager.Position * Vector3.UnitY + (this.PlayerManager.HeldInstance.Position + FezMath.HalfVector) * FezMath.XZMask;
     if (FezButtonStateExtensions.IsDown(this.InputManager.Down))
     {
         this.PlayerManager.Position -= 1.0 / 500.0 * Vector3.UnitY;
     }
     this.GomezService.OnClimbLadder();
 }
예제 #5
0
 public void DetermineActiveController()
 {
     if (!this.gamepad)
     {
         return;
     }
     foreach (PlayerIndex index in ControllerIndexExtensions.GetPlayers(this.ActiveControllers))
     {
         GamepadState gamepadState = this.GamepadsManager[index];
         if (FezButtonStateExtensions.IsDown(gamepadState.Start) || FezButtonStateExtensions.IsDown(gamepadState.A.State) || (FezButtonStateExtensions.IsDown(gamepadState.Back) || FezButtonStateExtensions.IsDown(gamepadState.B.State)))
         {
             this.ActiveControllers = ControllerIndexExtensions.ToControllerIndex(index);
             return;
         }
     }
     this.ActiveControllers = ControllerIndex.None;
 }
예제 #6
0
        protected override bool Act(TimeSpan elapsed)
        {
            int frame = this.PlayerManager.Animation.Timing.Frame;

            this.sinceStarted += elapsed;
            if (this.sinceStarted.TotalSeconds < 0.25 && !FezButtonStateExtensions.IsDown(this.InputManager.GrabThrow))
            {
                this.eTurnAway.FadeOutAndDie(0.1f);
                this.reverse = true;
            }
            if (this.reverse)
            {
                this.PlayerManager.Animation.Timing.Update(elapsed, -1f);
                if ((double)this.PlayerManager.Animation.Timing.Step <= 0.0)
                {
                    this.PlayerManager.Action = ActionType.Idle;
                }
                return(false);
            }
            else
            {
                if (this.PlayerManager.Animation.Timing.Frame == 32 && (this.eTurnBack == null || this.eTurnBack.Dead))
                {
                    this.eTurnBack = SoundEffectExtensions.EmitAt(this.sTurnBack, this.PlayerManager.Position);
                }
                if (this.PlayerManager.Animation.Timing.Ended)
                {
                    this.PlayerManager.Action = ActionType.Idle;
                    return(false);
                }
                else
                {
                    if (frame != this.lastFrame && frame == 18)
                    {
                        SoundEffectExtensions.EmitAt(this.sFallOnFace, this.PlayerManager.Position);
                    }
                    this.lastFrame = frame;
                    return(true);
                }
            }
        }
예제 #7
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Jumping:
     case ActionType.Falling:
         if (!FezButtonStateExtensions.IsDown(this.InputManager.Up))
         {
             break;
         }
         FaceOrientation face           = FezMath.VisibleOrientation(this.CameraManager.Viewpoint);
         TrileInstance   trileInstance1 = this.PlayerManager.AxisCollision[VerticalDirection.Up].Deep;
         TrileInstance   trileInstance2 = this.PlayerManager.AxisCollision[VerticalDirection.Down].Deep;
         if (trileInstance1 != null && trileInstance1.GetRotatedFace(face) == CollisionType.AllSides || (trileInstance2 == null || trileInstance2.GetRotatedFace(face) != CollisionType.TopOnly) || BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance2.Center, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)))
         {
             break;
         }
         TrileInstance trileInstance3 = this.PlayerManager.AxisCollision[VerticalDirection.Down].Surface;
         if (trileInstance3 != null && ActorTypeExtensions.IsClimbable(trileInstance3.Trile.ActorSettings.Type) || !trileInstance2.Enabled || this.PlayerManager.Action == ActionType.Jumping && (double)((trileInstance2.Center - this.PlayerManager.LeaveGroundPosition) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint)).Length() < 1.25)
         {
             break;
         }
         this.PlayerManager.Action = ActionType.GrabLedgeBack;
         Vector3 vector3_1 = FezMath.DepthMask(this.CameraManager.Viewpoint);
         Vector3 vector3_2 = FezMath.SideMask(this.CameraManager.Viewpoint);
         Vector3 vector3_3 = FezMath.ForwardVector(this.CameraManager.Viewpoint);
         this.PlayerManager.HeldInstance = trileInstance2;
         IPlayerManager playerManager = this.PlayerManager;
         Vector3        vector3_4     = playerManager.Velocity * vector3_2 * 0.5f;
         playerManager.Velocity      = vector3_4;
         this.PlayerManager.Position = this.PlayerManager.Position * vector3_2 + trileInstance2.Center * (Vector3.UnitY + vector3_1) + vector3_3 * -(this.PlayerManager.HeldInstance.TransformedSize / 2f + this.PlayerManager.Size.X * vector3_1 / 4f) + this.PlayerManager.HeldInstance.Trile.Size.Y / 2f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
         Waiters.Wait(0.1, (Action)(() =>
         {
             SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
             this.PlayerManager.Velocity = Vector3.Zero;
         }));
         break;
     }
 }
예제 #8
0
파일: Jump.cs 프로젝트: conankzhang/fez
 protected override void TestConditions()
 {
     if (!FezMath.In <ActionType>(this.PlayerManager.Action, ActionType.Sliding, ActionType.GrabCornerLedge, ActionType.Running, ActionType.RunTurnAround, ActionType.Walking, ActionType.Landing, ActionType.WalkingTo, ActionType.GrabTombstone, (IEqualityComparer <ActionType>)ActionTypeComparer.Default) && !this.PlayerManager.Climbing && (!this.PlayerManager.Swimming && !ActionTypeExtensions.IsIdle(this.PlayerManager.Action)) && (this.PlayerManager.Action != ActionType.Falling || !this.PlayerManager.CanDoubleJump) && (this.PlayerManager.Action != ActionType.Grabbing && this.PlayerManager.Action != ActionType.Pushing && !ActionTypeExtensions.IsLookingAround(this.PlayerManager.Action)) || this.InputManager.Jump != FezButtonState.Pressed && (!this.PlayerManager.Grounded && !ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || (double)this.PlayerManager.Velocity.Y * (double)Math.Sign(this.CollisionManager.GravityFactor) <= 0.1))
     {
         return;
     }
     this.PlayerManager.PushedInstance = (TrileInstance)null;
     if (this.PlayerManager.CanDoubleJump)
     {
         this.PlayerManager.CanDoubleJump = false;
     }
     if (FezButtonStateExtensions.IsDown(this.InputManager.Down) && (this.PlayerManager.Grounded && this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) == CollisionType.TopOnly || this.PlayerManager.Climbing))
     {
         return;
     }
     if (this.PlayerManager.Action == ActionType.GrabCornerLedge)
     {
         HorizontalDirection horizontalDirection = FezMath.DirectionFromMovement(this.InputManager.Movement.X);
         if (horizontalDirection == HorizontalDirection.None || horizontalDirection == this.PlayerManager.LookingDirection)
         {
             return;
         }
         Vector3 position = this.PlayerManager.Position;
         this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)-FezMath.Sign(this.PlayerManager.LookingDirection);
         this.PhysicsManager.DetermineInBackground((IPhysicsEntity)this.PlayerManager, true, false, false);
         this.PlayerManager.Position = position;
     }
     if (this.InputManager.Jump == FezButtonState.Pressed)
     {
         this.sinceJumped  = TimeSpan.Zero;
         this.scheduleJump = true;
     }
     else
     {
         this.DoJump();
     }
     this.PlayerManager.Action = ActionType.Jumping;
 }
예제 #9
0
        protected override void TestConditions()
        {
            switch (this.PlayerManager.Action)
            {
            case ActionType.GrabLedgeFront:
            case ActionType.GrabLedgeBack:
                if ((this.InputManager.Jump != FezButtonState.Pressed || FezButtonStateExtensions.IsDown(this.InputManager.Down)) && this.InputManager.Up != FezButtonState.Pressed && (this.InputManager.Up != FezButtonState.Down || !this.PlayerManager.Animation.Timing.Ended) || this.LevelManager.NearestTrile(this.PlayerManager.HeldInstance.Center).Deep == null)
                {
                    break;
                }
                this.PlayerManager.Action = ActionTypeExtensions.FacesBack(this.PlayerManager.Action) ? ActionType.PullUpBack : ActionType.PullUpFront;
                break;

            case ActionType.ShimmyFront:
            case ActionType.ShimmyBack:
                if ((this.InputManager.Jump != FezButtonState.Pressed || FezButtonStateExtensions.IsDown(this.InputManager.Down)) && this.InputManager.Up != FezButtonState.Pressed || this.LevelManager.NearestTrile(this.PlayerManager.HeldInstance.Center).Deep == null)
                {
                    break;
                }
                this.PlayerManager.Action = ActionTypeExtensions.FacesBack(this.PlayerManager.Action) ? ActionType.PullUpBack : ActionType.PullUpFront;
                break;
            }
        }
예제 #10
0
 protected override void TestConditions()
 {
     if (this.PlayerManager.Action != ActionType.GrabCornerLedge || (this.InputManager.Jump != FezButtonState.Pressed || (double)this.InputManager.Movement.X == (double)-FezMath.Sign(this.PlayerManager.LookingDirection) || FezButtonStateExtensions.IsDown(this.InputManager.Down)) && this.InputManager.Up != FezButtonState.Pressed && (this.InputManager.Up != FezButtonState.Down || !this.PlayerManager.Animation.Timing.Ended || this.PlayerManager.LastAction == ActionType.SideClimbingVine) || this.LevelManager.NearestTrile(this.PlayerManager.HeldInstance.Center).Deep == null)
     {
         return;
     }
     this.PlayerManager.Action = ActionType.PullUpCornerLedge;
 }
예제 #11
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (this.PlayerManager.Action == ActionType.GrabTombstone && this.PlayerManager.Animation.Timing.Ended && !FezButtonStateExtensions.IsDown(this.InputManager.GrabThrow))
     {
         this.PlayerManager.Action = ActionType.LetGoOfTombstone;
         this.PlayerManager.Animation.Timing.Restart();
         SoundEffectExtensions.EmitAt(this.sTurnBack, this.PlayerManager.Position);
     }
     if (this.PlayerManager.Action == ActionType.LetGoOfTombstone && this.PlayerManager.Animation.Timing.Ended)
     {
         this.PlayerManager.Action = ActionType.Idle;
     }
     this.PlayerManager.Background = false;
     return(true);
 }
예제 #12
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Idle:
     case ActionType.LookingLeft:
     case ActionType.LookingRight:
     case ActionType.LookingUp:
     case ActionType.LookingDown:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (this.PlayerManager.Background || (this.InputManager.Jump != FezButtonState.Pressed || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || this.InputManager.Down != FezButtonState.Pressed) || !this.PlayerManager.Grounded || (this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) != CollisionType.TopOnly || !FezMath.AlmostEqual(this.InputManager.Movement.X, 0.0f)))
         {
             break;
         }
         TrileInstance trileInstance1 = this.PlayerManager.Ground.NearLow ?? this.PlayerManager.Ground.FarHigh;
         if (BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center + trileInstance1.TransformedSize * Vector3.UnitY * 0.498f, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)))
         {
             this.PlayerManager.Position -= Vector3.UnitY * 0.01f * (float)Math.Sign(this.CollisionManager.GravityFactor);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3       = playerManager.Velocity - 0.0075f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
             playerManager.Velocity = vector3;
             break;
         }
         else
         {
             if (this.PlayerManager.Grounded)
             {
                 TrileInstance trileInstance2 = this.LevelManager.NearestTrile(this.PlayerManager.Ground.First.Center, QueryOptions.None).Surface;
                 if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder)
                 {
                     break;
                 }
             }
             this.PlayerManager.HeldInstance = this.PlayerManager.Ground.NearLow;
             Vector3        vector3_1     = FezMath.SideMask(this.CameraManager.Viewpoint);
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3_2     = playerManager.Velocity * vector3_1 * 0.5f;
             playerManager.Velocity    = vector3_2;
             this.PlayerManager.Action = ActionType.LowerToLedge;
             Waiters.Wait(0.3, (Action)(() =>
             {
                 if (this.PlayerManager.Action != ActionType.LowerToLedge)
                 {
                     return;
                 }
                 SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
                 this.PlayerManager.Velocity = Vector3.Zero;
             }));
             this.camOrigin = this.CameraManager.Center;
             break;
         }
     }
 }
예제 #13
0
        public override void Update(GameTime gameTime)
        {
            if (this.KeyboardState.GetKeyState(Keys.F1) == FezButtonState.Pressed)
            {
                this.GameState.DebugMode = true;
            }
            if (this.KeyboardState.GetKeyState(Keys.F2) == FezButtonState.Pressed)
            {
                this.GameState.DebugMode = false;
            }
            if (this.KeyboardState.GetKeyState(Keys.F3) == FezButtonState.Pressed)
            {
                this.SM.GlobalVolumeFactor = 0.0f;
            }
            if (this.KeyboardState.GetKeyState(Keys.F4) == FezButtonState.Pressed)
            {
                this.SM.GlobalVolumeFactor = 1f;
            }
            if (this.KeyboardState.GetKeyState(Keys.F5) == FezButtonState.Pressed)
            {
                this.GameState.ShowDebuggingBag = true;
            }
            if (this.KeyboardState.GetKeyState(Keys.F6) == FezButtonState.Pressed)
            {
                this.GameState.ShowDebuggingBag = false;
            }
            if (this.KeyboardState.GetKeyState(Keys.F9) == FezButtonState.Pressed)
            {
                this.TimeService.SetHour(4, true);
            }
            if (this.KeyboardState.GetKeyState(Keys.F10) == FezButtonState.Pressed)
            {
                this.TimeService.SetHour(12, true);
            }
            if (this.KeyboardState.GetKeyState(Keys.F11) == FezButtonState.Pressed)
            {
                this.TimeService.SetHour(20, true);
            }
            if (this.KeyboardState.GetKeyState(Keys.F12) == FezButtonState.Pressed)
            {
                this.TimeService.SetHour(0, true);
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad0) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D0) == FezButtonState.Pressed)
            {
                this.CameraManager.PixelsPerTrixel = 1f;
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad1) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D1) == FezButtonState.Pressed)
            {
                this.CameraManager.PixelsPerTrixel = 2f;
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad2) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D2) == FezButtonState.Pressed)
            {
                this.CameraManager.PixelsPerTrixel = 3f;
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad3) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D3) == FezButtonState.Pressed)
            {
                this.CameraManager.PixelsPerTrixel = 4f;
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad5) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D5) == FezButtonState.Pressed)
            {
                ++this.GameState.SaveData.CubeShards;
                this.GameState.SaveData.ScoreDirty = true;
                this.GameState.OnHudElementChanged();
            }
            if ((this.KeyboardState.GetKeyState(Keys.NumPad6) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D6) == FezButtonState.Pressed) && this.GameState.SaveData.CubeShards > 0)
            {
                --this.GameState.SaveData.CubeShards;
                this.GameState.SaveData.ScoreDirty = true;
                this.GameState.OnHudElementChanged();
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad7) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D7) == FezButtonState.Pressed)
            {
                ++this.GameState.SaveData.Keys;
                this.GameState.OnHudElementChanged();
            }
            if ((this.KeyboardState.GetKeyState(Keys.NumPad8) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D8) == FezButtonState.Pressed) && this.GameState.SaveData.Keys > 0)
            {
                --this.GameState.SaveData.Keys;
                this.GameState.OnHudElementChanged();
            }
            if (this.KeyboardState.GetKeyState(Keys.NumPad9) == FezButtonState.Pressed || this.KeyboardState.GetKeyState(Keys.D9) == FezButtonState.Pressed)
            {
                ++this.GameState.SaveData.SecretCubes;
                this.GameState.SaveData.ScoreDirty = true;
                this.GameState.OnHudElementChanged();
            }
            if (this.KeyboardState.GetKeyState(Keys.L) == FezButtonState.Pressed)
            {
                this.GameState.SaveData.HasDoneHeartReboot = true;
            }
            if (FezButtonStateExtensions.IsDown(this.KeyboardState.GetKeyState(Keys.LeftControl)) && this.KeyboardState.GetKeyState(Keys.S) == FezButtonState.Pressed)
            {
                this.GameState.SaveData.IsNew = false;
                this.GameState.Save();
            }
            if (this.KeyboardState.GetKeyState(Keys.H) == FezButtonState.Pressed)
            {
                this.BlackHoles.EnableAll();
            }
            if (this.KeyboardState.GetKeyState(Keys.J) == FezButtonState.Pressed)
            {
                this.BlackHoles.DisableAll();
            }
            if (this.KeyboardState.GetKeyState(Keys.K) == FezButtonState.Pressed)
            {
                this.BlackHoles.Randomize();
            }
            if (!Fez.LongScreenshot)
            {
                return;
            }
            if (this.KeyboardState.GetKeyState(Keys.R) == FezButtonState.Pressed)
            {
                this.SM.PlayNewSong((string)null);
                this.GameState.HideHUD    = true;
                this.PlayerManager.Action = ActionType.StandWinking;
                this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, Fez.DoubleRotations ? 2 : 1));
            }
            if (this.KeyboardState.GetKeyState(Keys.T) != FezButtonState.Pressed)
            {
                return;
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DebugControls.\u003C\u003Ec__DisplayClass5 cDisplayClass5_1 = new DebugControls.\u003C\u003Ec__DisplayClass5();
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.\u003C\u003E4__this = this;
            this.SM.KillSounds(0.1f);
            this.SM.PlayNewSong((string)null, 0.1f);
            foreach (AmbienceTrack ambienceTrack in (IEnumerable <AmbienceTrack>) this.LevelManager.AmbienceTracks)
            {
                this.SM.MuteAmbience(ambienceTrack.Name, 0.1f);
            }
            if (this.pl != null)
            {
                ServiceHelper.RemoveComponent <PolytronLogo>(this.pl);
            }
            DebugControls debugControls = this;
            PolytronLogo  polytronLogo1 = new PolytronLogo(this.Game);

            polytronLogo1.DrawOrder = 10000;
            polytronLogo1.Opacity   = 1f;
            PolytronLogo polytronLogo2 = polytronLogo1;

            debugControls.pl = polytronLogo2;
            ServiceHelper.AddComponent((IGameComponent)this.pl);
            // ISSUE: variable of a compiler-generated type
            DebugControls.\u003C\u003Ec__DisplayClass5 cDisplayClass5_2 = cDisplayClass5_1;
            LogoRenderer logoRenderer1 = new LogoRenderer(this.Game);

            logoRenderer1.DrawOrder = 9999;
            logoRenderer1.Visible   = false;
            logoRenderer1.Enabled   = false;
            LogoRenderer logoRenderer2 = logoRenderer1;

            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_2.tl = logoRenderer2;
            // ISSUE: reference to a compiler-generated field
            ServiceHelper.AddComponent((IGameComponent)cDisplayClass5_1.tl);
            // ISSUE: reference to a compiler-generated field
            ServiceHelper.AddComponent((IGameComponent)(cDisplayClass5_1.FezLogo = new FezLogo(this.Game)));
            SoundEffect soundEffect = this.CMProvider.Global.Load <SoundEffect>("Sounds/Intro/LogoZoom");

            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.Visible = true;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.Enabled = true;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.TransitionStarted = true;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.Opacity = 1f;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.Inverted = true;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.SinceStarted = 4.5f;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.HalfSpeed = true;
            // ISSUE: reference to a compiler-generated field
            cDisplayClass5_1.FezLogo.Update(new GameTime());
            SoundEffectExtensions.Emit(soundEffect);
            SoundManager.NoMoreSounds    = true;
            this.GameState.SkipRendering = true;
            // ISSUE: reference to a compiler-generated method
            Waiters.Wait(7.0, new Action(cDisplayClass5_1.\u003CUpdate\u003Eb__2));
        }
예제 #14
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.CarryIdle:
     case ActionType.CarryWalk:
     case ActionType.CarryJump:
     case ActionType.CarrySlide:
     case ActionType.CarryHeavyIdle:
     case ActionType.CarryHeavyWalk:
     case ActionType.CarryHeavyJump:
     case ActionType.CarryHeavySlide:
         if (this.PlayerManager.CarriedInstance == null)
         {
             break;
         }
         bool isLight = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type);
         bool flag1   = this.PlayerManager.Action == ActionType.CarryHeavyJump || this.PlayerManager.Action == ActionType.CarryJump;
         bool flag2   = flag1 && !this.PlayerManager.Animation.Timing.Ended;
         if (this.PlayerManager.Grounded && this.InputManager.Jump == FezButtonState.Pressed && FezButtonStateExtensions.IsDown(this.InputManager.Down) && this.PlayerManager.Ground.First.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.TopOnly)
         {
             this.PlayerManager.Position -= Vector3.UnitY * this.CollisionManager.DistanceEpsilon * 2f;
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3       = playerManager.Velocity - 0.0075f * Vector3.UnitY;
             playerManager.Velocity           = vector3;
             this.PlayerManager.Action        = isLight ? ActionType.CarryJump : ActionType.CarryHeavyJump;
             this.PlayerManager.CanDoubleJump = false;
             break;
         }
         else if ((this.PlayerManager.Grounded || this.PlayerManager.CanDoubleJump) && (!flag1 || this.PlayerManager.Animation.Timing.Frame != 0) && this.InputManager.Jump == FezButtonState.Pressed)
         {
             this.jumpIsFall = false;
             this.Jump(isLight);
             break;
         }
         else if (this.PlayerManager.Grounded && (double)this.InputManager.Movement.X != 0.0 && !flag2)
         {
             this.PlayerManager.Action = isLight ? ActionType.CarryWalk : ActionType.CarryHeavyWalk;
             break;
         }
         else
         {
             if (this.PlayerManager.Action != ActionType.CarryHeavyJump && this.PlayerManager.Action != ActionType.CarryJump && !this.PlayerManager.Grounded)
             {
                 this.jumpIsFall           = true;
                 this.PlayerManager.Action = isLight ? ActionType.CarryJump : ActionType.CarryHeavyJump;
             }
             if (this.wasNotGrounded && this.PlayerManager.Grounded)
             {
                 SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position);
             }
             this.wasNotGrounded = !this.PlayerManager.Grounded;
             if (this.PlayerManager.Action != ActionType.CarryIdle && this.PlayerManager.Action != ActionType.CarryHeavyIdle && (this.PlayerManager.Grounded && FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero)) && !flag2)
             {
                 this.PlayerManager.Action = isLight ? ActionType.CarryIdle : ActionType.CarryHeavyIdle;
                 break;
             }
             else
             {
                 if (this.PlayerManager.Action == ActionType.CarrySlide || !this.PlayerManager.Grounded || (FezMath.AlmostEqual(FezMath.XZ(this.PlayerManager.Velocity), Vector2.Zero) || !FezMath.AlmostEqual(this.InputManager.Movement, Vector2.Zero)) || flag2)
                 {
                     break;
                 }
                 this.PlayerManager.Action = isLight ? ActionType.CarrySlide : ActionType.CarryHeavySlide;
                 this.PlayerManager.Animation.Timing.Paused = false;
                 break;
             }
         }
     }
 }
예제 #15
0
        protected override bool Act(TimeSpan elapsed)
        {
            ClimbingApproach approach;
            TrileInstance    trileInstance1 = this.IsOnLadder(out approach);

            this.PlayerManager.HeldInstance = trileInstance1;
            if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None)
            {
                this.PlayerManager.Action = ActionType.Idle;
                return(false);
            }
            else
            {
                this.lastGrabbed     = trileInstance1;
                this.sinceGrabbed    = TimeSpan.Zero;
                this.currentApproach = approach;
                this.RefreshPlayerAction();
                this.RefreshPlayerDirection();
                this.PlayerManager.Position = this.PlayerManager.Position * Vector3.UnitY + (trileInstance1.Position + FezMath.HalfVector) * FezMath.XZMask;
                Vector3 vector3_1 = (float)((double)this.InputManager.Movement.Y * 4.69999980926514 * 0.425000011920929) * (float)elapsed.TotalSeconds * Vector3.UnitY;
                Vector3 b         = FezMath.ForwardVector(this.CameraManager.Viewpoint) * (this.PlayerManager.Background ? -1f : 1f);
                if ((double)this.PlayerManager.Center.Y < (double)this.LevelManager.Size.Y - 1.0 && (double)this.PlayerManager.Center.Y > 1.0)
                {
                    QueryOptions  options        = this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None;
                    NearestTriles nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + Vector3.Down, options);
                    NearestTriles nearestTriles2 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector3_1, options);
                    NearestTriles nearestTriles3 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector3_1 + FezMath.Sign(vector3_1) * new Vector3(0.0f, 0.5f, 0.0f), options);
                    bool          flag           = false;
                    if ((nearestTriles2.Surface == null || (flag = nearestTriles3.Deep != null && (double)FezMath.Dot(this.PlayerManager.Position, b) > (double)FezMath.Dot(nearestTriles3.Deep.Center, b))) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(this.PlayerManager.Background ? this.CameraManager.VisibleOrientation : FezMath.GetOpposite(this.CameraManager.VisibleOrientation)) == CollisionType.None))
                    {
                        vector3_1 = Vector3.Zero;
                        if (!flag && (this.PlayerManager.LookingDirection == HorizontalDirection.Left && FezButtonStateExtensions.IsDown(this.InputManager.Left) || this.PlayerManager.LookingDirection == HorizontalDirection.Right && FezButtonStateExtensions.IsDown(this.InputManager.Right)))
                        {
                            if (nearestTriles2.Deep == null || nearestTriles1.Surface == null)
                            {
                                this.PlayerManager.Action = ActionType.ClimbOverLadder;
                                return(false);
                            }
                            else if ((double)FezMath.Dot(nearestTriles2.Deep.Center, b) > (double)FezMath.Dot(nearestTriles1.Surface.Center, b))
                            {
                                this.PlayerManager.Action = ActionType.ClimbOverLadder;
                                return(false);
                            }
                        }
                    }
                }
                float num1  = (float)((double)FezMath.Saturate(Math.Abs((float)((double)this.PlayerManager.Animation.Timing.NormalizedStep * 2.0 % 1.0 - 0.5))) * 1.39999997615814 + 0.25);
                int   frame = this.PlayerManager.Animation.Timing.Frame;
                if (this.lastFrame != frame)
                {
                    if (frame == 1 || frame == 4)
                    {
                        SoundEffectExtensions.EmitAt(this.climbSound, this.PlayerManager.Position);
                    }
                    this.lastFrame = frame;
                }
                this.PlayerManager.Velocity = vector3_1 * num1;
                if (trileInstance1.PhysicsState != null)
                {
                    IPlayerManager playerManager = this.PlayerManager;
                    Vector3        vector3_2     = playerManager.Velocity + trileInstance1.PhysicsState.Velocity;
                    playerManager.Velocity = vector3_2;
                }
                int num2 = Math.Sign(vector3_1.Y);
                this.PlayerManager.Animation.Timing.Update(elapsed, (float)num2);
                this.PlayerManager.GroundedVelocity = new Vector3?(this.PlayerManager.Velocity);
                MultipleHits <CollisionResult> multipleHits = this.CollisionManager.CollideEdge(this.PlayerManager.Center, vector3_1, this.PlayerManager.Size / 2f, Direction2D.Vertical);
                if ((double)vector3_1.Y < 0.0 && (multipleHits.NearLow.Collided || multipleHits.FarHigh.Collided))
                {
                    TrileInstance trileInstance2 = this.LevelManager.NearestTrile(multipleHits.First.Destination.Center).Surface;
                    if (trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder && this.currentApproach == ClimbingApproach.Back)
                    {
                        IPlayerManager playerManager = this.PlayerManager;
                        Vector3        vector3_2     = playerManager.Center + vector3_1;
                        playerManager.Center = vector3_2;
                    }
                    else
                    {
                        this.lastGrabbed = (TrileInstance)null;
                        this.PlayerManager.HeldInstance = (TrileInstance)null;
                        this.PlayerManager.Action       = ActionType.Falling;
                    }
                }
                return(false);
            }
        }
예제 #16
0
            public bool Update(TimeSpan elapsed)
            {
                this.SinceChanged += elapsed;
                switch (this.State)
                {
                case SpinAction.Idle:
                    bool flag;
                    if (this.HandleAo.ArtObject.ActorType == ActorType.Bookcase)
                    {
                        Vector3 vector3 = this.PlayerManager.Position - this.HandleAo.Position;
                        flag = (double)vector3.Z <2.75 && (double)vector3.Z> -0.25 && ((double)vector3.Y <-3.0 && (double)vector3.Y> -4.0) && this.CameraManager.Viewpoint == Viewpoint.Left;
                    }
                    else
                    {
                        Vector3 vector = (this.PlayerManager.Position - this.HandleAo.Position - new Vector3(0.0f, 1.5f, 0.0f)) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
                        vector.X += vector.Z;
                        Vector3 vector3 = FezMath.Abs(vector);
                        flag = (double)vector3.X > 0.75 && (double)vector3.X < 1.75 && (double)vector3.Y < 1.0;
                    }
                    if (this.HandleAo.Enabled && flag && (this.PlayerManager.Grounded && this.PlayerManager.Action != ActionType.PushingPivot) && (FezButtonStateExtensions.IsDown(this.InputManager.GrabThrow) && this.PlayerManager.Action != ActionType.ReadingSign && (this.PlayerManager.Action != ActionType.FreeFalling && this.PlayerManager.Action != ActionType.Dying)))
                    {
                        this.SinceChanged = TimeSpan.Zero;
                        return(true);
                    }
                    else
                    {
                        break;
                    }

                case SpinAction.Spinning:
                    double     num           = FezMath.Saturate(this.SinceChanged.TotalSeconds / 1.5);
                    float      angle         = Easing.EaseIn(num < 0.799999997019768 ? num / 0.799999997019768 : 1.0 + Math.Sin((num - 0.799999997019768) / 0.200000002980232 * 6.28318548202515 * 2.0) * 0.00999999977648258 * (1.0 - num) / 0.200000002980232, EasingType.Quartic) * 1.570796f * (float)this.SpinSign;
                    Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.UnitY, angle);
                    Vector3    position      = this.HandleAo.Position;
                    for (int index = 0; index < this.OriginalStates.Length; ++index)
                    {
                        TrileInstance instance = index < this.Group.Triles.Count ? this.Group.Triles[index] : this.AttachedTriles[index - this.Group.Triles.Count];
                        Vector4       vector   = this.OriginalStates[index];
                        instance.Position = Vector3.Transform(FezMath.XYZ(vector) + new Vector3(0.5f) - position, fromAxisAngle) + position - new Vector3(0.5f);
                        instance.Phi      = FezMath.WrapAngle(vector.W + angle);
                        this.LevelMaterializer.GetTrileMaterializer(instance.Trile).UpdateInstance(instance);
                    }
                    if (!this.HasShaken && num > 0.799999997019768)
                    {
                        ServiceHelper.AddComponent((IGameComponent) new CamShake(ServiceHelper.Game)
                        {
                            Distance = 0.25f,
                            Duration = TimeSpan.FromSeconds(0.200000002980232)
                        });
                        this.HasShaken = true;
                    }
                    this.HandleAo.Rotation = this.OriginalAoRotation * fromAxisAngle;
                    for (int index = 0; index < this.AttachedArtObjects.Length; ++index)
                    {
                        this.AttachedArtObjects[index].Rotation = this.AttachedAoRotations[index] * fromAxisAngle;
                        this.AttachedArtObjects[index].Position = Vector3.Transform(this.AttachedAoOrigins[index] - position, fromAxisAngle) + position;
                    }
                    if (this.SinceChanged.TotalSeconds >= 1.5)
                    {
                        this.RotateTriles();
                        this.SinceChanged -= TimeSpan.FromSeconds(1.5);
                        this.State         = SpinAction.Idle;
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
                return(false);
            }
예제 #17
0
        protected override void TestConditions()
        {
            switch (this.PlayerManager.Action)
            {
            case ActionType.Teetering:
            case ActionType.IdlePlay:
            case ActionType.IdleSleep:
            case ActionType.IdleLookAround:
            case ActionType.IdleYawn:
            case ActionType.Idle:
            case ActionType.LookingLeft:
            case ActionType.LookingRight:
            case ActionType.LookingUp:
            case ActionType.LookingDown:
            case ActionType.Walking:
            case ActionType.Running:
            case ActionType.Jumping:
            case ActionType.Lifting:
            case ActionType.Falling:
            case ActionType.Bouncing:
            case ActionType.Flying:
            case ActionType.Dropping:
            case ActionType.Sliding:
            case ActionType.Landing:
                TrileInstance trileInstance1 = this.IsOnLadder(out this.currentApproach);
                if (this.currentApproach == ClimbingApproach.None)
                {
                    break;
                }
                bool flag = false;
                if (FezButtonStateExtensions.IsDown(this.InputManager.Down) && this.PlayerManager.Grounded)
                {
                    TrileInstance trileInstance2 = this.LevelManager.NearestTrile(trileInstance1.Center - Vector3.UnitY).Surface;
                    flag = trileInstance2 != null && trileInstance2.Trile.ActorSettings.Type == ActorType.Ladder;
                }
                FezButtonState fezButtonState = this.PlayerManager.Grounded ? FezButtonState.Pressed : FezButtonState.Down;
                if (!flag && this.InputManager.Up != fezButtonState && (this.PlayerManager.Grounded || this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right || Math.Sign(this.InputManager.Movement.X) != FezMath.Sign(ClimbingApproachExtensions.AsDirection(this.currentApproach))) || this.lastGrabbed != null && (trileInstance1 == this.lastGrabbed || trileInstance1.Position == this.lastGrabbed.Position + Vector3.UnitY || trileInstance1.Position == this.lastGrabbed.Position - Vector3.UnitY))
                {
                    break;
                }
                this.PlayerManager.HeldInstance = trileInstance1;
                switch (this.currentApproach)
                {
                case ClimbingApproach.Right:
                case ClimbingApproach.Left:
                    this.PlayerManager.NextAction = ActionType.SideClimbingLadder;
                    break;

                case ClimbingApproach.Back:
                    this.PlayerManager.NextAction = ActionType.BackClimbingLadder;
                    break;

                case ClimbingApproach.Front:
                    this.PlayerManager.NextAction = ActionType.FrontClimbingLadder;
                    break;
                }
                if (this.PlayerManager.Grounded)
                {
                    ActionType actionType = this.currentApproach == ClimbingApproach.Back ? ActionType.IdleToClimb : (this.currentApproach == ClimbingApproach.Front ? ActionType.IdleToFrontClimb : (this.currentApproach == ClimbingApproach.Back ? ActionType.IdleToClimb : ActionType.IdleToSideClimb));
                    if (this.CollisionManager.CollidePoint(this.GetDestination(), Vector3.Down, QueryOptions.None, 0.0f, this.CameraManager.Viewpoint).Collided)
                    {
                        this.WalkTo.Destination   = new Func <Vector3>(this.GetDestination);
                        this.WalkTo.NextAction    = actionType;
                        this.PlayerManager.Action = ActionType.WalkingTo;
                    }
                    else
                    {
                        this.PlayerManager.Action    = actionType;
                        this.PlayerManager.Position -= 0.15f * Vector3.UnitY;
                    }
                }
                else
                {
                    this.PlayerManager.Action = this.currentApproach == ClimbingApproach.Back ? ActionType.JumpToClimb : ActionType.JumpToSideClimb;
                }
                if (this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right)
                {
                    break;
                }
                this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach);
                break;
            }
        }
예제 #18
0
        protected override void TestConditions()
        {
            if (this.PlayerManager.Action == ActionType.WalkingTo || this.IsActionAllowed(this.PlayerManager.Action))
            {
                return;
            }
            if (this.PlayerManager.Grounded && (this.PlayerManager.PipeVolume.HasValue && this.InputManager.Down == FezButtonState.Pressed))
            {
                this.PipeVolume           = this.LevelManager.Volumes[this.PlayerManager.PipeVolume.Value];
                this.PlayerManager.Action = ActionType.EnteringPipe;
                this.Descending           = true;
            }
            if (this.PlayerManager.Grounded || (!this.PlayerManager.PipeVolume.HasValue || !FezButtonStateExtensions.IsDown(this.InputManager.Up) || !BoxCollisionResultExtensions.AnyCollided(this.PlayerManager.Ceiling)))
            {
                return;
            }
            this.PipeVolume           = this.LevelManager.Volumes[this.PlayerManager.PipeVolume.Value];
            this.PlayerManager.Action = ActionType.EnteringPipe;
            this.Descending           = false;
            Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
            Vector3 vector3_2 = (this.PipeVolume.From + this.PipeVolume.To) / 2f;

            this.PlayerManager.Position = this.PlayerManager.Position * vector3_1 + vector3_2 * (Vector3.One - vector3_1);
        }
예제 #19
0
        protected override bool Act(TimeSpan elapsed)
        {
            ClimbingApproach approach;
            TrileInstance    trileInstance1 = this.IsOnVine(out approach);

            this.PlayerManager.HeldInstance = trileInstance1;
            if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None)
            {
                this.PlayerManager.Action = ActionType.Idle;
                return(false);
            }
            else
            {
                this.lastGrabbed  = trileInstance1;
                this.sinceGrabbed = TimeSpan.Zero;
                if ((this.currentApproach == ClimbingApproach.Back || this.currentApproach == ClimbingApproach.Front) && (approach == ClimbingApproach.Right || approach == ClimbingApproach.Left))
                {
                    this.currentApproach = approach;
                }
                if (this.PlayerManager.Action == ActionType.SideClimbingVine && (double)Math.Abs(this.InputManager.Movement.X) > 0.5)
                {
                    Vector3       vector3       = (float)Math.Sign(this.InputManager.Movement.X) * FezMath.RightVector(this.CameraManager.Viewpoint);
                    NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position + vector3);
                    if (nearestTriles.Surface != null && nearestTriles.Surface.Trile.ActorSettings.Type == ActorType.Vine)
                    {
                        this.PlayerManager.Position += vector3 * 0.1f;
                        this.PlayerManager.ForceOverlapsDetermination();
                        trileInstance1 = this.IsOnVine(out this.currentApproach);
                        this.PlayerManager.HeldInstance = trileInstance1;
                    }
                }
                if (trileInstance1 == null || this.currentApproach == ClimbingApproach.None)
                {
                    this.PlayerManager.Action = ActionType.Idle;
                    return(false);
                }
                else
                {
                    this.RefreshPlayerAction(false);
                    this.RefreshPlayerDirection(false);
                    Vector3 vector3_1 = trileInstance1.Position + FezMath.HalfVector;
                    Vector3 vector3_2 = Vector3.Zero;
                    switch (this.currentApproach)
                    {
                    case ClimbingApproach.Right:
                    case ClimbingApproach.Left:
                        TrileInstance trileInstance2 = this.LevelManager.ActualInstanceAt(this.PlayerManager.Position);
                        vector3_2 = trileInstance2 == null || trileInstance2.Trile.ActorSettings.Type != ActorType.Vine ? FezMath.XZMask : FezMath.SideMask(this.CameraManager.Viewpoint);
                        break;

                    case ClimbingApproach.Back:
                    case ClimbingApproach.Front:
                        vector3_2 = FezMath.DepthMask(this.CameraManager.Viewpoint);
                        break;
                    }
                    this.PlayerManager.Position = this.PlayerManager.Position * (Vector3.One - vector3_2) + vector3_1 * vector3_2;
                    Vector2 vector2 = this.InputManager.Movement * 4.7f * 0.475f * (float)elapsed.TotalSeconds;
                    Vector3 vector  = Vector3.Zero;
                    if (this.PlayerManager.Action != ActionType.SideClimbingVine)
                    {
                        vector = Vector3.Transform(Vector3.UnitX * vector2.X * 0.75f, this.CameraManager.Rotation);
                    }
                    Vector3         impulse        = vector2.Y * Vector3.UnitY;
                    QueryOptions    options        = this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None;
                    FaceOrientation face           = this.PlayerManager.Background ? this.CameraManager.VisibleOrientation : FezMath.GetOpposite(this.CameraManager.VisibleOrientation);
                    NearestTriles   nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + Vector3.Down * 1.5f + this.PlayerManager.Size / 2f * FezMath.Sign(vector), options);
                    NearestTriles   nearestTriles2 = this.LevelManager.NearestTrile(this.PlayerManager.Center + vector * 2f, options);
                    if ((nearestTriles2.Surface == null || nearestTriles2.Surface.Trile.ActorSettings.Type != ActorType.Vine) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(face) == CollisionType.None))
                    {
                        vector = Vector3.Zero;
                    }
                    nearestTriles1 = this.LevelManager.NearestTrile(this.PlayerManager.Center + this.PlayerManager.Size / 2f * Vector3.Down, options);
                    NearestTriles nearestTriles3 = this.LevelManager.NearestTrile(this.PlayerManager.Center + impulse * 2f, options);
                    if ((nearestTriles3.Surface == null || nearestTriles3.Surface.Trile.ActorSettings.Type != ActorType.Vine) && (nearestTriles1.Deep == null || nearestTriles1.Deep.GetRotatedFace(face) == CollisionType.None))
                    {
                        impulse = Vector3.Zero;
                        if (FezButtonStateExtensions.IsDown(this.InputManager.Up))
                        {
                            Vector3       vector3_3      = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
                            TrileInstance trileInstance3 = this.LevelManager.NearestTrile(trileInstance1.Center + vector3_3 * 0.5f + vector3_3 * trileInstance1.TransformedSize / 2f).Deep;
                            if (trileInstance3 != null && !trileInstance3.Trile.Immaterial && (trileInstance3.Enabled && trileInstance3.GetRotatedFace(face) != CollisionType.None))
                            {
                                TrileInstance trileInstance4 = this.LevelManager.ActualInstanceAt(trileInstance3.Position - vector3_3 + new Vector3(0.5f));
                                TrileInstance trileInstance5 = this.LevelManager.NearestTrile(trileInstance3.Position - vector3_3 + new Vector3(0.5f)).Deep;
                                if ((trileInstance5 == null || !trileInstance5.Enabled || trileInstance5.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.None) && (trileInstance4 == null || !trileInstance4.Enabled || trileInstance4.Trile.Immaterial))
                                {
                                    this.PlayerManager.HeldInstance = trileInstance3;
                                    this.PlayerManager.Action       = ActionType.GrabCornerLedge;
                                    Vector3 vector3_4 = (-vector3_3 + Vector3.UnitY) * trileInstance3.TransformedSize / 2f;
                                    this.PlayerManager.Position = trileInstance3.Center + vector3_4;
                                    this.PlayerManager.ForceOverlapsDetermination();
                                    return(false);
                                }
                            }
                        }
                    }
                    float num1  = (float)((double)FezMath.Saturate(Math.Abs((float)((double)this.PlayerManager.Animation.Timing.NormalizedStep * 2.0 % 1.0 - 0.5))) * 1.39999997615814 + 0.25);
                    float num2  = FezMath.Saturate(Math.Abs((float)(((double)this.PlayerManager.Animation.Timing.NormalizedStep + 0.300000011920929) % 1.0))) + 0.2f;
                    int   frame = this.PlayerManager.Animation.Timing.Frame;
                    if (this.lastFrame != frame)
                    {
                        bool flag = (double)Math.Abs(this.InputManager.Movement.Y) < 0.5;
                        if (flag && frame == 0 || !flag && (frame == 1 || frame == 4))
                        {
                            SoundEffectExtensions.EmitAt(this.climbSound, this.PlayerManager.Position, RandomHelper.Between(-0.100000001490116, 0.100000001490116), RandomHelper.Between(0.899999976158142, 1.0));
                        }
                        this.lastFrame = frame;
                    }
                    this.PlayerManager.Velocity = vector * num2 + impulse * num1;
                    if (trileInstance1.PhysicsState != null)
                    {
                        IPlayerManager playerManager = this.PlayerManager;
                        Vector3        vector3_3     = playerManager.Velocity + trileInstance1.PhysicsState.Velocity;
                        playerManager.Velocity = vector3_3;
                    }
                    float timeFactor = impulse == Vector3.Zero ? 0.0f : Math.Abs(this.InputManager.Movement.Y);
                    if (this.PlayerManager.Action != ActionType.SideClimbingVine)
                    {
                        timeFactor = vector == Vector3.Zero ? timeFactor : FezMath.Saturate(timeFactor + Math.Abs(this.InputManager.Movement.X));
                    }
                    this.PlayerManager.Animation.Timing.Update(elapsed, timeFactor);
                    this.PlayerManager.GroundedVelocity = new Vector3?(this.PlayerManager.Velocity);
                    MultipleHits <CollisionResult> multipleHits = this.CollisionManager.CollideEdge(this.PlayerManager.Center, impulse, this.PlayerManager.Size / 2f, Direction2D.Vertical);
                    if ((double)impulse.Y < 0.0 && (multipleHits.NearLow.Collided || multipleHits.FarHigh.Collided) && multipleHits.First.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None)
                    {
                        this.lastGrabbed = (TrileInstance)null;
                        this.PlayerManager.HeldInstance = (TrileInstance)null;
                        this.PlayerManager.Action       = ActionType.Falling;
                    }
                    return(false);
                }
            }
        }
예제 #20
0
        protected override void TestConditions()
        {
            switch (this.PlayerManager.Action)
            {
            case ActionType.Teetering:
            case ActionType.IdlePlay:
            case ActionType.IdleSleep:
            case ActionType.IdleLookAround:
            case ActionType.GrabCornerLedge:
            case ActionType.GrabLedgeBack:
            case ActionType.IdleYawn:
            case ActionType.Idle:
            case ActionType.LookingLeft:
            case ActionType.LookingRight:
            case ActionType.LookingUp:
            case ActionType.LookingDown:
            case ActionType.Walking:
            case ActionType.Running:
            case ActionType.Jumping:
            case ActionType.Lifting:
            case ActionType.Falling:
            case ActionType.Bouncing:
            case ActionType.Flying:
            case ActionType.Dropping:
            case ActionType.Sliding:
            case ActionType.Landing:
                TrileInstance trileInstance = this.IsOnVine(out this.currentApproach);
                if (this.currentApproach == ClimbingApproach.None || (!FezButtonStateExtensions.IsDown(this.InputManager.Up) || ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action)) && (this.PlayerManager.Grounded || this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right || Math.Sign(this.InputManager.Movement.X) != FezMath.Sign(ClimbingApproachExtensions.AsDirection(this.currentApproach))) && (!ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || !FezButtonStateExtensions.IsDown(this.InputManager.Down)) || trileInstance == this.lastGrabbed)
                {
                    break;
                }
                this.PlayerManager.HeldInstance = trileInstance;
                switch (this.currentApproach)
                {
                case ClimbingApproach.Right:
                case ClimbingApproach.Left:
                    this.PlayerManager.NextAction = ActionType.SideClimbingVine;
                    break;

                case ClimbingApproach.Back:
                    this.PlayerManager.NextAction = ActionType.BackClimbingVine;
                    break;

                case ClimbingApproach.Front:
                    this.PlayerManager.NextAction = ActionType.FrontClimbingVine;
                    break;
                }
                if (ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action))
                {
                    this.PlayerManager.Action     = this.PlayerManager.NextAction;
                    this.PlayerManager.NextAction = ActionType.None;
                    break;
                }
                else
                {
                    this.PlayerManager.Action   = this.currentApproach == ClimbingApproach.Back ? ActionType.JumpToClimb : ActionType.JumpToSideClimb;
                    this.PlayerManager.Velocity = Vector3.Zero;
                    if (this.currentApproach != ClimbingApproach.Left && this.currentApproach != ClimbingApproach.Right)
                    {
                        break;
                    }
                    this.PlayerManager.LookingDirection = ClimbingApproachExtensions.AsDirection(this.currentApproach);
                    break;
                }
            }
        }
예제 #21
0
        public override void Update(GameTime gameTime)
        {
            if (!ServiceHelper.Game.IsActive)
            {
                return;
            }
            this.Reset();
            if (this.keyboard)
            {
                this.KeyboardState.Update(Keyboard.GetState(), gameTime);
                this.Movement      = new Vector2(FezButtonStateExtensions.IsDown(this.KeyboardState.Right) ? 1f : (FezButtonStateExtensions.IsDown(this.KeyboardState.Left) ? -1f : 0.0f), FezButtonStateExtensions.IsDown(this.KeyboardState.Up) ? 1f : (FezButtonStateExtensions.IsDown(this.KeyboardState.Down) ? -1f : 0.0f));
                this.FreeLook      = new Vector2(FezButtonStateExtensions.IsDown(this.KeyboardState.LookRight) ? 1f : (FezButtonStateExtensions.IsDown(this.KeyboardState.LookLeft) ? -1f : 0.0f), FezButtonStateExtensions.IsDown(this.KeyboardState.LookUp) ? 1f : (FezButtonStateExtensions.IsDown(this.KeyboardState.LookDown) ? -1f : 0.0f));
                this.Back          = this.KeyboardState.OpenMap;
                this.Start         = this.KeyboardState.Pause;
                this.Jump          = this.KeyboardState.Jump;
                this.GrabThrow     = this.KeyboardState.GrabThrow;
                this.CancelTalk    = this.KeyboardState.CancelTalk;
                this.Down          = this.KeyboardState.Down;
                this.ExactUp       = this.Up = this.KeyboardState.Up;
                this.Left          = this.KeyboardState.Left;
                this.Right         = this.KeyboardState.Right;
                this.OpenInventory = this.KeyboardState.OpenInventory;
                this.RotateLeft    = this.KeyboardState.RotateLeft;
                this.RotateRight   = this.KeyboardState.RotateRight;
                this.MapZoomIn     = this.KeyboardState.MapZoomIn;
                this.MapZoomOut    = this.KeyboardState.MapZoomOut;
                this.FpsToggle     = this.KeyboardState.FpViewToggle;
                this.ClampLook     = this.KeyboardState.ClampLook;
            }
            if (this.gamepad)
            {
                PlayerIndex[] players = ControllerIndexExtensions.GetPlayers(ControllerIndex.Any);
                for (int index = 0; index < players.Length; ++index)
                {
                    GamepadState gamepadState = this.GamepadsManager[players[index]];
                    if (!gamepadState.Connected)
                    {
                        if (gamepadState.NewlyDisconnected && this.ActiveControllerDisconnected != null)
                        {
                            this.ActiveControllerDisconnected(players[index]);
                        }
                    }
                    else
                    {
                        this.ClampLook = FezMath.Coalesce <FezButtonState>(this.ClampLook, gamepadState.RightStick.Clicked.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.FpsToggle = FezMath.Coalesce <FezButtonState>(this.FpsToggle, gamepadState.LeftStick.Clicked.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        Vector2 second1 = Vector2.Clamp(ThumbstickState.CircleToSquare(gamepadState.LeftStick.Position), -Vector2.One, Vector2.One);
                        Vector2 second2 = Vector2.Clamp(ThumbstickState.CircleToSquare(gamepadState.RightStick.Position), -Vector2.One, Vector2.One);
                        this.Movement      = FezMath.Coalesce <Vector2>(this.Movement, second1, gamepadState.DPad.Direction);
                        this.FreeLook      = FezMath.Coalesce <Vector2>(this.FreeLook, second2);
                        this.Back          = FezMath.Coalesce <FezButtonState>(this.Back, gamepadState.Back, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Start         = FezMath.Coalesce <FezButtonState>(this.Start, gamepadState.Start, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Jump          = FezMath.Coalesce <FezButtonState>(this.Jump, gamepadState.A.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.GrabThrow     = FezMath.Coalesce <FezButtonState>(this.GrabThrow, gamepadState.X.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.CancelTalk    = FezMath.Coalesce <FezButtonState>(this.CancelTalk, gamepadState.B.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.OpenInventory = FezMath.Coalesce <FezButtonState>(this.OpenInventory, gamepadState.Y.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Up            = FezMath.Coalesce <FezButtonState>(this.Up, gamepadState.DPad.Up.State, gamepadState.LeftStick.Up.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Down          = FezMath.Coalesce <FezButtonState>(this.Down, gamepadState.DPad.Down.State, gamepadState.LeftStick.Down.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Left          = FezMath.Coalesce <FezButtonState>(this.Left, gamepadState.DPad.Left.State, gamepadState.LeftStick.Left.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.Right         = FezMath.Coalesce <FezButtonState>(this.Right, gamepadState.DPad.Right.State, gamepadState.LeftStick.Right.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.ExactUp       = FezMath.Coalesce <FezButtonState>(this.ExactUp, gamepadState.ExactUp, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.MapZoomIn     = FezMath.Coalesce <FezButtonState>(this.MapZoomIn, gamepadState.RightShoulder.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        this.MapZoomOut    = FezMath.Coalesce <FezButtonState>(this.MapZoomOut, gamepadState.LeftShoulder.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        if (this.StrictRotation)
                        {
                            this.RotateLeft  = FezMath.Coalesce <FezButtonState>(this.RotateLeft, gamepadState.LeftTrigger.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                            this.RotateRight = FezMath.Coalesce <FezButtonState>(this.RotateRight, gamepadState.RightTrigger.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        }
                        else
                        {
                            this.RotateLeft  = FezMath.Coalesce <FezButtonState>(this.RotateLeft, gamepadState.LeftShoulder.State, gamepadState.LeftTrigger.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                            this.RotateRight = FezMath.Coalesce <FezButtonState>(this.RotateRight, gamepadState.RightShoulder.State, gamepadState.RightTrigger.State, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
                        }
                    }
                }
            }
            if (!this.mouse)
            {
                return;
            }
            this.MouseState.Update(gameTime);
            Vector2 second = Vector2.Zero;

            switch (this.MouseState.LeftButton.State)
            {
            case MouseButtonStates.DragStarted:
                this.lastMouseCenter = new Vector2((float)this.MouseState.LeftButton.DragState.Movement.X, (float)-this.MouseState.LeftButton.DragState.Movement.Y);
                break;

            case MouseButtonStates.Dragging:
                Vector2 vector2 = new Vector2((float)this.MouseState.LeftButton.DragState.Movement.X, (float)-this.MouseState.LeftButton.DragState.Movement.Y);
                second = (this.lastMouseCenter - vector2) / 32f;
                this.lastMouseCenter = vector2;
                break;
            }
            this.FreeLook   = FezMath.Coalesce <Vector2>(this.FreeLook, second);
            this.MapZoomIn  = FezMath.Coalesce <FezButtonState>(this.MapZoomIn, this.MouseState.WheelTurnedUp, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
            this.MapZoomOut = FezMath.Coalesce <FezButtonState>(this.MapZoomOut, this.MouseState.WheelTurnedDown, (IEqualityComparer <FezButtonState>)FezButtonStateComparer.Default);
        }