コード例 #1
0
ファイル: TrialAndAwards.cs プロジェクト: conankzhang/fez
 public void Checkpoint()
 {
     Waiters.Wait((Func <bool>)(() =>
     {
         if (this.PlayerManager.Grounded)
         {
             return(ActorTypeExtensions.IsSafe(this.PlayerManager.Ground.First.Trile.ActorSettings.Type));
         }
         else
         {
             return(false);
         }
     }), (Action)(() =>
     {
         if (this.LevelManager.Name == "LAVA" && (double)this.LevelManager.WaterHeight < 50.0)
         {
             this.LevelManager.WaterHeight = 132f;
         }
         this.PlayerManager.RecordRespawnInformation(true);
     }));
 }
コード例 #2
0
        public void RecordRespawnInformation(bool markCheckpoint)
        {
            if (!this.Grounded && !this.Climbing && (this.action != ActionType.GrabCornerLedge && !ActionTypeExtensions.IsSwimming(this.action)) && this.action != ActionType.EnteringPipe)
            {
                return;
            }
            TrileInstance first = this.Ground.First;

            if (this.Climbing)
            {
                Vector3 vector3 = FezMath.SideMask(this.CameraManager.Viewpoint);
                this.LeaveGroundPosition = vector3 * FezMath.Floor(this.Position) + vector3 * 0.5f + Vector3.UnitY * ((float)(int)Math.Ceiling((double)this.Position.Y) + 0.5f) + (Vector3.One - vector3 - Vector3.UnitY) * this.Position;
            }
            else
            {
                this.LeaveGroundPosition = this.action == ActionType.GrabCornerLedge || ActionTypeExtensions.IsSwimming(this.action) || this.action == ActionType.EnteringPipe ? this.Position : first.Center + (float)((double)first.TransformedSize.Y / 2.0 + (double)this.Size.Y / 2.0) * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
            }
            if (!ActionTypeExtensions.DisallowsRespawn(this.Action) && this.CarriedInstance == null && !this.Background && (!this.Grounded || first.PhysicsState == null && !first.Unsafe) && (this.HeldInstance == null || this.HeldInstance.PhysicsState == null) && (this.Grounded && ActorTypeExtensions.IsSafe(first.Trile.ActorSettings.Type) || this.Action == ActionType.GrabCornerLedge && this.HeldInstance != null && (!this.HeldInstance.Unsafe && ActorTypeExtensions.IsSafe(this.HeldInstance.Trile.ActorSettings.Type))))
            {
                this.LastGroundedAction           = this.Action;
                this.LastGroundedView             = this.CameraManager.Viewpoint;
                this.LastGroundedLookingDirection = this.LookingDirection;
                this.RespawnPosition  = this.LeaveGroundPosition;
                this.lastGround       = this.Ground;
                this.lastHeldInstance = this.HeldInstance;
            }
            if (!markCheckpoint && this.LastGroundedView != Viewpoint.None)
            {
                return;
            }
            this.GameState.SaveData.View      = this.CameraManager.Viewpoint;
            this.GameState.SaveData.TimeOfDay = this.TimeManager.CurrentTime.TimeOfDay;
            this.CheckpointGround             = first;
            this.GameState.SaveData.Ground    = this.CheckpointGround.Center;
            this.GameState.SaveData.Level     = this.LevelManager.Name;
        }