コード例 #1
0
ファイル: OpenDoor.cs プロジェクト: conankzhang/fez
 public override void Initialize()
 {
     this.LevelManager.LevelChanging += (Action)(() =>
     {
         bool local_0 = false;
         foreach (TrileEmplacement item_0 in this.GameState.SaveData.ThisLevel.InactiveTriles)
         {
             TrileEmplacement local_2 = item_0;
             TrileInstance bottom = this.LevelManager.TrileInstanceAt(ref local_2);
             if (bottom != null && ActorTypeExtensions.IsDoor(bottom.Trile.ActorSettings.Type))
             {
                 local_2 = bottom.Emplacement + Vector3.UnitY;
                 TrileInstance local_3 = this.LevelManager.TrileInstanceAt(ref local_2);
                 ArtObjectInstance local_4;
                 TrileGroup group;
                 if ((group = Enumerable.FirstOrDefault <TrileGroup>((IEnumerable <TrileGroup>) this.LevelManager.Groups.Values, (Func <TrileGroup, bool>)(x => x.Triles.Contains(bottom)))) != null && (local_4 = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x =>
                 {
                     int?local_0 = x.ActorSettings.AttachedGroup;
                     int local_1 = group.Id;
                     if (local_0.GetValueOrDefault() == local_1)
                     {
                         return(local_0.HasValue);
                     }
                     else
                     {
                         return(false);
                     }
                 }))) != null)
                 {
                     this.LevelManager.RemoveArtObject(local_4);
                 }
                 this.LevelManager.ClearTrile(bottom);
                 this.LevelManager.ClearTrile(local_3);
                 local_0 = true;
             }
         }
         if (!local_0 || this.GameState.FarawaySettings.InTransition)
         {
             return;
         }
         this.LevelMaterializer.CullInstances();
     });
     base.Initialize();
 }
コード例 #2
0
ファイル: OpenDoor.cs プロジェクト: conankzhang/fez
 protected override void TestConditions()
 {
     if (!this.PlayerManager.Grounded)
     {
         this.UnDotize();
     }
     else if (this.PlayerManager.CarriedInstance != null)
     {
         this.UnDotize();
     }
     else
     {
         bool flag = false;
         foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values)
         {
             TrileInstance trileInstance = nearestTriles.Surface;
             if (trileInstance != null)
             {
                 Trile           trile           = trileInstance.Trile;
                 FaceOrientation faceOrientation = FezMath.OrientationFromPhi(FezMath.ToPhi(trile.ActorSettings.Face) + trileInstance.Phi);
                 if (ActorTypeExtensions.IsDoor(trile.ActorSettings.Type) && faceOrientation == FezMath.VisibleOrientation(this.CameraManager.Viewpoint))
                 {
                     flag            = this.GameState.SaveData.Keys > 0 && this.LevelManager.Name != "VILLAGEVILLE_2D" || trile.ActorSettings.Type == ActorType.UnlockedDoor;
                     this.isUnlocked = trile.ActorSettings.Type == ActorType.UnlockedDoor;
                     this.doorBottom = trileInstance;
                     break;
                 }
             }
         }
         if (!flag)
         {
             this.UnDotize();
         }
         else if (this.doorBottom.ActorSettings.Inactive)
         {
             this.UnDotize();
         }
         else
         {
             if (!this.PlayerManager.HideFez && this.PlayerManager.CanControl && (!this.DotManager.PreventPoI && this.doorBottom.Trile.ActorSettings.Type == ActorType.Door))
             {
                 this.DotManager.Behaviour  = DotHost.BehaviourType.ThoughtBubble;
                 this.DotManager.FaceButton = DotFaceButton.Up;
                 this.DotManager.ComeOut();
                 if (this.DotManager.Owner != this)
                 {
                     this.DotManager.Hey();
                 }
                 this.DotManager.Owner = (object)this;
             }
             if (this.GameState.IsTrialMode && this.LevelManager.Name == "trial/VILLAGEVILLE_2D" || this.InputManager.ExactUp != FezButtonState.Pressed)
             {
                 return;
             }
             TrileGroup trileGroup1 = (TrileGroup)null;
             this.aoInstance = (ArtObjectInstance)null;
             foreach (TrileGroup trileGroup2 in (IEnumerable <TrileGroup>) this.LevelManager.Groups.Values)
             {
                 if (trileGroup2.Triles.Contains(this.doorBottom))
                 {
                     trileGroup1 = trileGroup2;
                     break;
                 }
             }
             if (trileGroup1 != null)
             {
                 foreach (ArtObjectInstance artObjectInstance in (IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values)
                 {
                     int?attachedGroup = artObjectInstance.ActorSettings.AttachedGroup;
                     int id            = trileGroup1.Id;
                     if ((attachedGroup.GetValueOrDefault() != id ? 0 : (attachedGroup.HasValue ? 1 : 0)) != 0)
                     {
                         this.aoInstance = artObjectInstance;
                         break;
                     }
                 }
                 if (this.aoInstance != null)
                 {
                     this.aoInitialRotation = this.aoInstance.Rotation;
                     this.initialAoPosition = this.aoInstance.Position;
                 }
             }
             this.WalkTo.Destination   = new Func <Vector3>(this.GetDestination);
             this.PlayerManager.Action = ActionType.WalkingTo;
             this.WalkTo.NextAction    = ActionType.OpeningDoor;
         }
     }
 }