Ejemplo n.º 1
0
        public void UpdateInstance(TrileInstance instance)
        {
            int instanceId = instance.InstanceId;

            if (instanceId == -1 || this.geometry == null)
            {
                return;
            }
            Vector4 vector4 = instance.Enabled ? instance.Data.PositionPhi : TrileMaterializer.OutOfSight;

            if (instanceId < this.geometry.Instances.Length)
            {
                this.geometry.Instances[instanceId] = vector4;
            }
            if (instanceId >= this.tempInstances.Count)
            {
                return;
            }
            this.tempInstances[instanceId] = vector4;
        }
Ejemplo n.º 2
0
        public void RespawnAtCheckpoint()
        {
            this.HeldInstance            = (TrileInstance)null;
            this.CarriedInstance         = (TrileInstance)null;
            this.IsOnRotato              = false;
            this.GameState.SkipRendering = true;
            this.CameraManager.ChangeViewpoint(this.GameState.SaveData.View, 0.0f);
            this.GameState.SkipRendering = false;
            this.CameraManager.SnapInterpolation();
            TrileInstance trileInstance = this.CheckpointGround ?? this.LevelManager.ActualInstanceAt(this.GameState.SaveData.Ground) ?? this.LevelManager.NearestTrile(this.GameState.SaveData.Ground).Deep;

            this.RespawnPosition = trileInstance != null ? (this.Position = trileInstance.Center + (trileInstance.TransformedSize / 2f + this.Size / 2f) * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) : (this.Position = this.GameState.SaveData.Ground + this.Size / 2f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor));
            if (this.GameState.FarawaySettings.InTransition)
            {
                this.CameraManager.SnapInterpolation();
            }
            this.Action           = ActionType.WakingUp;
            this.LookingDirection = HorizontalDirection.Right;
            this.ForceOverlapsDetermination();
            this.PhysicsManager.HugWalls((IPhysicsEntity)this, false, false, true);
        }
Ejemplo n.º 3
0
 private void TryInitialize()
 {
     this.TrackedPlanes.Clear();
     foreach (BackgroundPlane backgroundPlane in (IEnumerable <BackgroundPlane>) this.LevelManager.BackgroundPlanes.Values)
     {
         if (backgroundPlane.AttachedGroup.HasValue)
         {
             TrileInstance trileInstance = Enumerable.FirstOrDefault <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Groups[backgroundPlane.AttachedGroup.Value].Triles);
             if (trileInstance != null)
             {
                 Vector3 vector3 = backgroundPlane.Position - trileInstance.Position;
                 this.TrackedPlanes.Add(new AttachedPlanesHost.AttachedPlaneState()
                 {
                     FirstTrile = trileInstance,
                     Offset     = vector3,
                     Plane      = backgroundPlane
                 });
             }
         }
     }
 }
Ejemplo n.º 4
0
        public override void Update(GameTime gameTime)
        {
            if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)) || (this.GameState.Loading || this.PlayerManager.Action == ActionType.FindingTreasure || this.GameState.FarawaySettings.InTransition))
            {
                return;
            }
            TimeSpan timeSpan = TimeSpan.FromTicks(TimeSpan.FromTicks((DateTime.UtcNow - DateTime.FromFileTimeUtc(this.GameState.SaveData.CreationTime)).Ticks).Ticks % 6048000000000L);

            if (this.RedAo.Enabled)
            {
                float angle = FezMath.CurveAngle(this.lastRedAngle, FezMath.WrapAngle((float)((double)FezMath.Round(timeSpan.TotalSeconds) / 60.0 * 6.28318548202515)), 0.1f);
                this.lastRedAngle   = angle;
                this.RedAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitZ, angle) * this.RedOriginalRotation;
                this.RedAo.Position = this.RedOriginalPosition + new Vector3(-(float)Math.Cos((double)angle), (float)Math.Sin((double)angle), 0.0f) * 1.45f;
                this.RedSecret      = this.TestSecretFor((double)angle >= 1.19579637050629 && (double)angle <= 1.69579637050629, this.RedAo, this.RedSecret, this.RedTopMost);
            }
            if (this.BlueAo.Enabled)
            {
                float num = FezMath.WrapAngle((float)(timeSpan.TotalMinutes / 60.0 * 6.28318548202515));
                this.BlueAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitX, num) * this.BlueOriginalRotation;
                this.BlueAo.Position = this.BlueOriginalPosition + new Vector3(0.0f, (float)Math.Sin((double)num), (float)Math.Cos((double)num)) * 1.45f;
                this.BlueSecret      = this.TestSecretFor(FezMath.AlmostEqual(num, 1.570796f, 0.125f), this.BlueAo, this.BlueSecret, this.BlueTopMost);
            }
            if (this.GreenAo.Enabled)
            {
                float num = FezMath.WrapAngle((float)(timeSpan.TotalHours / 24.0 * 6.28318548202515));
                this.GreenAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, num) * this.GreenOriginalRotation;
                this.GreenAo.Position = this.GreenOriginalPosition + new Vector3((float)Math.Cos((double)num), (float)Math.Sin((double)num), 0.0f) * 1.45f;
                this.GreenSecret      = this.TestSecretFor(FezMath.AlmostEqual(num, 1.570796f, 0.125f), this.GreenAo, this.GreenSecret, this.GreenTopMost);
            }
            if (!this.WhiteAo.Enabled)
            {
                return;
            }
            float num1 = FezMath.WrapAngle((float)(timeSpan.TotalDays / 7.0 * 6.28318548202515));

            this.WhiteAo.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, num1) * this.WhiteOriginalRotation;
            this.WhiteAo.Position = this.WhiteOriginalPosition + new Vector3(0.0f, (float)Math.Sin((double)num1), -(float)Math.Cos((double)num1)) * 1.45f;
            this.WhiteSecret      = this.TestSecretFor(FezMath.AlmostEqual(num1, 1.570796f, 0.125f), this.WhiteAo, this.WhiteSecret, this.WhiteTopMost);
        }
Ejemplo n.º 5
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;
     }
 }
Ejemplo n.º 6
0
        protected override bool Act(TimeSpan elapsed)
        {
            if (this.PlayerManager.HeldInstance.PhysicsState != null)
            {
                this.PlayerManager.Position += this.PlayerManager.HeldInstance.PhysicsState.Velocity;
            }
            if (!this.PlayerManager.Animation.Timing.Ended)
            {
                return(true);
            }
            this.PlayerManager.Action = ActionType.GrabLedgeBack;
            Vector3       vector3_1    = FezMath.SideMask(this.CameraManager.Viewpoint);
            Vector3       vector3_2    = FezMath.DepthMask(this.CameraManager.Viewpoint);
            Vector3       vector3_3    = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            TrileInstance heldInstance = this.PlayerManager.HeldInstance;

            this.PlayerManager.Position = this.PlayerManager.Position * vector3_1 + heldInstance.Center * (Vector3.UnitY + vector3_2) + vector3_3 * (float)-(0.5 + (double)this.PlayerManager.Size.X / 4.0) + Vector3.UnitY * 8f / 16f * (float)Math.Sign(this.CollisionManager.GravityFactor);
            this.PlayerManager.ForceOverlapsDetermination();
            this.PhysicsManager.HugWalls((IPhysicsEntity)this.PlayerManager, false, false, true);
            this.PlayerManager.HeldInstance = this.PlayerManager.AxisCollision[VerticalDirection.Down].Deep;
            return(false);
        }
Ejemplo n.º 7
0
 public LongRunningAction ChangeTrile(int id, int newTrileId)
 {
     int[] oldTrileId = new int[this.LevelManager.Groups[id].Triles.Count];
     for (int index = 0; index < oldTrileId.Length; ++index)
     {
         TrileInstance instance = this.LevelManager.Groups[id].Triles[index];
         oldTrileId[index] = instance.Trile.Id;
         this.LevelManager.SwapTrile(instance, this.LevelManager.SafeGetTrile(newTrileId));
     }
     return(new LongRunningAction((Action)(() =>
     {
         TrileGroup local_0;
         if (!this.LevelManager.Groups.TryGetValue(id, out local_0))
         {
             return;
         }
         for (int local_1 = 0; local_1 < oldTrileId.Length; ++local_1)
         {
             this.LevelManager.SwapTrile(local_0.Triles[local_1], this.LevelManager.SafeGetTrile(oldTrileId[local_1]));
         }
     })));
 }
Ejemplo n.º 8
0
 private void TryInitialize()
 {
     if (this.LevelManager.Name == null || !this.LevelManager.Name.StartsWith("HOLE"))
     {
         return;
     }
     this.GameState.SkipFadeOut         = true;
     this.PlayerManager.CanControl      = false;
     this.CameraManager.Constrained     = true;
     this.CameraManager.PixelsPerTrixel = 3f;
     this.CameraManager.Center          = new Vector3(13f, 20f, 27.875f);
     this.PlayerManager.Position        = new Vector3(13.5f, 15.47f, 28.5f);
     this.PlayerManager.Ground          = new MultipleHits <TrileInstance>();
     this.PlayerManager.Velocity        = 0.007875f * -Vector3.UnitY;
     this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
     this.PlayerManager.Velocity = 0.007875f * -Vector3.UnitY;
     this.PlayerManager.RecordRespawnInformation(true);
     this.PlayerManager.Position = new Vector3(13.5f, 50f, 28.5f);
     this.PlayerManager.Ground   = new MultipleHits <TrileInstance>();
     this.PlayerManager.Action   = ActionType.FreeFalling;
     for (int index = 0; index < 4; ++index)
     {
         TrileInstance        trileInstance = new TrileInstance(new Vector3(13.5f, (float)(30 + index * 5), (float)(27 - index)), 354);
         TrixelParticleSystem system        = new TrixelParticleSystem(this.Game, new TrixelParticleSystem.Settings()
         {
             ExplodingInstance = trileInstance,
             EnergySource      = new Vector3?(trileInstance.Center),
             ParticleCount     = 25,
             MinimumSize       = 1,
             MaximumSize       = 6,
             GravityModifier   = 1.5f,
             Darken            = true,
             Energy            = (float)(index + 2) / 4f
         });
         this.ParticleSystems.Add(system);
         system.Initialize();
     }
     this.Enabled = true;
 }
Ejemplo n.º 9
0
        private void DetermineFloatMalus(PickupState pickup)
        {
            TrileInstance trileInstance1 = pickup.Instance;
            int           num            = 0;
            Vector3       vector3        = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
            TrileInstance trileInstance2 = trileInstance1;
            Vector3       b = trileInstance1.Center * vector3;

            do
            {
                TrileInstance trileInstance3 = this.PlayerManager.Ground.NearLow;
                TrileInstance trileInstance4 = this.PlayerManager.Ground.FarHigh;
                TrileInstance heldInstance   = this.PlayerManager.HeldInstance;
                if (trileInstance3 == trileInstance2 || trileInstance3 != null && FezMath.AlmostEqual(trileInstance3.Center * vector3, b) || (trileInstance4 == trileInstance2 || trileInstance4 != null && FezMath.AlmostEqual(trileInstance4.Center * vector3, b)) || (heldInstance == trileInstance2 || heldInstance != null && FezMath.AlmostEqual(heldInstance.Center * vector3, b)))
                {
                    ++num;
                }
                if (trileInstance1.PhysicsState.PushedDownBy != null)
                {
                    ++num;
                    trileInstance2 = trileInstance2.PhysicsState.PushedDownBy;
                }
                else
                {
                    trileInstance2 = (TrileInstance)null;
                }
            }while (trileInstance2 != null);
            pickup.FloatMalus = MathHelper.Lerp(pickup.FloatMalus, -0.25f * (float)num, 0.1f);
            if (num == 0 || pickup.Group == null)
            {
                return;
            }
            foreach (TrileInstance trileInstance3 in pickup.Group.Triles)
            {
                trileInstance3.PhysicsState.Puppet = true;
            }
            pickup.Instance.PhysicsState.Puppet = false;
        }
Ejemplo n.º 10
0
        protected void UpdateRotation()
        {
            Quaternion rotation = this.CameraManager.Rotation;

            if (this.oldRotation == rotation && this.oldDirection == this.LookingDirection)
            {
                return;
            }
            this.oldRotation  = rotation;
            this.oldDirection = this.LookingDirection;
            int num = -Math.Sign(FezMath.Dot(this.CameraManager.InverseView.Right, FezMath.Sign(this.Npc.DestinationOffset)));

            if (this.LookingDirection == HorizontalDirection.Left)
            {
                num *= -1;
            }
            if (num != 0)
            {
                rotation *= FezMath.QuaternionFromPhi((float)(3.14159274101257 * ((double)num / 2.0 + 0.5)));
            }
            this.Group.Rotation = rotation;
            if (!FezMath.IsOrthographic(this.CameraManager.Viewpoint))
            {
                return;
            }
            this.InBackground = false;
            Vector3       b             = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.Position, QueryOptions.Simple);
            TrileInstance trileInstance = nearestTriles.Surface ?? nearestTriles.Deep;

            if (trileInstance == null)
            {
                return;
            }
            Vector3 a = trileInstance.Center + trileInstance.TransformedSize / 2f * -b;

            this.InBackground = (double)FezMath.Dot(this.Position, b) > (double)FezMath.Dot(a, b);
        }
Ejemplo n.º 11
0
 private void CorrectWallOverlap(bool overcompensate)
 {
     foreach (PointCollision pointCollision in this.PlayerManager.CornerCollision)
     {
         TrileInstance trileInstance = pointCollision.Instances.Deep;
         if (trileInstance != null && trileInstance != this.PlayerManager.CarriedInstance && trileInstance.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.AllSides)
         {
             Vector3 vector = (pointCollision.Point - trileInstance.Center + FezMath.Sign(this.PlayerManager.Position - pointCollision.Point) * trileInstance.TransformedSize / 2f) * FezMath.SideMask(this.CameraManager.Viewpoint);
             this.PlayerManager.Position -= vector;
             this.PlayerManager.Position -= FezMath.Sign(vector) * (1.0 / 1000.0) * 2f;
             if (!(FezMath.Sign(this.PlayerManager.Velocity) == FezMath.Sign(vector)))
             {
                 break;
             }
             Vector3 vector3_1 = FezMath.Abs(FezMath.Sign(vector));
             this.PlayerManager.Position -= this.PlayerManager.Velocity * vector3_1;
             IPlayerManager playerManager = this.PlayerManager;
             Vector3        vector3_2     = playerManager.Velocity * (Vector3.One - vector3_1);
             playerManager.Velocity = vector3_2;
             break;
         }
     }
 }
Ejemplo n.º 12
0
        public override int Compare(PickupState x, PickupState y)
        {
            int           num1           = 0;
            int           num2           = 0;
            TrileInstance trileInstance1 = (TrileInstance)null;
            TrileInstance trileInstance2 = (TrileInstance)null;

            for (InstancePhysicsState physicsState = x.Instance.PhysicsState; physicsState.Grounded && physicsState.Ground.First.PhysicsState != null && (physicsState.Ground.First != x.Instance && physicsState.Ground.First != trileInstance2); physicsState = trileInstance1.PhysicsState)
            {
                trileInstance2 = trileInstance1;
                ++num1;
                trileInstance1 = physicsState.Ground.First;
            }
            InstancePhysicsState physicsState1 = y.Instance.PhysicsState;
            TrileInstance        trileInstance3;

            for (TrileInstance trileInstance4 = trileInstance3 = (TrileInstance)null; physicsState1.Grounded && physicsState1.Ground.First.PhysicsState != null && (physicsState1.Ground.First != y.Instance && physicsState1.Ground.First != trileInstance3); physicsState1 = trileInstance4.PhysicsState)
            {
                trileInstance3 = trileInstance4;
                ++num2;
                trileInstance4 = physicsState1.Ground.First;
            }
            if (num1 - num2 != 0)
            {
                return(num1 - num2);
            }
            Vector3 b = FezMath.Sign(x.Instance.PhysicsState.Velocity) * FezMath.XZMask;

            if (b == FezMath.Sign(y.Instance.PhysicsState.Velocity) * FezMath.XZMask)
            {
                return(Math.Sign(FezMath.Dot(x.Instance.Position - y.Instance.Position, b)));
            }
            else
            {
                return(Math.Sign(x.Instance.Position.Y - y.Instance.Position.Y));
            }
        }
Ejemplo n.º 13
0
        private void TestForCrumblers()
        {
            TrileInstance instance = (TrileInstance)null;
            bool          flag     = false;

            if (this.PlayerManager.Grounded)
            {
                TrileInstance nl = this.PlayerManager.Ground.NearLow;
                TrileInstance fh = this.PlayerManager.Ground.FarHigh;
                if (nl != null && (flag = flag | nl.Trile.ActorSettings.Type == ActorType.Crumbler) && !Enumerable.Any <CrumblersHost.CrumblerState>((IEnumerable <CrumblersHost.CrumblerState>) this.States, (Func <CrumblersHost.CrumblerState, bool>)(x => x.Instance == nl)))
                {
                    instance = nl;
                }
                else if (fh != null && (flag = flag | fh.Trile.ActorSettings.Type == ActorType.Crumbler) && !Enumerable.Any <CrumblersHost.CrumblerState>((IEnumerable <CrumblersHost.CrumblerState>) this.States, (Func <CrumblersHost.CrumblerState, bool>)(x => x.Instance == fh)))
                {
                    instance = fh;
                }
            }
            else if (ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action))
            {
                TrileInstance hi = this.PlayerManager.HeldInstance;
                if (hi != null && (flag = flag | hi.Trile.ActorSettings.Type == ActorType.Crumbler) && !Enumerable.Any <CrumblersHost.CrumblerState>((IEnumerable <CrumblersHost.CrumblerState>) this.States, (Func <CrumblersHost.CrumblerState, bool>)(x => x.Instance == hi)))
                {
                    instance = hi;
                }
            }
            if (instance != null)
            {
                this.States.Add(new CrumblersHost.CrumblerState(instance, this));
            }
            if (!flag || Fez.NoGamePad)
            {
                return;
            }
            this.Gamepads[this.GameState.ActivePlayer].Vibrate(VibrationMotor.LeftLow, 0.25, TimeSpan.FromSeconds(0.100000001490116));
            this.Gamepads[this.GameState.ActivePlayer].Vibrate(VibrationMotor.RightHigh, 0.25, TimeSpan.FromSeconds(0.100000001490116));
        }
Ejemplo n.º 14
0
        private void DoLoad(bool dummy)
        {
            this.LevelManager.ChangeLevel(this.newLevel);
            this.PlayerManager.ForceOverlapsDetermination();
            TrileInstance instance1 = this.PlayerManager.AxisCollision[VerticalDirection.Up].Surface;

            if (instance1 != null && instance1.Trile.ActorSettings.Type == ActorType.UnlockedDoor && FezMath.OrientationFromPhi(FezMath.ToPhi(instance1.Trile.ActorSettings.Face) + instance1.Phi) == FezMath.VisibleOrientation(this.CameraManager.Viewpoint))
            {
                ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount;
                TrileEmplacement id        = instance1.Emplacement + Vector3.UnitY;
                TrileInstance    instance2 = this.LevelManager.TrileInstanceAt(ref id);
                if (instance2.Trile.ActorSettings.Type == ActorType.UnlockedDoor)
                {
                    ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount;
                }
                this.LevelManager.ClearTrile(instance1);
                this.LevelManager.ClearTrile(instance2);
                this.GameState.SaveData.ThisLevel.InactiveTriles.Add(instance1.Emplacement);
                instance1.ActorSettings.Inactive = true;
            }
            if (!this.PlayerManager.SpinThroughDoor)
            {
                if (this.PlayerManager.CarriedInstance != null)
                {
                    this.PlayerManager.Action = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.ExitDoorCarryHeavy : ActionType.ExitDoorCarry;
                }
                else
                {
                    this.PlayerManager.Action = ActionType.ExitDoor;
                }
            }
            if (!this.skipFade)
            {
                this.GameState.ScheduleLoadEnd = true;
            }
            this.GameState.SkipLoadScreen = false;
        }
Ejemplo n.º 15
0
        public CollisionResult CollidePoint(Vector3 position, Vector3 impulse, QueryOptions options, float elasticity, Viewpoint viewpoint)
        {
            CollisionResult collisionResult = new CollisionResult();
            Vector3         vector3         = position + impulse;
            TrileInstance   instance        = (TrileInstance)null;

            if ((options & QueryOptions.Background) != QueryOptions.None)
            {
                instance = this.LevelManager.ActualInstanceAt(vector3);
            }
            if (instance == null)
            {
                NearestTriles nearestTriles = this.LevelManager.NearestTrile(vector3, options, new Viewpoint?(viewpoint));
                instance = nearestTriles.Deep ?? nearestTriles.Surface;
            }
            bool invertedGravity = (double)this.GravityFactor < 0.0;

            if (instance != null)
            {
                collisionResult = CollisionManager.CollideWithInstance(position, vector3, impulse, instance, options, elasticity, viewpoint, invertedGravity);
            }
            if (collisionResult.Collided && (invertedGravity ? ((double)impulse.Y > 0.0 ? 1 : 0) : ((double)impulse.Y < 0.0 ? 1 : 0)) != 0)
            {
                if ((double)vector3.X % 0.25 == 0.0)
                {
                    vector3.X += 1.0 / 1000.0;
                }
                if ((double)vector3.Z % 0.25 == 0.0)
                {
                    vector3.Z += 1.0 / 1000.0;
                }
                TrileInstance trileInstance = this.LevelManager.ActualInstanceAt(vector3);
                CollisionType rotatedFace;
                collisionResult.ShouldBeClamped = trileInstance == null || !trileInstance.Enabled || (rotatedFace = trileInstance.GetRotatedFace(this.CameraManager.VisibleOrientation)) == CollisionType.None || rotatedFace == CollisionType.Immaterial;
            }
            return(collisionResult);
        }
Ejemplo n.º 16
0
        private void DoLoad(bool dummy)
        {
            this.LevelManager.ChangeLevel(this.NextLevel);
            this.PlayerManager.ForceOverlapsDetermination();
            TrileInstance instance1 = this.PlayerManager.AxisCollision[VerticalDirection.Up].Surface;

            if (instance1 != null && instance1.Trile.ActorSettings.Type == ActorType.UnlockedDoor && FezMath.OrientationFromPhi(FezMath.ToPhi(instance1.Trile.ActorSettings.Face) + instance1.Phi) == FezMath.VisibleOrientation(this.CameraManager.Viewpoint))
            {
                ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount;
                TrileEmplacement id        = instance1.Emplacement + Vector3.UnitY;
                TrileInstance    instance2 = this.LevelManager.TrileInstanceAt(ref id);
                if (instance2.Trile.ActorSettings.Type == ActorType.UnlockedDoor)
                {
                    ++this.GameState.SaveData.ThisLevel.FilledConditions.UnlockedDoorCount;
                }
                this.LevelManager.ClearTrile(instance1);
                this.LevelManager.ClearTrile(instance2);
                this.GameState.SaveData.ThisLevel.InactiveTriles.Add(instance1.Emplacement);
                instance1.ActorSettings.Inactive = true;
            }
            this.PlayerManager.Hidden      = false;
            this.CameraManager.Constrained = false;
            this.GameState.ScheduleLoadEnd = true;
        }
Ejemplo n.º 17
0
        private static bool OffsetInstanceContains(Vector3 screenSpacePosition, TrileInstance instance, bool depthIsZ)
        {
            Vector3 center          = instance.Center;
            Vector3 transformedSize = instance.TransformedSize;
            Vector3 vector3_1       = new Vector3(depthIsZ ? center.X : center.Z, center.Y, depthIsZ ? center.Z : center.X);
            Vector3 vector3_2       = new Vector3(depthIsZ ? transformedSize.X / 2f : transformedSize.Z / 2f, transformedSize.Y / 2f, depthIsZ ? transformedSize.Z / 2f : transformedSize.X / 2f);

            if ((double)screenSpacePosition.X <= (double)vector3_1.X - (double)vector3_2.X || (double)screenSpacePosition.X >= (double)vector3_1.X + (double)vector3_2.X || ((double)screenSpacePosition.Y < (double)vector3_1.Y - (double)vector3_2.Y || (double)screenSpacePosition.Y >= (double)vector3_1.Y + (double)vector3_2.Y))
            {
                return(false);
            }
            if ((double)screenSpacePosition.Z == -1.0)
            {
                return(true);
            }
            if ((double)screenSpacePosition.Z > (double)vector3_1.Z - (double)vector3_2.Z)
            {
                return((double)screenSpacePosition.Z < (double)vector3_1.Z + (double)vector3_2.Z);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 18
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;
        }
Ejemplo n.º 19
0
        private void SpawnSplashes()
        {
            int num1 = 0;
            int num2 = 0;

            while (num2 < 3 && num1 < 25)
            {
                TrileInstance trileInstance = RandomHelper.InList <TrileInstance>(this.trileTops);
                if (trileInstance.InstanceId >= 0 && this.CameraManager.Frustum.Contains(trileInstance.Center) != ContainmentType.Disjoint)
                {
                    this.PlaneSystems.RainSplash(new Vector3(RandomHelper.Unit() / 2f, 0.5f, RandomHelper.Unit() / 2f) * trileInstance.TransformedSize + trileInstance.Center);
                    ++num2;
                }
                else
                {
                    ++num1;
                }
            }
            if (!RandomHelper.Probability(0.00999999977648258))
            {
                return;
            }
            this.PlaneSystems.RainSplash(new Vector3(RandomHelper.Unit() / 2f, 0.625f, RandomHelper.Unit() / 2f) * this.PlayerManager.Size + this.PlayerManager.Center);
        }
Ejemplo n.º 20
0
 protected override void Begin()
 {
     if (this.PlayerManager.CarriedInstance == null && this.PlayerManager.PushedInstance == null)
     {
         this.PlayerManager.Action = ActionType.Idle;
     }
     else
     {
         Vector3 vector    = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
         Vector3 mask      = FezMath.GetMask(FezMath.VisibleAxis(this.CameraManager.Viewpoint));
         Vector3 vector3_1 = FezMath.Abs(vector);
         if (this.PlayerManager.PushedInstance != null)
         {
             this.PlayerManager.CarriedInstance = this.PlayerManager.PushedInstance;
             this.PlayerManager.PushedInstance  = (TrileInstance)null;
         }
         TrileInstance carriedInstance = this.PlayerManager.CarriedInstance;
         TrileInstance first           = this.PlayerManager.Ground.First;
         Vector3       vector3_2       = carriedInstance.Center * vector3_1 + this.PlayerManager.Position * mask + (first.Center.Y + (float)((double)first.Trile.Size.Y / 2.0 + (double)carriedInstance.Trile.Size.Y / 2.0) * (float)Math.Sign(this.CollisionManager.GravityFactor)) * Vector3.UnitY;
         this.PlayerManager.CarriedInstance.PhysicsState.Center = vector3_2;
         this.PlayerManager.CarriedInstance.PhysicsState.UpdateInstance();
         this.PlayerManager.Position = this.PlayerManager.Position * (Vector3.One - vector3_1) + vector3_2 * vector3_1 + -carriedInstance.TransformedSize / 2f * vector + -3.0 / 16.0 * vector;
         if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type))
         {
             SoundEffectExtensions.EmitAt(this.liftHeavySound, this.PlayerManager.Position);
         }
         else
         {
             SoundEffectExtensions.EmitAt(this.liftLightSound, this.PlayerManager.Position);
         }
         this.GomezService.OnLiftObject();
         IPlayerManager playerManager = this.PlayerManager;
         Vector3        vector3_3     = playerManager.Velocity * Vector3.UnitY;
         playerManager.Velocity = vector3_3;
     }
 }
Ejemplo n.º 21
0
 private bool TryExplodeAt(BombsHost.BombState state, TrileInstance nearestNeighbor, ref bool chainsploded, ref bool needsRecull)
 {
     if (nearestNeighbor != null && nearestNeighbor.Enabled && !nearestNeighbor.Trile.Immaterial)
     {
         if (!ActorTypeExtensions.IsChainsploding(nearestNeighbor.Trile.ActorSettings.Type) && !ActorTypeExtensions.IsDestructible(nearestNeighbor.Trile.ActorSettings.Type))
         {
             return(true);
         }
         if (!this.bombStates.ContainsKey(nearestNeighbor))
         {
             if (ActorTypeExtensions.IsBomb(nearestNeighbor.Trile.ActorSettings.Type))
             {
                 nearestNeighbor.PhysicsState.Respawned = false;
             }
             if (!chainsploded)
             {
                 this.bsToAdd.Add(new KeyValuePair <TrileInstance, BombsHost.BombState>(nearestNeighbor, new BombsHost.BombState()
                 {
                     SincePickup     = state.SincePickup - this.ChainsplodeDelay,
                     IsChainsploding = true,
                     ChainsplodedBy  = state
                 }));
                 chainsploded = true;
             }
             else
             {
                 this.ClearDestructible(nearestNeighbor, true);
                 this.LevelMaterializer.CullInstanceOut(nearestNeighbor);
                 this.DropSupportedTriles(nearestNeighbor);
                 needsRecull = true;
             }
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 22
0
        private TrileInstance TestSecretFor(bool condition, ArtObjectInstance ao, TrileInstance secretTrile, TrileInstance topMost)
        {
            Vector3 position = topMost.Position + Vector3.Up * 1.5f;

            if (condition)
            {
                if (secretTrile != null && secretTrile.Collected)
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, ao));
                    this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(ao.Id);
                    ao.Enabled = false;
                    this.TestAllSolved();
                    this.LevelService.ResolvePuzzle();
                    return((TrileInstance)null);
                }
                else
                {
                    if (secretTrile == null)
                    {
                        secretTrile = new TrileInstance(position, Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube)).Id);
                        ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(this.Game, secretTrile)
                        {
                            DontCullIn = true
                        });
                    }
                    secretTrile.Position = position;
                    if (!secretTrile.Hidden)
                    {
                        this.LevelManager.UpdateInstance(secretTrile);
                    }
                }
            }
            else if (secretTrile != null)
            {
                if (secretTrile.Collected)
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, ao));
                    this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(ao.Id);
                    ao.Enabled = false;
                    this.TestAllSolved();
                    this.LevelService.ResolvePuzzle();
                    return((TrileInstance)null);
                }
                else
                {
                    ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, secretTrile));
                    TrileInstance rs = secretTrile;
                    Vector3       p  = position;
                    Waiters.Interpolate(2.5, (Action <float>)(_ => rs.Position = p));
                    return((TrileInstance)null);
                }
            }
            return(secretTrile);
        }
Ejemplo n.º 23
0
        private void TryInitialize()
        {
            this.Enabled   = this.LevelManager.Name == "CLOCK";
            this.RedAo     = this.BlueAo = this.GreenAo = this.WhiteAo = (ArtObjectInstance)null;
            this.sTickTock = (SoundEffect)null;
            this.eTickTock = (SoundEmitter)null;
            if (!this.Enabled)
            {
                return;
            }
            foreach (ArtObjectInstance artObjectInstance in (IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values)
            {
                if (artObjectInstance.ArtObjectName == "CLOCKHAND_RAO")
                {
                    this.RedAo = artObjectInstance;
                }
                if (artObjectInstance.ArtObjectName == "CLOCKHAND_GAO")
                {
                    this.GreenAo = artObjectInstance;
                }
                if (artObjectInstance.ArtObjectName == "CLOCKHAND_BAO")
                {
                    this.BlueAo = artObjectInstance;
                }
                if (artObjectInstance.ArtObjectName == "CLOCKHAND_WAO")
                {
                    this.WhiteAo = artObjectInstance;
                }
            }
            this.RedOriginalRotation   = this.RedAo.Rotation;
            this.BlueOriginalRotation  = this.BlueAo.Rotation;
            this.GreenOriginalRotation = this.GreenAo.Rotation;
            this.WhiteOriginalRotation = this.WhiteAo.Rotation;
            this.RedOriginalPosition   = this.RedAo.Position + 1.125f * Vector3.UnitX;
            this.GreenOriginalPosition = this.GreenAo.Position - 1.125f * Vector3.UnitX;
            this.BlueOriginalPosition  = this.BlueAo.Position + 1.125f * Vector3.UnitZ;
            this.WhiteOriginalPosition = this.WhiteAo.Position - 1.125f * Vector3.UnitZ;
            this.RedGroup     = this.LevelManager.Groups[23];
            this.BlueGroup    = this.LevelManager.Groups[24];
            this.GreenGroup   = this.LevelManager.Groups[25];
            this.WhiteGroup   = this.LevelManager.Groups[26];
            this.RedTopMost   = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.RedGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58));
            this.BlueTopMost  = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.BlueGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58));
            this.GreenTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.GreenGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58));
            this.WhiteTopMost = Enumerable.First <TrileInstance>((IEnumerable <TrileInstance>) this.WhiteGroup.Triles, (Func <TrileInstance, bool>)(x => x.Emplacement.Y == 58));
            if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.RedAo.Id))
            {
                this.RedAo.Enabled = false;
                this.LevelManager.RemoveArtObject(this.RedAo);
            }
            if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.GreenAo.Id))
            {
                this.GreenAo.Enabled = false;
                this.LevelManager.RemoveArtObject(this.GreenAo);
            }
            if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.BlueAo.Id))
            {
                this.BlueAo.Enabled = false;
                this.LevelManager.RemoveArtObject(this.BlueAo);
            }
            if (this.GameState.SaveData.ThisLevel.InactiveArtObjects.Contains(this.WhiteAo.Id))
            {
                this.WhiteAo.Enabled = false;
                this.LevelManager.RemoveArtObject(this.WhiteAo);
            }
            TimeSpan timeSpan = TimeSpan.FromTicks((DateTime.UtcNow - DateTime.FromFileTimeUtc(this.GameState.SaveData.CreationTime)).Ticks);

            if (this.RedAo.Enabled)
            {
                float angle = FezMath.WrapAngle((float)((double)FezMath.Round(timeSpan.TotalSeconds) / 60.0 * 6.28318548202515));
                this.lastRedAngle   = angle;
                this.RedAo.Rotation = Quaternion.CreateFromAxisAngle(-Vector3.UnitZ, angle) * this.RedOriginalRotation;
            }
            if (!this.WhiteAo.Enabled && !this.BlueAo.Enabled && (!this.GreenAo.Enabled && !this.RedAo.Enabled))
            {
                return;
            }
            this.sTickTock = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/MiscActors/TickTockLoop");
            Waiters.Wait(FezMath.Frac(timeSpan.TotalSeconds), (Action)(() => this.eTickTock = SoundEffectExtensions.EmitAt(this.sTickTock, new Vector3(41.5f, 61.5f, 35.5f), true)));
        }
Ejemplo n.º 24
0
        public override void Update(GameTime gameTime)
        {
            if (this.CameraManager.Viewpoint == Viewpoint.Perspective || !this.CameraManager.ActionRunning || (this.GameState.Paused || this.GameState.InMap) || (this.CameraManager.RequestedViewpoint != Viewpoint.None || this.GameState.Loading))
            {
                return;
            }
            foreach (BombsHost.DestructibleGroup destructibleGroup1 in this.destructibleGroups)
            {
                if (destructibleGroup1.RespawnIn.HasValue)
                {
                    BombsHost.DestructibleGroup destructibleGroup2 = destructibleGroup1;
                    float?nullable1 = destructibleGroup2.RespawnIn;
                    float num       = (float)gameTime.ElapsedGameTime.TotalSeconds;
                    float?nullable2 = nullable1.HasValue ? new float?(nullable1.GetValueOrDefault() - num) : new float?();
                    destructibleGroup2.RespawnIn = nullable2;
                    if ((double)destructibleGroup1.RespawnIn.Value <= 0.0)
                    {
                        bool flag = true;
                        foreach (TrileInstance instance in destructibleGroup1.AllTriles)
                        {
                            if (!instance.Enabled || instance.Hidden || instance.Removed)
                            {
                                instance.Enabled = false;
                                instance.Hidden  = true;
                                ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(ServiceHelper.Game, instance, flag || RandomHelper.Probability(0.25)));
                                flag = false;
                            }
                        }
                        destructibleGroup1.RespawnIn = new float?();
                    }
                }
            }
            TrileInstance carriedInstance = this.PlayerManager.CarriedInstance;

            if (carriedInstance != null && ActorTypeExtensions.IsBomb(carriedInstance.Trile.ActorSettings.Type) && !this.bombStates.ContainsKey(carriedInstance))
            {
                carriedInstance.Foreign = carriedInstance.PhysicsState.Respawned = false;
                this.bombStates.Add(carriedInstance, new BombsHost.BombState());
            }
            bool flag1 = false;
            bool flag2 = false;

            foreach (TrileInstance instance in this.bombStates.Keys)
            {
                BombsHost.BombState state = this.bombStates[instance];
                if (!ActionTypeExtensions.IsEnteringDoor(this.PlayerManager.Action))
                {
                    state.SincePickup += gameTime.ElapsedGameTime;
                }
                bool flag3 = instance.Trile.ActorSettings.Type == ActorType.BigBomb;
                bool flag4 = instance.Trile.ActorSettings.Type == ActorType.TntBlock || instance.Trile.ActorSettings.Type == ActorType.TntPickup;
                if (ActorTypeExtensions.IsBomb(instance.Trile.ActorSettings.Type) && instance.Hidden)
                {
                    this.bsToRemove.Add(instance);
                    if (state.Flash != null)
                    {
                        this.flashesMesh.RemoveGroup(state.Flash);
                        state.Flash = (Group)null;
                    }
                    if (state.Emitter != null && state.Emitter.Cue != null)
                    {
                        state.Emitter.Cue.Stop(false);
                    }
                }
                else
                {
                    if (state.SincePickup > this.FlashTime && state.Explosion == null)
                    {
                        if (state.Flash == null)
                        {
                            state.Flash = this.flashesMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, this.FlashColor, true);
                            if (ActorTypeExtensions.IsBomb(instance.Trile.ActorSettings.Type) && !state.IsChainsploding)
                            {
                                state.Emitter = SoundEffectExtensions.EmitAt(this.countdownSound, instance.Center);
                                state.Emitter.PauseViewTransitions = true;
                            }
                        }
                        double totalSeconds = state.SincePickup.TotalSeconds;
                        if (totalSeconds > this.ExplodeStart.TotalSeconds - 1.0)
                        {
                            totalSeconds *= 2.0;
                        }
                        state.Flash.Enabled = FezMath.Frac(totalSeconds) < 0.5;
                        if (state.Flash.Enabled)
                        {
                            state.Flash.Position = instance.Center;
                            state.Flash.Rotation = this.CameraManager.Rotation;
                        }
                    }
                    if (state.SincePickup > this.ExplodeStart && state.Explosion == null)
                    {
                        if (flag4 && !flag1 || !flag4 && !flag2)
                        {
                            SoundEffectExtensions.EmitAt(flag4 ? this.crystalsplodeSound : this.explodeSound, instance.Center, RandomHelper.Centered(0.025));
                            if (flag4)
                            {
                                flag1 = true;
                            }
                            else
                            {
                                flag2 = true;
                            }
                        }
                        if (state.ChainsplodedBy != null && state.ChainsplodedBy.Emitter != null)
                        {
                            state.ChainsplodedBy.Emitter.FadeOutAndDie(0.0f);
                        }
                        float num1 = (flag3 ? 0.6f : 0.3f) * FezMath.Saturate((float)(1.0 - (double)(instance.Center - this.PlayerManager.Center).Length() / 15.0));
                        if (CamShake.CurrentCamShake == null)
                        {
                            ServiceHelper.AddComponent((IGameComponent) new CamShake(this.Game)
                            {
                                Duration = TimeSpan.FromSeconds(0.75),
                                Distance = num1
                            });
                        }
                        else
                        {
                            CamShake.CurrentCamShake.Reset();
                        }
                        this.ParticleSystemManager.PropagateEnergy(instance.Center, flag3 ? 6f : 3f);
                        this.flashesMesh.RemoveGroup(state.Flash);
                        state.Flash = (Group)null;
                        switch (instance.Trile.ActorSettings.Type)
                        {
                        case ActorType.BigBomb:
                            state.Explosion = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.bigBombAnimation)
                            {
                                ActorType = ActorType.Bomb
                            };
                            break;

                        case ActorType.TntBlock:
                        case ActorType.TntPickup:
                            state.Explosion = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.tntAnimation)
                            {
                                ActorType = ActorType.Bomb
                            };
                            break;

                        default:
                            state.Explosion = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, this.bombAnimation)
                            {
                                ActorType = ActorType.Bomb
                            };
                            break;
                        }
                        state.Explosion.Timing.Loop      = false;
                        state.Explosion.Billboard        = true;
                        state.Explosion.Fullbright       = true;
                        state.Explosion.OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)RandomHelper.Random.Next(0, 4) * 1.570796f);
                        state.Explosion.Timing.Restart();
                        this.LevelManager.AddPlane(state.Explosion);
                        state.Flare = new BackgroundPlane(this.LevelMaterializer.StaticPlanesMesh, (Texture)this.flare)
                        {
                            AlwaysOnTop         = true,
                            LightMap            = true,
                            AllowOverbrightness = true,
                            Billboard           = true
                        };
                        this.LevelManager.AddPlane(state.Flare);
                        state.Flare.Scale        = Vector3.One * (flag3 ? 3f : 1.5f);
                        state.Explosion.Position = state.Flare.Position = instance.Center + (RandomHelper.Centered(1.0 / 1000.0) - 0.5f) * FezMath.ForwardVector(this.CameraManager.Viewpoint);
                        float num2 = flag3 ? 3f : 1.5f;
                        float num3 = ((this.PlayerManager.Position - instance.Center) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint)).Length();
                        if ((this.PlayerManager.CarriedInstance == instance || (double)num3 < (double)num2) && this.PlayerManager.Action != ActionType.Dying)
                        {
                            this.PlayerManager.Action = ActionType.Suffering;
                        }
                        if ((instance.Trile.ActorSettings.Type == ActorType.TntBlock || state.IsChainsploding) && instance.InstanceId != -1)
                        {
                            this.ParticleSystemManager.Add(new TrixelParticleSystem(this.Game, new TrixelParticleSystem.Settings()
                            {
                                ExplodingInstance = instance,
                                EnergySource      = new Vector3?(instance.Center),
                                MaximumSize       = 7,
                                Energy            = flag4 ? 3f : 1.5f,
                                Darken            = true,
                                ParticleCount     = 4 + 12 / Math.Max(1, this.TrixelParticleSystems.Count - 3)
                            }));
                        }
                        if (ActorTypeExtensions.IsPickable(instance.Trile.ActorSettings.Type))
                        {
                            instance.Enabled = false;
                            this.LevelMaterializer.GetTrileMaterializer(instance.Trile).UpdateInstance(instance);
                        }
                        else
                        {
                            this.ClearDestructible(instance, false);
                        }
                        this.DropSupportedTriles(instance);
                        this.DestroyNeighborhood(instance, state);
                    }
                    if (state.Explosion != null)
                    {
                        state.Flare.Filter = Color.Lerp(flag4 ? new Color(0.5f, 1f, 0.25f) : new Color(1f, 0.5f, 0.25f), Color.Black, state.Explosion.Timing.NormalizedStep);
                        if (state.Explosion.Timing.Ended)
                        {
                            this.bsToRemove.Add(instance);
                            if (instance.PhysicsState != null)
                            {
                                instance.PhysicsState.ShouldRespawn = ActorTypeExtensions.IsPickable(instance.Trile.ActorSettings.Type);
                            }
                            this.LevelManager.RemovePlane(state.Explosion);
                            this.LevelManager.RemovePlane(state.Flare);
                        }
                    }
                }
            }
            foreach (TrileInstance key in this.bsToRemove)
            {
                this.bombStates.Remove(key);
            }
            this.bsToRemove.Clear();
            foreach (KeyValuePair <TrileInstance, BombsHost.BombState> keyValuePair in this.bsToAdd)
            {
                if (!this.bombStates.ContainsKey(keyValuePair.Key))
                {
                    this.bombStates.Add(keyValuePair.Key, keyValuePair.Value);
                }
            }
            this.bsToAdd.Clear();
        }
Ejemplo n.º 25
0
        public PhysicsManager.WallHuggingResult HugWalls(IPhysicsEntity entity, bool determineBackground, bool postRotation, bool keepInFront)
        {
            Vector3 vector3_1 = FezMath.ForwardVector(this.CameraManager.Viewpoint);

            if (!entity.Background)
            {
                vector3_1 = -vector3_1;
            }
            float num1 = 1.0 / 500.0;

            if (entity is ISimplePhysicsEntity)
            {
                num1 = 1.0 / 16.0;
            }
            PhysicsManager.WallHuggingResult wallHuggingResult = new PhysicsManager.WallHuggingResult();
            Vector3 vector3_2 = new Vector3();

            if (entity.Background && entity.Grounded)
            {
                return(wallHuggingResult);
            }
            foreach (PointCollision pointCollision in entity.CornerCollision)
            {
                TrileInstance trileInstance1 = (TrileInstance)null;
                if (this.IsHuggable(pointCollision.Instances.Surface, entity))
                {
                    FaceOrientation  face           = FaceOrientation.Down;
                    TrileEmplacement traversal      = pointCollision.Instances.Surface.Emplacement.GetTraversal(ref face);
                    TrileInstance    trileInstance2 = this.LevelManager.TrileInstanceAt(ref traversal);
                    if (trileInstance2 != null && trileInstance2.Enabled && trileInstance2.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None)
                    {
                        trileInstance1 = pointCollision.Instances.Surface;
                    }
                }
                if (trileInstance1 == null && this.IsHuggable(pointCollision.Instances.Deep, entity))
                {
                    trileInstance1 = pointCollision.Instances.Deep;
                }
                if (trileInstance1 != null && (!(entity is ISimplePhysicsEntity) || trileInstance1.PhysicsState == null || !trileInstance1.PhysicsState.Puppet) && trileInstance1.PhysicsState != entity)
                {
                    Vector3 vector3_3 = trileInstance1.Center + vector3_1 * trileInstance1.TransformedSize / 2f;
                    Vector3 vector1   = entity.Center - vector3_1 * entity.Size / 2f - vector3_3 + num1 * -vector3_1;
                    float   x         = Vector3.Dot(vector1, vector3_1);
                    if ((double)FezMath.AlmostClamp(x) < 0.0)
                    {
                        if (determineBackground && (!trileInstance1.Trile.Thin || trileInstance1.Trile.ForceHugging))
                        {
                            float num2 = Math.Abs(FezMath.Dot(trileInstance1.TransformedSize / 2f + entity.Size / 2f, vector3_1));
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            PhysicsManager.WallHuggingResult& local = @wallHuggingResult;
                            // ISSUE: explicit reference operation
                            int num3 = (^ local).Behind | (double)Math.Abs(x) > (double)num2 ? 1 : 0;
                            // ISSUE: explicit reference operation
                            (^ local).Behind = num3 != 0;
                        }
                        else if (keepInFront)
                        {
                            Vector3 vector3_4 = vector1 * FezMath.Abs(vector3_1);
                            vector3_2               -= vector3_4;
                            entity.Center           -= vector3_4;
                            wallHuggingResult.Hugged = true;
                        }
                    }
                }
                if (postRotation)
                {
                    Vector3       vector3_3 = FezMath.AsVector(FezMath.VisibleOrientation(this.CameraManager.LastViewpoint));
                    TrileInstance instance  = this.LevelManager.ActualInstanceAt(pointCollision.Point + vector3_2);
                    if (this.IsHuggable(instance, entity))
                    {
                        Vector3 vector3_4 = instance.Center + vector3_3 * FezMath.ZYX(instance.TransformedSize) / 2f;
                        Vector3 vector1   = entity.Center - vector3_3 * entity.Size / 2f - vector3_4 + 1.0 / 500.0 * vector3_3;
                        float   x         = Vector3.Dot(vector1, vector3_3);
                        if ((double)FezMath.AlmostClamp(x) < 0.0 && (double)x > -1.0 && keepInFront)
                        {
                            Vector3 vector3_5 = vector1 * FezMath.Abs(vector3_3);
                            vector3_2               -= vector3_5;
                            entity.Center           -= vector3_5;
                            wallHuggingResult.Hugged = true;
                        }
                    }
                }
            }
            return(wallHuggingResult);
        }
Ejemplo n.º 26
0
 private void TryInitialize()
 {
     this.Enabled   = false;
     this.ArtObject = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x =>
     {
         if (x.ArtObject.ActorType == ActorType.QrCode)
         {
             return(x.ActorSettings.VibrationPattern != null);
         }
         else
         {
             return(false);
         }
     }));
     if (this.ArtObject != null)
     {
         this.Enabled = true;
         if (this.GameService.IsSewerQrResolved)
         {
             if (this.ArtObject.ActorSettings.AttachedGroup.HasValue)
             {
                 int key = this.ArtObject.ActorSettings.AttachedGroup.Value;
                 foreach (TrileInstance instance in this.LevelManager.Groups[this.ArtObject.ActorSettings.AttachedGroup.Value].Triles.ToArray())
                 {
                     this.LevelManager.ClearTrile(instance);
                 }
                 this.LevelManager.Groups.Remove(key);
             }
             this.LevelManager.Volumes[1].Enabled = false;
             this.LevelManager.ArtObjects.Remove(this.ArtObject.Id);
             this.ArtObject.Dispose();
             this.LevelMaterializer.RegisterSatellites();
             Vector3 position1 = this.ArtObject.Position;
             if (this.GameState.SaveData.ThisLevel.ScriptingState == "NOT_COLLECTED")
             {
                 Trile trile = Enumerable.FirstOrDefault <Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube));
                 if (trile != null)
                 {
                     Vector3 position2 = position1 - Vector3.One / 2f;
                     this.LevelManager.ClearTrile(new TrileEmplacement(position2));
                     TrileInstance toAdd;
                     this.LevelManager.RestoreTrile(toAdd = new TrileInstance(position2, trile.Id)
                     {
                         OriginalEmplacement = new TrileEmplacement(position2)
                     });
                     this.GomezService.CollectedAnti += (Action)(() => this.GameState.SaveData.ThisLevel.ScriptingState = (string)null);
                     if (toAdd.InstanceId == -1)
                     {
                         this.LevelMaterializer.CullInstanceIn(toAdd);
                     }
                 }
             }
             this.Enabled = false;
         }
     }
     if (!this.Enabled)
     {
         return;
     }
     this.ArtObject.ActorSettings.VibrationPattern = Util.JoinArrays <VibrationMotor>(this.ArtObject.ActorSettings.VibrationPattern, new VibrationMotor[3]);
 }
Ejemplo n.º 27
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;
        }
Ejemplo n.º 28
0
        protected override bool Act(TimeSpan elapsed)
        {
            float num1  = FezMath.Saturate(Math.Abs(3f / (float)this.PlayerManager.Animation.Timing.EndFrame - this.PlayerManager.Animation.Timing.Step)) * 2f;
            int   frame = this.PlayerManager.Animation.Timing.Frame;

            if (this.lastFrame != frame)
            {
                if (frame == 2)
                {
                    SoundEffectExtensions.EmitAt(this.shimmySound, this.PlayerManager.Position);
                }
                this.lastFrame = frame;
            }
            TrileInstance heldInstance = this.PlayerManager.HeldInstance;

            this.PlayerManager.HeldInstance = this.PlayerManager.AxisCollision[VerticalDirection.Down].Deep;
            bool    flag1 = this.PlayerManager.HeldInstance == null;
            Vector3 b     = FezMath.ForwardVector(this.CameraManager.Viewpoint) * (this.PlayerManager.Background ? -1f : 1f);
            bool    flag2 = this.PlayerManager.HeldInstance != null && this.PlayerManager.HeldInstance.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) == CollisionType.None;

            if (flag1 || flag2 && (double)FezMath.Dot(this.PlayerManager.HeldInstance.Position, b) > (double)FezMath.Dot(heldInstance.Position, b))
            {
                this.PlayerManager.Action           = ActionTypeExtensions.FacesBack(this.PlayerManager.Action) ? ActionType.ToCornerBack : ActionType.ToCornerFront;
                this.PlayerManager.HeldInstance     = heldInstance;
                this.PlayerManager.LookingDirection = FezMath.GetOpposite(this.PlayerManager.LookingDirection);
                return(false);
            }
            else if (flag2)
            {
                this.PlayerManager.Action       = ActionType.Dropping;
                this.PlayerManager.HeldInstance = (TrileInstance)null;
                return(false);
            }
            else
            {
                float num2 = (float)((double)this.InputManager.Movement.X * 4.69999980926514 * 0.150000005960464) * (float)elapsed.TotalSeconds;
                if (this.PlayerManager.Action != ActionType.ShimmyBack && this.PlayerManager.Action != ActionType.ShimmyFront)
                {
                    num2 *= 0.6f;
                }
                this.PlayerManager.Velocity = num2 * FezMath.RightVector(this.CameraManager.Viewpoint) * (1f + num1);
                if ((double)this.InputManager.Movement.X == 0.0)
                {
                    this.PlayerManager.Action = ActionTypeExtensions.FacesBack(this.PlayerManager.Action) ? ActionType.GrabLedgeBack : ActionType.GrabLedgeFront;
                }
                else
                {
                    this.PlayerManager.GroundedVelocity = new Vector3?(this.PlayerManager.Velocity);
                }
                if (this.InputManager.RotateLeft == FezButtonState.Pressed || this.InputManager.RotateRight == FezButtonState.Pressed)
                {
                    this.PlayerManager.Action = ActionTypeExtensions.FacesBack(this.PlayerManager.Action) ? ActionType.GrabLedgeBack : ActionType.GrabLedgeFront;
                }
                if (this.PlayerManager.Action == ActionType.ShimmyBack || this.PlayerManager.Action == ActionType.ShimmyFront)
                {
                    this.PlayerManager.Animation.Timing.Update(elapsed, Math.Abs(this.InputManager.Movement.X));
                    if (this.PlayerManager.HeldInstance.PhysicsState != null)
                    {
                        this.PlayerManager.Position += this.PlayerManager.HeldInstance.PhysicsState.Velocity;
                    }
                }
                Vector3 vector3 = FezMath.DepthMask(this.CameraManager.Viewpoint);
                this.PlayerManager.Position = this.PlayerManager.Position * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint) + this.PlayerManager.HeldInstance.Center * vector3 + b * -(this.PlayerManager.HeldInstance.TransformedSize / 2f + this.PlayerManager.Size.X * vector3 / 4f);
                this.PhysicsManager.HugWalls((IPhysicsEntity)this.PlayerManager, false, false, true);
                return(false);
            }
        }
Ejemplo n.º 29
0
 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;
         }
     }
 }
Ejemplo n.º 30
0
            public void Update(float elapsedSeconds)
            {
                if (!this.Enabled && this.Action == SpinAction.Idle)
                {
                    return;
                }
                this.SinceChanged += elapsedSeconds;
                float spinFrequency = this.Group.SpinFrequency;

                switch (this.Action)
                {
                case SpinAction.Idle:
                    if ((double)this.SinceChanged < (double)spinFrequency)
                    {
                        break;
                    }
                    this.SinceChanged -= spinFrequency;
                    this.Rotate(this.Group.SpinClockwise, this.Group.Spin180Degrees ? 2 : 1);
                    break;

                case SpinAction.Spinning:
                    float      num1           = Easing.EaseInOut((double)FezMath.Saturate(FezMath.Saturate(this.SinceChanged / (0.75f * (float)this.Turns)) / 0.75f), EasingType.Quartic, EasingType.Quadratic);
                    float      angle          = num1 * 1.570796f * (float)this.SpinSign * (float)this.Turns;
                    Matrix     fromAxisAngle1 = Matrix.CreateFromAxisAngle(Vector3.UnitY, angle);
                    Quaternion fromAxisAngle2 = Quaternion.CreateFromAxisAngle(Vector3.UnitY, angle);
                    if (!this.PlayerManager.IsOnRotato && (double)num1 < 0.5)
                    {
                        RotatingGroupsHost.RotatingGroupState rotatingGroupState1 = this;
                        int num2 = rotatingGroupState1.HeldOnto | this.Group.Triles.Contains(this.PlayerManager.HeldInstance) ? 1 : 0;
                        rotatingGroupState1.HeldOnto = num2 != 0;
                        RotatingGroupsHost.RotatingGroupState rotatingGroupState2 = this;
                        int num3 = (rotatingGroupState2.GroundedOn ? 1 : 0) | (!this.PlayerManager.Grounded ? 0 : (this.TopLayer.Contains(this.PlayerManager.Ground.First) ? 1 : 0));
                        rotatingGroupState2.GroundedOn = num3 != 0;
                        if (this.GroundedOn || this.HeldOnto)
                        {
                            this.OriginalPlayerPosition   = this.PlayerManager.Position;
                            this.PlayerManager.IsOnRotato = true;
                        }
                    }
                    if ((this.GroundedOn || this.HeldOnto) && ((double)num1 > 0.100000001490116 && !this.CameraManager.ForceTransition))
                    {
                        if (this.HeldOnto && this.Group.FallOnRotate)
                        {
                            this.PlayerManager.Action       = ActionType.Idle;
                            this.PlayerManager.HeldInstance = (TrileInstance)null;
                            this.PlayerManager.IsOnRotato   = false;
                            this.HeldOnto = false;
                        }
                        else
                        {
                            this.CameraManager.ForceTransition = true;
                            this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.SpinSign * this.Turns), -1f);
                            this.CameraManager.Direction = -FezMath.ForwardVector(this.CameraManager.LastViewpoint);
                            this.CameraManager.RebuildView();
                        }
                    }
                    Vector3 vector3_1 = new Vector3(this.Center.X - 0.5f, this.Center.Y - 0.5f, this.Center.Z - 0.5f);
                    for (int index = 0; index < this.OriginalStates.Length; ++index)
                    {
                        TrileInstance instance  = this.Group.Triles[index];
                        Vector4       vector4   = this.OriginalStates[index];
                        Vector3       vector3_2 = Vector3.Transform(new Vector3(vector4.X, vector4.Y, vector4.Z), fromAxisAngle1);
                        instance.Position = new Vector3(vector3_2.X + vector3_1.X, vector3_2.Y + vector3_1.Y, vector3_2.Z + vector3_1.Z);
                        instance.SetPhiLight(vector4.W + angle);
                        this.CachedMaterializers[index].UpdateInstance(instance);
                    }
                    for (int index = 0; index < this.AttachedArtObjects.Length; ++index)
                    {
                        this.AttachedArtObjects[index].Rotation = this.AttachedAoRotations[index] * fromAxisAngle2;
                        this.AttachedArtObjects[index].Position = Vector3.Transform(this.AttachedAoOrigins[index] - this.Center, fromAxisAngle1) + this.Center;
                    }
                    if (this.GroundedOn || this.HeldOnto)
                    {
                        Vector3 position  = this.PlayerManager.Position;
                        Vector3 vector3_2 = Vector3.Transform(this.OriginalPlayerPosition - this.Center, fromAxisAngle1) + this.Center;
                        if (!this.HeldOnto || !this.Group.FallOnRotate)
                        {
                            this.CameraManager.Center   += vector3_2 - position;
                            this.CameraManager.Direction = Vector3.Transform(-this.OriginalForward, fromAxisAngle1);
                        }
                        this.PlayerManager.Position += vector3_2 - position;
                    }
                    if ((double)this.SinceChanged < 0.75 * (double)this.Turns)
                    {
                        break;
                    }
                    if (this.GroundedOn || this.HeldOnto)
                    {
                        this.PlayerManager.IsOnRotato = false;
                        this.RotateTriles();
                        this.CameraManager.ForceTransition = false;
                        this.PlayerManager.ForceOverlapsDetermination();
                    }
                    else
                    {
                        this.RotateTriles();
                    }
                    this.SinceChanged -= 0.75f;
                    this.Action        = SpinAction.Idle;
                    break;
                }
            }