示例#1
0
            public TombstoneState(TombstonesHost host, ArtObjectInstance ao)
            {
                ServiceHelper.InjectServices((object)this);
                this.Host      = host;
                this.ArtObject = ao;
                int num1;

                if (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(this.ArtObject.Id, out num1) && num1 != 0)
                {
                    int num2 = Math.Abs(num1);
                    for (int index = 0; index < num2; ++index)
                    {
                        this.OriginalAoRotation  = this.ArtObject.Rotation;
                        this.ArtObject.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float)Math.Sign(num1));
                    }
                }
                this.LastViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClampXZ(Vector3.Transform(Vector3.Forward, this.ArtObject.Rotation))));
            }
示例#2
0
 public TombstoneState(TombstonesHost host, ArtObjectInstance ao)
 {
   ServiceHelper.InjectServices((object) this);
   this.Host = host;
   this.ArtObject = ao;
   int num1;
   if (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(this.ArtObject.Id, out num1) && num1 != 0)
   {
     int num2 = Math.Abs(num1);
     for (int index = 0; index < num2; ++index)
     {
       this.OriginalAoRotation = this.ArtObject.Rotation;
       this.ArtObject.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float) Math.Sign(num1));
     }
   }
   this.LastViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClampXZ(Vector3.Transform(Vector3.Forward, this.ArtObject.Rotation))));
 }
示例#3
0
 private void RotateSkull()
 {
     this.InterpolatedRotation = Quaternion.Slerp(this.InterpolatedRotation, this.StopSkullRotations ? this.OriginalRotation : this.CameraManager.Rotation, 0.05f);
     if (this.InterpolatedRotation == this.CameraManager.Rotation)
     {
         if (this.eRumble.Cue.State != SoundState.Paused)
         {
             this.eRumble.Cue.Pause();
         }
         if (!this.StopSkullRotations)
         {
             return;
         }
         this.SkullRotates       = false;
         this.StopSkullRotations = false;
     }
     else
     {
         if (FezMath.AlmostEqual(this.InterpolatedRotation, this.CameraManager.Rotation) || FezMath.AlmostEqual(-this.InterpolatedRotation, this.CameraManager.Rotation))
         {
             this.InterpolatedRotation = this.CameraManager.Rotation;
         }
         this.SkullAo.Rotation = this.InterpolatedRotation * Quaternion.CreateFromAxisAngle(Vector3.UnitY, -1.570796f);
         Vector3 axis;
         float   angle1;
         TombstonesHost.ToAxisAngle(ref this.InterpolatedRotation, out axis, out angle1);
         float angle2 = this.lastAngle - angle1;
         if ((double)Math.Abs(angle2) > 0.100000001490116)
         {
             this.lastAngle = angle1;
         }
         else
         {
             for (int index = 0; index < this.SkullAttachedTriles.Length; ++index)
             {
                 TrileInstance instance = this.SkullAttachedTriles[index];
                 Vector4       vector   = this.SkullAttachedTrilesOriginalStates[index];
                 instance.Position = Vector3.Transform(FezMath.XYZ(vector) + new Vector3(0.5f) - this.SkullAo.Position, this.InterpolatedRotation) + this.SkullAo.Position - new Vector3(0.5f);
                 instance.Phi      = FezMath.WrapAngle(vector.W + ((double)axis.Y > 0.0 ? -1f : 1f) * angle1);
                 this.LevelMaterializer.GetTrileMaterializer(instance.Trile).UpdateInstance(instance);
             }
             if (Enumerable.Contains <TrileInstance>((IEnumerable <TrileInstance>) this.SkullTopLayer, this.PlayerManager.Ground.First))
             {
                 Vector3 position = this.PlayerManager.Position;
                 this.PlayerManager.Position = Vector3.Transform(this.PlayerManager.Position - this.SkullAo.Position, Quaternion.CreateFromAxisAngle(axis, angle2)) + this.SkullAo.Position;
                 IGameCameraManager cameraManager = this.CameraManager;
                 Vector3            vector3       = cameraManager.Center + this.PlayerManager.Position - position;
                 cameraManager.Center = vector3;
             }
             if ((double)Math.Abs(axis.Y) > 0.5)
             {
                 float num = angle2 * 5f;
                 IGameCameraManager cameraManager = this.CameraManager;
                 Vector3            vector3       = cameraManager.InterpolatedCenter + new Vector3(RandomHelper.Between(-(double)num, (double)num), RandomHelper.Between(-(double)num, (double)num), RandomHelper.Between(-(double)num, (double)num));
                 cameraManager.InterpolatedCenter = vector3;
                 if (this.eRumble.Cue.State == SoundState.Paused)
                 {
                     this.eRumble.Cue.Resume();
                 }
                 this.eRumble.VolumeFactor = FezMath.Saturate(Math.Abs(num) * 25f);
             }
             if (this.InterpolatedRotation == this.CameraManager.Rotation)
             {
                 this.RotateSkullTriles();
             }
             this.lastAngle = angle1;
         }
     }
 }