Exemplo n.º 1
0
        protected override bool Act(TimeSpan elapsed)
        {
            if (this.PlayerManager.Action != ActionType.LowerToCornerLedge)
            {
                return(false);
            }
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
            float   num       = (float)(4.0 * (this.LevelManager.Descending ? -1.0 : 1.0)) / this.CameraManager.PixelsPerTrixel;
            Vector3 vector3_2 = this.PlayerManager.HeldInstance.Center + (vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f + num * Vector3.UnitY;

            if (!this.CameraManager.StickyCam && !this.CameraManager.Constrained)
            {
                this.CameraManager.Center = Vector3.Lerp(this.camOrigin, vector3_2, this.PlayerManager.Animation.Timing.NormalizedStep);
            }
            this.PlayerManager.Position = this.PlayerManager.HeldInstance.Center + (vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f;
            this.PlayerManager.SplitUpCubeCollectorOffset = (this.playerOrigin - this.PlayerManager.Position) * (1f - this.PlayerManager.Animation.Timing.NormalizedStep);
            if (this.PlayerManager.Animation.Timing.Ended)
            {
                this.PlayerManager.LookingDirection           = FezMath.GetOpposite(this.PlayerManager.LookingDirection);
                this.PlayerManager.SplitUpCubeCollectorOffset = Vector3.Zero;
                this.PlayerManager.Action = ActionType.GrabCornerLedge;
            }
            this.PlayerManager.Animation.Timing.Update(elapsed, 1.25f);
            return(false);
        }
Exemplo n.º 2
0
        protected override bool Act(TimeSpan elapsed)
        {
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
            float   num       = (float)(4.0 * (this.LevelManager.Descending ? -1.0 : 1.0)) / this.CameraManager.PixelsPerTrixel;
            Vector3 vector3_2 = this.PlayerManager.HeldInstance.Center + (-vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f + this.gomezDelta + num * Vector3.UnitY;

            if (!this.CameraManager.StickyCam && !this.CameraManager.Constrained)
            {
                this.CameraManager.Center = Vector3.Lerp(this.camOrigin, vector3_2, this.PlayerManager.Animation.Timing.NormalizedStep);
            }
            this.PlayerManager.SplitUpCubeCollectorOffset = this.gomezDelta * this.PlayerManager.Animation.Timing.NormalizedStep;
            this.PlayerManager.Position = this.PlayerManager.HeldInstance.Center + (-vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f;
            if (this.PlayerManager.Animation.Timing.Ended)
            {
                this.PlayerManager.Position    += this.gomezDelta;
                this.PlayerManager.HeldInstance = (TrileInstance)null;
                this.PlayerManager.SplitUpCubeCollectorOffset = Vector3.Zero;
                this.PhysicsManager.DetermineInBackground((IPhysicsEntity)this.PlayerManager, !this.PlayerManager.IsOnRotato, true, !this.PlayerManager.Climbing);
                this.PlayerManager.Position += 0.5f * Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
                IPlayerManager playerManager = this.PlayerManager;
                Vector3        vector3_3     = playerManager.Velocity - Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor);
                playerManager.Velocity = vector3_3;
                this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
                this.PlayerManager.Action = ActionType.Idle;
            }
            return(true);
        }
Exemplo n.º 3
0
        private void DoJump()
        {
            bool flag = ActionTypeExtensions.IsClimbingLadder(this.PlayerManager.LastAction) || ActionTypeExtensions.IsClimbingVine(this.PlayerManager.LastAction) || this.PlayerManager.HeldInstance != null;

            if (flag)
            {
                IPlayerManager playerManager = this.PlayerManager;
                Vector3        vector3       = playerManager.Velocity + FezMath.RightVector(this.CameraManager.Viewpoint) * this.InputManager.Movement.X * 0.25f;
                playerManager.Velocity = vector3;
            }
            this.PlayerManager.HeldInstance = (TrileInstance)null;
            if (this.scheduleJump || this.InputManager.Jump == FezButtonState.Pressed)
            {
                SoundEffectExtensions.EmitAt(this.jumpSound, this.PlayerManager.Position);
            }
            float          gravityFactor  = this.CollisionManager.GravityFactor;
            float          num            = (float)((1.32500004768372 + (double)Math.Abs(gravityFactor) * 0.675000011920929) / 2.0) * (float)Math.Sign(gravityFactor);
            IPlayerManager playerManager1 = this.PlayerManager;
            Vector3        vector3_1      = playerManager1.Velocity * FezMath.XZMask;

            playerManager1.Velocity = vector3_1;
            Vector3        vector3_2      = (float)(0.150000005960464 * (double)num * 1.02499997615814 * (flag || this.PlayerManager.Swimming ? 0.774999976158142 : 1.0)) * Vector3.UnitY;
            IPlayerManager playerManager2 = this.PlayerManager;
            Vector3        vector3_3      = playerManager2.Velocity + vector3_2;

            playerManager2.Velocity = vector3_3;
            this.sinceJumped        = TimeSpan.Zero;
            this.GomezService.OnJump();
        }
Exemplo n.º 4
0
        protected override bool Act(TimeSpan elapsed)
        {
            if (this.PlayerManager.HeldInstance.PhysicsState != null)
            {
                this.PlayerManager.Velocity = this.PlayerManager.HeldInstance.PhysicsState.Velocity;
                this.camOrigin += this.PlayerManager.HeldInstance.PhysicsState.Velocity;
            }
            Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection) * 10f / 16f;

            if (this.lastFrame != this.PlayerManager.Animation.Timing.Frame && this.PlayerManager.Animation.Timing.Frame == 5)
            {
                SoundEffectExtensions.EmitAt(this.sLedgeLand, this.PlayerManager.Position);
            }
            this.lastFrame = this.PlayerManager.Animation.Timing.Frame;
            if (!this.CameraManager.StickyCam)
            {
                Vector3 constrainedCenter = this.CameraManager.ConstrainedCenter;
            }
            if (this.PlayerManager.Animation.Timing.Ended)
            {
                this.PlayerManager.HeldInstance = (TrileInstance)null;
                this.PlayerManager.Action       = ActionType.Idle;
                this.PlayerManager.Position    += vector3;
                Vector3 position = this.PlayerManager.Position;
                this.PlayerManager.Position += 0.5f * Vector3.UnitY;
                this.PlayerManager.Velocity  = Vector3.Down;
                this.PhysicsManager.Update((IComplexPhysicsEntity)this.PlayerManager);
                if (!this.PlayerManager.Grounded)
                {
                    this.PlayerManager.Velocity = Vector3.Zero;
                    this.PlayerManager.Position = position;
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 protected override void Begin()
 {
     base.Begin();
     this.PlayerManager.Velocity         = Vector3.Zero;
     this.PlayerManager.GroundedVelocity = new Vector3?(FezMath.RightVector(this.CameraManager.Viewpoint) * 0.085f + Vector3.UnitY * 0.15f * (float)Math.Sign(this.CollisionManager.GravityFactor));
     this.InputManager.PressedToDown();
     this.GomezService.OnGrabLedge();
 }
Exemplo n.º 6
0
        protected override bool Act(TimeSpan elapsed)
        {
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);

            this.PlayerManager.Animation.Timing.Update(elapsed);
            if (this.PlayerManager.CarriedInstance != null)
            {
                if (this.PlayerManager.CarriedInstance.PhysicsState == null)
                {
                    this.PlayerManager.CarriedInstance = (TrileInstance)null;
                }
                bool      flag         = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type);
                Vector2[] vector2Array = flag ? Throw.LightOffsets : Throw.HeavyOffsets;
                if (!flag)
                {
                    IPlayerManager playerManager = this.PlayerManager;
                    Vector3        vector3_2     = playerManager.Velocity * Vector3.UnitY;
                    playerManager.Velocity = vector3_2;
                }
                if (this.PlayerManager.Animation.Timing.Frame < vector2Array.Length)
                {
                    int           frame           = this.PlayerManager.Animation.Timing.Frame;
                    TrileInstance carriedInstance = this.PlayerManager.CarriedInstance;
                    Vector2       vector2         = vector2Array[frame];
                    Vector3       vector3_2       = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down + vector3_1) - carriedInstance.TransformedSize / 2f * vector3_1 + carriedInstance.Trile.Size / 2f * (Vector3.UnitY + vector3_1) - vector3_1 * 8f / 16f + Vector3.UnitY * 9f / 16f;
                    if (flag)
                    {
                        vector3_2 += vector3_1 * 1f / 16f + Vector3.UnitY * 2f / 16f;
                    }
                    Vector3 vector3_3 = vector3_2 + (vector2.X * vector3_1 + vector2.Y * Vector3.Up) * (1.0 / 16.0);
                    Vector3 vector3_4 = vector3_3 - carriedInstance.Center;
                    carriedInstance.PhysicsState.Velocity        = vector3_4;
                    carriedInstance.PhysicsState.UpdatingPhysics = true;
                    this.PhysicsManager.Update((ISimplePhysicsEntity)carriedInstance.PhysicsState, false, false);
                    carriedInstance.PhysicsState.UpdatingPhysics = false;
                    carriedInstance.PhysicsState.UpdateInstance();
                    carriedInstance.PhysicsState.Velocity = Vector3.Zero;
                    IPlayerManager playerManager = this.PlayerManager;
                    Vector3        vector3_5     = playerManager.Velocity - vector3_3 - carriedInstance.Center;
                    playerManager.Velocity = vector3_5;
                }
                else if (!this.thrown)
                {
                    this.thrown = true;
                    this.PlayerManager.CarriedInstance.Phi = FezMath.SnapPhi(this.PlayerManager.CarriedInstance.Phi);
                    this.PlayerManager.CarriedInstance.PhysicsState.Background = false;
                    this.PlayerManager.CarriedInstance.PhysicsState.Velocity   = this.PlayerManager.Velocity * 0.5f + ((float)FezMath.Sign(this.PlayerManager.LookingDirection) * FezMath.RightVector(this.CameraManager.Viewpoint) + Vector3.Up) * 0.08f;
                    this.PlayerManager.CarriedInstance = (TrileInstance)null;
                }
            }
            if (this.PlayerManager.Animation.Timing.Ended)
            {
                this.thrown = false;
                this.PlayerManager.SyncCollisionSize();
                this.PlayerManager.Action = ActionType.Idle;
            }
            return(false);
        }
Exemplo n.º 7
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (this.PlayerManager.CarriedInstance == null)
     {
         this.PlayerManager.Action = ActionType.Idle;
         return(false);
     }
     else
     {
         Vector3       vector3_1       = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
         TrileInstance carriedInstance = this.PlayerManager.CarriedInstance;
         Vector3       vector3_2       = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down + vector3_1) - carriedInstance.TransformedSize / 2f * vector3_1 + carriedInstance.Trile.Size / 2f * (Vector3.UnitY + vector3_1) + 0.125f * vector3_1;
         bool          flag            = ActorTypeExtensions.IsLight(carriedInstance.Trile.ActorSettings.Type);
         Vector2[]     vector2Array    = flag ? Lift.LightTrilePositioning : Lift.HeavyTrilePositioning;
         int           index           = (flag ? 4 : 7) - this.PlayerManager.Animation.Timing.Frame;
         Vector3       vector3_3       = vector3_2 + (vector2Array[index].X * -vector3_1 + vector2Array[index].Y * Vector3.Up) * 1f / 16f;
         carriedInstance.PhysicsState.Center = vector3_3;
         carriedInstance.PhysicsState.UpdateInstance();
         this.PlayerManager.Position -= vector3_3 - carriedInstance.Center;
         this.PlayerManager.CarriedInstance.PhysicsState.UpdateInstance();
         if (this.PlayerManager.Animation.Timing.Ended)
         {
             Vector3 impulse = (float)(3.15000009536743 * (double)Math.Sign(this.CollisionManager.GravityFactor) * 0.150000005960464) * (float)elapsed.TotalSeconds * Vector3.Down;
             if ((double)this.PlayerManager.GroundMovement.Y < 0.0)
             {
                 impulse += this.PlayerManager.GroundMovement;
             }
             MultipleHits <CollisionResult> result = this.CollisionManager.CollideEdge(carriedInstance.PhysicsState.Center, impulse, carriedInstance.TransformedSize / 2f, Direction2D.Vertical);
             if (BoxCollisionResultExtensions.AnyCollided(result))
             {
                 carriedInstance.PhysicsState.Ground = new MultipleHits <TrileInstance>()
                 {
                     NearLow = result.NearLow.Collided ? result.NearLow.Destination : (TrileInstance)null,
                     FarHigh = result.FarHigh.Collided ? result.FarHigh.Destination : (TrileInstance)null
                 };
                 if (carriedInstance.PhysicsState.Ground.First.PhysicsState != null)
                 {
                     carriedInstance.PhysicsState.GroundMovement = carriedInstance.PhysicsState.Ground.First.PhysicsState.Velocity;
                     carriedInstance.PhysicsState.Center        += carriedInstance.PhysicsState.GroundMovement;
                 }
             }
             carriedInstance.PhysicsState.Velocity = impulse;
             carriedInstance.PhysicsState.UpdateInstance();
             if (flag)
             {
                 this.PlayerManager.Action = ActionType.Idle;
             }
             else
             {
                 this.PlayerManager.PushedInstance = this.PlayerManager.CarriedInstance;
                 this.PlayerManager.Action         = ActionType.Grabbing;
             }
             this.PlayerManager.CarriedInstance = (TrileInstance)null;
             this.PhysicsManager.HugWalls((IPhysicsEntity)this.PlayerManager, false, false, true);
         }
         return(true);
     }
 }
Exemplo n.º 8
0
        private void AlignMesh(Viewpoint viewpoint)
        {
            float   num = this.CameraManager.Radius / SettingsManager.GetViewScale(this.GraphicsDevice);
            Vector3 interpolatedCenter = this.CameraManager.InterpolatedCenter;
            Vector3 vector1            = FezMath.ForwardVector(viewpoint);
            Vector3 vector2            = FezMath.RightVector(viewpoint);

            this.Meshes[viewpoint].Position = new Vector3(0.0f, interpolatedCenter.Y + num / 2f / this.CameraManager.AspectRatio, 0.0f) + interpolatedCenter * FezMath.Abs(vector2) + this.LevelManager.Size / 2f * FezMath.Abs(vector1) + num * vector1;
        }
Exemplo n.º 9
0
        private Vector3 GetDestination()
        {
            TrileInstance pushedInstance = this.PlayerManager.PushedInstance;
            Vector3       vector         = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
            Vector3       vector3_1      = FezMath.Abs(vector);
            Vector3       vector3_2      = FezMath.DepthMask(this.CameraManager.Viewpoint);

            return((pushedInstance.Center * vector3_1 + this.PlayerManager.Position * vector3_2) * FezMath.XZMask + -pushedInstance.TransformedSize / 2f * vector + -7.0 / 16.0 * vector + this.PlayerManager.Position * Vector3.UnitY);
        }
Exemplo n.º 10
0
 protected override void Begin()
 {
     base.Begin();
     if (this.GameState.IsTrialMode && this.PlayerManager.DoorEndsTrial)
     {
         this.GameService.EndTrial(false);
         this.PlayerManager.Action = ActionType.ExitDoor;
         this.PlayerManager.Action = ActionType.Idle;
     }
     else if (!this.PlayerManager.DoorVolume.HasValue || !this.LevelManager.Volumes.ContainsKey(this.PlayerManager.DoorVolume.Value))
     {
         this.PlayerManager.Action = ActionType.Idle;
     }
     else
     {
         if (!this.PlayerManager.SpinThroughDoor)
         {
             SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
         }
         this.hasFlipped = this.hasChangedLevel = false;
         this.newLevel   = this.PlayerManager.NextLevel;
         this.step       = 0.0f;
         this.PlayerManager.InDoorTransition = true;
         this.transitionTime = new TimeSpan();
         IPlayerManager playerManager = this.PlayerManager;
         Vector3        vector3_1     = playerManager.Velocity * Vector3.UnitY;
         playerManager.Velocity = vector3_1;
         if (this.PlayerManager.SpinThroughDoor)
         {
             this.CameraManager.ChangeViewpoint(FezMath.GetRotatedView(this.CameraManager.Viewpoint, 1), 2f);
             this.PlayerManager.LookingDirection = HorizontalDirection.Right;
         }
         if (this.LevelManager.DestinationIsFarAway)
         {
             Vector3 center = this.CameraManager.Center;
             float   num    = (float)(4.0 * (this.LevelManager.Descending ? -1.0 : 1.0)) / this.CameraManager.PixelsPerTrixel;
             this.CameraManager.StickyCam   = false;
             this.CameraManager.Constrained = true;
             Volume  volume  = this.LevelManager.Volumes[this.PlayerManager.DoorVolume.Value];
             Vector2 vector2 = volume.ActorSettings == null ? Vector2.Zero : volume.ActorSettings.FarawayPlaneOffset;
             if (volume.ActorSettings != null && volume.ActorSettings.WaterLocked)
             {
                 vector2.Y = volume.ActorSettings.WaterOffset / 2f;
             }
             if (volume.ActorSettings != null)
             {
                 this.GameState.FarawaySettings.DestinationOffset = volume.ActorSettings.DestinationOffset;
             }
             Vector3 vector3_2         = FezMath.RightVector(this.CameraManager.Viewpoint) * vector2.X + Vector3.Up * vector2.Y;
             Vector3 destinationCenter = new Vector3(this.PlayerManager.Position.X, this.PlayerManager.Position.Y + num, this.PlayerManager.Position.Z) + vector3_2 * 2f;
             this.StartTransition(center, destinationCenter);
         }
         this.GomezService.OnEnterDoor();
     }
 }
Exemplo n.º 11
0
        private TrileInstance IsOnLadder(out ClimbingApproach approach)
        {
            Vector3       b              = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            Vector3       vector3        = FezMath.RightVector(this.CameraManager.Viewpoint);
            float         num1           = float.MaxValue;
            bool          flag1          = false;
            TrileInstance trileInstance1 = (TrileInstance)null;
            bool          flag2          = true;

            if (this.currentApproach == ClimbingApproach.None)
            {
                NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Center, this.PlayerManager.Background ? QueryOptions.Background : QueryOptions.None);
                flag2 = nearestTriles.Surface != null && nearestTriles.Surface.Trile.ActorSettings.Type == ActorType.Ladder;
            }
            foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values)
            {
                if (nearestTriles.Surface != null && this.TestLadderCollision(nearestTriles.Surface, true))
                {
                    TrileInstance trileInstance2 = nearestTriles.Surface;
                    float         num2           = FezMath.Dot(trileInstance2.Position, b);
                    if (flag2 && (double)num2 < (double)num1)
                    {
                        num1           = num2;
                        trileInstance1 = trileInstance2;
                    }
                }
            }
            if (trileInstance1 == null)
            {
                foreach (NearestTriles nearestTriles in this.PlayerManager.AxisCollision.Values)
                {
                    if (nearestTriles.Surface != null && this.TestLadderCollision(nearestTriles.Surface, false))
                    {
                        TrileInstance trileInstance2 = nearestTriles.Surface;
                        float         num2           = FezMath.Dot(trileInstance2.Position, b);
                        if (flag2 && (double)num2 < (double)num1)
                        {
                            flag1          = true;
                            num1           = num2;
                            trileInstance1 = trileInstance2;
                        }
                    }
                }
            }
            if (trileInstance1 != null)
            {
                float num2 = FezMath.Dot(FezMath.AsVector(FezMath.OrientationFromPhi(FezMath.WrapAngle(FezMath.ToPhi(trileInstance1.Trile.ActorSettings.Face) + trileInstance1.Phi))), flag1 ? vector3 : b);
                approach = !flag1 ? ((double)num2 > 0.0 ? ClimbingApproach.Front : ClimbingApproach.Back) : ((double)num2 > 0.0 ? ClimbingApproach.Left : ClimbingApproach.Right);
            }
            else
            {
                approach = ClimbingApproach.None;
            }
            return(trileInstance1);
        }
Exemplo n.º 12
0
        protected override void Begin()
        {
            base.Begin();
            SoundEffectExtensions.EmitAt(this.pullSound, this.PlayerManager.Position);
            Vector3 vector3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);

            this.camOrigin  = this.CameraManager.Center;
            this.gomezDelta = this.PlayerManager.Size * (vector3 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) / 2f;
            Waiters.Wait(0.579999983310699, (Action)(() => SoundEffectExtensions.EmitAt(this.landSound, this.PlayerManager.Position)));
            this.GomezService.OnHoist();
        }
Exemplo n.º 13
0
 public override void Initialize()
 {
     base.Initialize();
     this.GameState.InCutscene           = this.GameState.ForceTimePaused = false;
     this.PlayerManager.Action           = ActionType.SleepWake;
     this.PlayerManager.LookingDirection = HorizontalDirection.Left;
     this.PlayerManager.Position        += FezMath.RightVector(this.CameraManager.Viewpoint) * -3f / 16f;
     this.sZoomToHouse = this.CMProvider.Get(CM.Intro).Load <SoundEffect>("Sounds/Intro/ZoomToHouse");
     SoundEffectExtensions.Emit(this.sZoomToHouse);
     this.zoomRtHandle = this.TargetRenderingManager.TakeTarget();
     this.TargetRenderingManager.ScheduleHook(this.DrawOrder, this.zoomRtHandle.Target);
 }
Exemplo n.º 14
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Jumping:
     case ActionType.Falling:
         HorizontalDirection lookingDirection = this.PlayerManager.LookingDirection;
         if (lookingDirection == HorizontalDirection.None)
         {
             break;
         }
         Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
         Vector3 b         = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(lookingDirection);
         if ((double)FezMath.Dot(this.PlayerManager.Velocity, b) <= 0.025000000372529 && (double)(this.InputManager.Movement.X * (float)FezMath.Sign(lookingDirection)) <= 0.100000001490116)
         {
             break;
         }
         MultipleHits <CollisionResult> wallCollision = this.PlayerManager.WallCollision;
         FaceOrientation visibleOrientation           = this.CameraManager.VisibleOrientation;
         TrileInstance   trileInstance1 = wallCollision.NearLow.Destination ?? this.PlayerManager.CornerCollision[1 + (lookingDirection == HorizontalDirection.Left ? 2 : 0)].Instances.Deep;
         TrileInstance   trileInstance2 = wallCollision.FarHigh.Destination ?? this.PlayerManager.CornerCollision[lookingDirection == HorizontalDirection.Left ? 2 : 0].Instances.Deep;
         Trile           trile          = trileInstance1 == null ? (Trile)null : trileInstance1.Trile;
         if (trileInstance1 == null || trileInstance1.GetRotatedFace(visibleOrientation) == CollisionType.None || (trile.ActorSettings.Type == ActorType.Ladder || trileInstance1 == trileInstance2) || (trileInstance2 != null && trileInstance2.GetRotatedFace(visibleOrientation) == CollisionType.AllSides || !trileInstance1.Enabled))
         {
             break;
         }
         TrileInstance trileInstance3 = this.LevelManager.ActualInstanceAt(trileInstance1.Center - b);
         TrileInstance trileInstance4 = this.LevelManager.NearestTrile(trileInstance1.Center - b).Deep;
         if (trileInstance4 != null && trileInstance4.Enabled && trileInstance4.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None || trileInstance3 != null && trileInstance3.Enabled && !trileInstance3.Trile.Immaterial || this.PlayerManager.Action == ActionType.Jumping && (double)((trileInstance1.Center - this.PlayerManager.LeaveGroundPosition) * vector3_1).Length() < 1.25 || trileInstance1.GetRotatedFace(visibleOrientation) != CollisionType.AllSides && BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance1.Center, Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)))
         {
             break;
         }
         Vector3 vector3_2 = (-b + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * trileInstance1.TransformedSize / 2f;
         if ((double)(this.PlayerManager.Center * vector3_1 - trileInstance1.Center * vector3_1 + vector3_2).Length() >= 0.349999994039536)
         {
             break;
         }
         this.PlayerManager.HeldInstance = trileInstance1;
         this.PlayerManager.Action       = ActionType.GrabCornerLedge;
         Waiters.Wait(0.1, (Action)(() =>
         {
             if (this.PlayerManager.HeldInstance == null)
             {
                 return;
             }
             SoundEffectExtensions.EmitAt(this.sound, this.PlayerManager.Position);
             this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.LeftLow, 0.100000001490116, TimeSpan.FromSeconds(0.200000002980232));
             this.InputManager.ActiveGamepad.Vibrate(VibrationMotor.RightHigh, 0.400000005960464, TimeSpan.FromSeconds(0.200000002980232));
         }));
         break;
     }
 }
Exemplo n.º 15
0
 protected override void Begin()
 {
     this.PlayerManager.Velocity  = Vector3.Zero;
     this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection) * 1f / 16f;
     this.PlayerManager.Position -= Vector3.UnitY * 0.5f / 16f;
     this.PlayerManager.Position *= 16f;
     this.PlayerManager.Position  = FezMath.Round(this.PlayerManager.Position);
     this.PlayerManager.Position /= 16f;
     this.PlayerManager.Position -= Vector3.UnitY * 0.5f / 16f;
     this.camOrigin = this.CameraManager.Center;
     SoundEffectExtensions.EmitAt(this.climbOverSound, this.PlayerManager.Position);
     this.lastFrame = -1;
 }
Exemplo n.º 16
0
        private void SpawnDust(TrileInstance instance, float opacity, AnimatedTexture animation, bool onRight, bool onLeft)
        {
            float num1 = (float)((double)instance.Center.Y - (double)instance.TransformedSize.Y / 2.0 * (double)Math.Sign(this.CollisionManager.GravityFactor) + (double)animation.FrameHeight / 32.0 * (double)Math.Sign(this.CollisionManager.GravityFactor));
            float num2 = (float)((double)FezMath.Dot(instance.TransformedSize, FezMath.SideMask(this.CameraManager.Viewpoint)) / 2.0 + (double)animation.FrameWidth / 32.0 * 2.0 / 3.0);

            if (ActorTypeExtensions.IsBomb(instance.Trile.ActorSettings.Type))
            {
                num2 -= 0.25f;
            }
            opacity = 1f;
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint);
            Vector3 vector3_2 = FezMath.ForwardVector(this.CameraManager.Viewpoint);
            bool    b         = (double)this.CollisionManager.GravityFactor < 0.0;

            if (onRight)
            {
                BackgroundPlane backgroundPlane;
                this.LevelManager.AddPlane(backgroundPlane = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation)
                {
                    OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float)FezMath.AsNumeric(b) * 3.141593f),
                    Doublesided      = true,
                    Loop             = false,
                    Opacity          = opacity,
                    Timing           =
                    {
                        Step = 0.0f
                    }
                });
                backgroundPlane.Position  = instance.Center * FezMath.XZMask + vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2;
                backgroundPlane.Billboard = true;
            }
            if (!onLeft)
            {
                return;
            }
            BackgroundPlane backgroundPlane1;

            this.LevelManager.AddPlane(backgroundPlane1 = new BackgroundPlane(this.LevelMaterializer.AnimatedPlanesMesh, animation)
            {
                OriginalRotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 3.141593f) * Quaternion.CreateFromAxisAngle(Vector3.UnitX, (float)FezMath.AsNumeric(b) * 3.141593f),
                Doublesided      = true,
                Loop             = false,
                Opacity          = opacity,
                Timing           =
                {
                    Step = 0.0f
                }
            });
            backgroundPlane1.Position  = instance.Center * FezMath.XZMask - vector3_1 * num2 + num1 * Vector3.UnitY - vector3_2;
            backgroundPlane1.Billboard = true;
        }
Exemplo n.º 17
0
        private Vector3 GetDestination()
        {
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);

            if (this.PlayerManager.Action != ActionType.LowerToCornerLedge)
            {
                return(this.PlayerManager.HeldInstance.Center + (vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f + -5.0 / 16.0 * vector3_1);
            }
            this.playerOrigin = this.PlayerManager.Position;
            Vector3 vector3_2 = this.PlayerManager.HeldInstance.Center + (vector3_1 + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f;

            this.PlayerManager.SplitUpCubeCollectorOffset = this.playerOrigin - vector3_2;
            return(vector3_2);
        }
Exemplo n.º 18
0
        protected override void Begin()
        {
            base.Begin();
            if (ActionTypeExtensions.IsClimbingLadder(this.PlayerManager.LastAction))
            {
                SoundEffectExtensions.EmitAt(this.dropLadderSound, this.PlayerManager.Position);
            }
            else if (ActionTypeExtensions.IsClimbingVine(this.PlayerManager.LastAction))
            {
                SoundEffectExtensions.EmitAt(this.dropVineSound, this.PlayerManager.Position);
            }
            else if (ActionTypeExtensions.IsOnLedge(this.PlayerManager.LastAction))
            {
                SoundEffectExtensions.EmitAt(this.dropLedgeSound, this.PlayerManager.Position);
                this.GomezService.OnDropLedge();
                Vector3 position = this.PlayerManager.Position;
                if (this.PlayerManager.LastAction == ActionType.GrabCornerLedge || this.PlayerManager.LastAction == ActionType.LowerToCornerLedge)
                {
                    this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)-FezMath.Sign(this.PlayerManager.LookingDirection) * 0.5f;
                }
                this.PhysicsManager.DetermineInBackground((IPhysicsEntity)this.PlayerManager, true, false, false);
                this.PlayerManager.Position = position;
            }
            if (this.PlayerManager.Grounded)
            {
                this.PlayerManager.Position -= Vector3.UnitY * 0.01f;
                IPlayerManager playerManager = this.PlayerManager;
                Vector3        vector3       = playerManager.Velocity - 0.0075f * Vector3.UnitY;
                playerManager.Velocity = vector3;
            }
            else
            {
                this.PlayerManager.Velocity = Vector3.Zero;
            }
            if (this.PlayerManager.LastAction != ActionType.GrabCornerLedge)
            {
                return;
            }
            this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)-FezMath.Sign(this.PlayerManager.LookingDirection) * (15.0 / 32.0);
            this.PlayerManager.ForceOverlapsDetermination();
            NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.Position - 1.0 / 500.0 * Vector3.UnitY);

            if (nearestTriles.Surface == null || nearestTriles.Surface.Trile.ActorSettings.Type != ActorType.Vine)
            {
                return;
            }
            this.PlayerManager.Action = ActionType.SideClimbingVine;
        }
Exemplo n.º 19
0
 protected override void TestConditions()
 {
     if (this.PlayerManager.Background)
     {
         return;
     }
     switch (this.PlayerManager.Action)
     {
     case ActionType.Teetering:
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Idle:
     case ActionType.LookingLeft:
     case ActionType.LookingRight:
     case ActionType.LookingUp:
     case ActionType.LookingDown:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (!this.PlayerManager.Grounded || this.InputManager.Down != FezButtonState.Pressed)
         {
             break;
         }
         TrileInstance trileInstance1 = this.PlayerManager.Ground.NearLow;
         TrileInstance trileInstance2 = this.PlayerManager.Ground.FarHigh;
         Trile         trile          = trileInstance1 == null ? (Trile)null : trileInstance1.Trile;
         Vector3       vector3        = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
         TrileInstance trileInstance3 = this.PlayerManager.Ground.NearLow ?? this.PlayerManager.Ground.FarHigh;
         if (BoxCollisionResultExtensions.AnyHit(this.CollisionManager.CollideEdge(trileInstance3.Center + trileInstance3.TransformedSize * (Vector3.UnitY * 0.498f + vector3 * 0.5f), Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor), this.PlayerManager.Size * FezMath.XZMask / 2f, Direction2D.Vertical)) || trileInstance1 == null || (trileInstance1.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.None || trile.ActorSettings.Type == ActorType.Ladder) || (trileInstance1 == trileInstance2 || trileInstance2 != null && trileInstance2.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None))
         {
             break;
         }
         TrileInstance trileInstance4 = this.LevelManager.ActualInstanceAt(trileInstance1.Position + vector3 + new Vector3(0.5f));
         TrileInstance trileInstance5 = this.LevelManager.NearestTrile(trileInstance1.Position + vector3 + new Vector3(0.5f)).Deep;
         if (trileInstance5 != null && trileInstance5.Enabled && trileInstance5.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.None || trileInstance4 != null && trileInstance4.Enabled && (!trileInstance4.Trile.Immaterial && trileInstance4.Trile.ActorSettings.Type != ActorType.Vine))
         {
             break;
         }
         this.WalkTo.Destination         = new Func <Vector3>(this.GetDestination);
         this.WalkTo.NextAction          = ActionType.LowerToCornerLedge;
         this.PlayerManager.Action       = ActionType.WalkingTo;
         this.PlayerManager.HeldInstance = trileInstance1;
         break;
     }
 }
Exemplo n.º 20
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            if (this.GameState.Loading || !this.LevelManager.BackgroundPlanes.ContainsKey(-1))
            {
                return;
            }
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
            Vector3 vector3_2 = this.PlayerManager.Action == ActionType.PullUpCornerLedge ? this.PlayerManager.Position + this.PlayerManager.Size * (vector3_1 + Vector3.UnitY) * 0.5f * Easing.EaseOut((double)this.PlayerManager.Animation.Timing.NormalizedStep, EasingType.Quadratic) : (this.PlayerManager.Action == ActionType.LowerToCornerLedge ? this.PlayerManager.Position + this.PlayerManager.Size * (-vector3_1 + Vector3.UnitY) * 0.5f * (1f - Easing.EaseOut((double)this.PlayerManager.Animation.Timing.NormalizedStep, EasingType.Quadratic)) : this.PlayerManager.Position);

            if (this.GameState.InFpsMode)
            {
                vector3_2 += this.CameraManager.InverseView.Forward;
            }
            this.LevelManager.BackgroundPlanes[-1].Position = this.LevelManager.HaloFiltering ? vector3_2 : FezMath.Round(vector3_2 * 16f) / 16f;
        }
Exemplo n.º 21
0
        public override void Update(GameTime gameTime)
        {
            if (this.PlayerManager.Animation == null)
            {
                return;
            }
            this.playerMesh.Position = this.PlayerManager.Position + (float)((1.0 - ((double)this.PlayerManager.Size.Y + (this.PlayerManager.CarriedInstance != null || this.PlayerManager.Action == ActionType.ThrowingHeavy ? -2.0 : 0.0))) / 2.0) * Vector3.UnitY;
            if (this.lastAnimation != this.PlayerManager.Animation)
            {
                this.effect.Animation = (Texture)this.PlayerManager.Animation.Texture;
                this.lastAnimation    = this.PlayerManager.Animation;
            }
            int       width     = this.lastAnimation.Texture.Width;
            int       height    = this.lastAnimation.Texture.Height;
            Rectangle rectangle = this.lastAnimation.Offsets[this.lastAnimation.Timing.Frame];

            this.playerMesh.FirstGroup.TextureMatrix.Set(new Matrix?(new Matrix((float)rectangle.Width / (float)width, 0.0f, 0.0f, 0.0f, 0.0f, (float)rectangle.Height / (float)height, 0.0f, 0.0f, (float)rectangle.X / (float)width, (float)rectangle.Y / (float)height, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)));
            if (this.lastBackground != this.PlayerManager.Background && !ActionTypeExtensions.NoBackgroundDarkening(this.PlayerManager.Action))
            {
                this.sinceBackgroundChanged = TimeSpan.Zero;
                this.lastBackground         = this.PlayerManager.Background;
                if (!this.LevelManager.LowPass && EndCutscene32Host.Instance == null && EndCutscene64Host.Instance == null)
                {
                    this.SoundManager.FadeFrequencies(this.PlayerManager.Background);
                }
            }
            if (this.sinceBackgroundChanged.TotalSeconds < 1.0)
            {
                this.sinceBackgroundChanged += gameTime.ElapsedGameTime;
            }
            this.effect.Background = ActionTypeExtensions.NoBackgroundDarkening(this.PlayerManager.Action) ? 0.0f : FezMath.Saturate(this.PlayerManager.Background ? (float)(this.sinceBackgroundChanged.TotalSeconds * 2.0) : (float)(1.0 - this.sinceBackgroundChanged.TotalSeconds * 2.0));
            bool      flag1   = (double)this.CollisionManager.GravityFactor < 0.0;
            Viewpoint view    = FezMath.IsOrthographic(this.CameraManager.Viewpoint) || !this.CameraManager.ActionRunning ? this.CameraManager.Viewpoint : this.CameraManager.LastViewpoint;
            Vector2   vector2 = ActionTypeExtensions.GetOffset(this.PlayerManager.Action) / 16f;

            vector2.Y                -= this.lastAnimation.PotOffset.Y / 64f;
            this.playerMesh.Scale     = new Vector3((float)this.PlayerManager.Animation.FrameWidth / 16f, (float)this.PlayerManager.Animation.FrameHeight / 16f * (float)Math.Sign(this.CollisionManager.GravityFactor), 1f);
            this.playerMesh.Position += vector2.X * FezMath.RightVector(view) * (float)FezMath.Sign(this.PlayerManager.LookingDirection) + (flag1 ? (float)(-(double)vector2.Y - 1.0 / 16.0) : vector2.Y) * Vector3.UnitY;
            bool flag2 = this.PlayerManager.HideFez && !this.GameState.SaveData.IsNewGamePlus && !this.PlayerManager.Animation.NoHat && !ActionTypeExtensions.IsCarry(this.PlayerManager.Action);

            if (this.lastHideFez == flag2)
            {
                return;
            }
            this.lastHideFez      = flag2;
            this.effect.NoMoreFez = this.lastHideFez;
        }
Exemplo n.º 22
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.CarryIdle:
     case ActionType.CarryWalk:
     case ActionType.CarryJump:
     case ActionType.CarrySlide:
     case ActionType.CarryHeavyIdle:
     case ActionType.CarryHeavyWalk:
     case ActionType.CarryHeavyJump:
     case ActionType.CarryHeavySlide:
         if (this.PlayerManager.Background || this.InputManager.GrabThrow != FezButtonState.Pressed || (double)this.InputManager.Movement.Y >= -0.5 && (double)Math.Abs(this.InputManager.Movement.X) >= 0.25)
         {
             break;
         }
         TrileInstance carriedInstance = this.PlayerManager.CarriedInstance;
         this.PlayerManager.Action = ActorTypeExtensions.IsLight(carriedInstance.Trile.ActorSettings.Type) ? ActionType.DropTrile : ActionType.DropHeavyTrile;
         Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint);
         Vector3 vector3_2 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
         Vector3 vector3_3 = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down + vector3_2) - carriedInstance.TransformedSize / 2f * vector3_2 + carriedInstance.Trile.Size / 2f * (Vector3.UnitY + vector3_2) + 0.125f * vector3_2;
         carriedInstance.Enabled = false;
         MultipleHits <CollisionResult> result = this.CollisionManager.CollideEdge(carriedInstance.Center, vector3_3 - carriedInstance.Center, carriedInstance.TransformedSize / 2f, Direction2D.Horizontal);
         if (BoxCollisionResultExtensions.AnyCollided(result))
         {
             CollisionResult collisionResult = result.NearLow;
             if (!collisionResult.Collided || collisionResult.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.AllSides || (double)Math.Abs(collisionResult.Destination.Center.Y - vector3_3.Y) >= 1.0)
             {
                 collisionResult = result.FarHigh;
             }
             if (collisionResult.Collided && collisionResult.Destination.GetRotatedFace(this.CameraManager.VisibleOrientation) == CollisionType.AllSides && (double)Math.Abs(collisionResult.Destination.Center.Y - vector3_3.Y) < 1.0)
             {
                 TrileInstance trileInstance = collisionResult.Destination;
                 Vector3       vector3_4     = trileInstance.Center - vector3_2 * trileInstance.TransformedSize / 2f;
                 Vector3       vector3_5     = vector3_3 + vector3_2 * carriedInstance.TransformedSize / 2f;
                 this.PlayerManager.Position -= vector3_1 * (vector3_5 - vector3_4);
             }
         }
         carriedInstance.Enabled = true;
         IPlayerManager playerManager = this.PlayerManager;
         Vector3        vector3_6     = playerManager.Velocity * Vector3.UnitY;
         playerManager.Velocity = vector3_6;
         break;
     }
 }
Exemplo n.º 23
0
        protected override bool Act(TimeSpan elapsed)
        {
            NearestTriles nearestTriles = this.LevelManager.NearestTrile(this.PlayerManager.HeldInstance.Center);
            CollisionType collisionType = CollisionType.None;
            bool          flag          = false;

            if (nearestTriles.Deep != null)
            {
                collisionType = nearestTriles.Deep.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint));
                flag          = flag | collisionType == CollisionType.AllSides;
            }
            if (flag && (this.InputManager.RotateLeft == FezButtonState.Pressed || this.InputManager.RotateRight == FezButtonState.Pressed))
            {
                this.InputManager.PressedToDown();
            }
            if (nearestTriles.Deep == null)
            {
                flag = true;
            }
            if (nearestTriles.Deep != null)
            {
                flag = flag | collisionType == CollisionType.TopNoStraightLedge;
            }
            FezButtonState fezButtonState = this.PlayerManager.Animation.Timing.Ended ? FezButtonState.Down : FezButtonState.Pressed;

            if (this.CameraManager.ActionRunning && !flag && (this.PlayerManager.LookingDirection == HorizontalDirection.Right && this.InputManager.Right == fezButtonState || this.PlayerManager.LookingDirection == HorizontalDirection.Left && this.InputManager.Left == fezButtonState))
            {
                bool    background1 = this.PlayerManager.Background;
                Vector3 position    = this.PlayerManager.Position;
                this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)-FezMath.Sign(this.PlayerManager.LookingDirection) * 0.5f;
                this.PhysicsManager.DetermineInBackground((IPhysicsEntity)this.PlayerManager, true, false, false);
                bool background2 = this.PlayerManager.Background;
                this.PlayerManager.Background = background1;
                this.PlayerManager.Position   = position;
                if (!background2)
                {
                    this.PlayerManager.Action = ActionType.FromCornerBack;
                    return(false);
                }
            }
            this.huggedCorner           = (-(!this.rotatedFrom.HasValue ? FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection) : FezMath.RightVector(this.rotatedFrom.Value) * (float)FezMath.Sign(this.PlayerManager.LookingDirection)) + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor)) * this.PlayerManager.HeldInstance.TransformedSize / 2f;
            this.PlayerManager.Position = this.PlayerManager.HeldInstance.Center + this.huggedCorner;
            return(true);
        }
Exemplo n.º 24
0
        public LongRunningAction Say(int id, string text, bool zuish)
        {
            this.SpeechBubble.Font = zuish ? SpeechFont.Zuish : SpeechFont.Pixel;
            this.SpeechBubble.ChangeText(zuish ? text : GameText.GetString(text));
            IPlayerManager playerManager = this.PlayerManager;
            Vector3        vector3       = playerManager.Velocity * Vector3.UnitY;

            playerManager.Velocity    = vector3;
            this.PlayerManager.Action = ActionType.ReadingSign;
            return(new LongRunningAction((Func <float, float, bool>)((_, __) =>
            {
                ArtObjectInstance local_0;
                if (!this.LevelManager.ArtObjects.TryGetValue(id, out local_0))
                {
                    return true;
                }
                this.SpeechBubble.Origin = local_0.Position + FezMath.RightVector(this.CameraManager.Viewpoint) * local_0.ArtObject.Size * 0.75f - Vector3.UnitY;
                return this.SpeechBubble.Hidden;
            })));
        }
Exemplo n.º 25
0
        private bool LoopVisible()
        {
            if (!FezMath.IsOrthographic(this.CameraManager.Viewpoint))
            {
                return(true);
            }
            Vector3         vector3_1   = FezMath.Abs(FezMath.RightVector(this.CameraManager.Viewpoint));
            BoundingFrustum frustum     = this.CameraManager.Frustum;
            BoundingBox     boundingBox = new BoundingBox()
            {
                Min =
                {
                    X = -frustum.Left.D * frustum.Left.DotNormal(vector3_1),
                    Y = -frustum.Bottom.D * frustum.Bottom.Normal.Y
                },
                Max =
                {
                    X = -frustum.Right.D * frustum.Right.DotNormal(vector3_1),
                    Y = -frustum.Top.D * frustum.Top.Normal.Y
                }
            };
            Vector3   vector3_2 = FezMath.Min(boundingBox.Min, boundingBox.Max);
            Vector3   vector3_3 = FezMath.Max(boundingBox.Min, boundingBox.Max);
            Rectangle rectangle = new Rectangle()
            {
                X      = (int)Math.Floor((double)vector3_2.X),
                Y      = (int)Math.Floor((double)vector3_2.Y),
                Width  = (int)Math.Ceiling((double)vector3_3.X - (double)vector3_2.X),
                Height = (int)Math.Ceiling((double)vector3_3.Y - (double)vector3_2.Y)
            };

            if (rectangle.Y >= 0)
            {
                return((double)(rectangle.Y + rectangle.Height) >= (double)this.LevelManager.Size.Y);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 26
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (this.PlayerManager.PushedInstance == null || this.PlayerManager.PushedInstance.Hidden || this.PlayerManager.PushedInstance.PhysicsState == null)
     {
         this.PlayerManager.Action         = ActionType.Idle;
         this.PlayerManager.PushedInstance = (TrileInstance)null;
         return(false);
     }
     else
     {
         int frame = this.PlayerManager.Animation.Timing.Frame;
         if (this.lastFrame != frame && this.PlayerManager.LastAction != ActionType.Pushing && this.PlayerManager.Action == ActionType.Grabbing)
         {
             if (frame == 3)
             {
                 SoundEffectExtensions.EmitAt(this.grabSound, this.PlayerManager.Position);
             }
             this.lastFrame = frame;
         }
         Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint);
         Vector3 vector3_2 = FezMath.DepthMask(this.CameraManager.Viewpoint);
         Vector3 vector3_3 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)this.pushingDirectionSign;
         this.PlayerManager.Center = Vector3.Up * this.PlayerManager.Center + (vector3_2 + vector3_1) * this.PlayerManager.PushedInstance.Center + -vector3_3 * (this.PlayerManager.PushedInstance.TransformedSize / 2f + this.PlayerManager.Size / 2f);
         if ((this.PlayerManager.Action == ActionType.Pushing || this.PlayerManager.Action == ActionType.Grabbing) && (this.pushingDirectionSign == -Math.Sign(this.InputManager.Movement.X) || !this.PlayerManager.Grounded))
         {
             this.PlayerManager.PushedInstance = (TrileInstance)null;
             this.PlayerManager.Action         = ActionType.Idle;
             return(false);
         }
         else
         {
             if (this.PlayerManager.Action != ActionType.Grabbing || !this.PlayerManager.Animation.Timing.Ended || (double)this.InputManager.Movement.X == 0.0)
             {
                 return(this.PlayerManager.Action == ActionType.Grabbing);
             }
             this.PlayerManager.Action = ActionType.Pushing;
             return(false);
         }
     }
 }
Exemplo n.º 27
0
        protected override bool Act(TimeSpan elapsed)
        {
            if (this.PlayerManager.CarriedInstance == null)
            {
                return(false);
            }
            Vector3 vector3_1 = FezMath.RightVector(this.CameraManager.Viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
            Vector3 vector3_2 = this.PlayerManager.Center + this.PlayerManager.Size / 2f * (Vector3.Down * (float)Math.Sign(this.CollisionManager.GravityFactor) + vector3_1) - this.PlayerManager.CarriedInstance.TransformedSize / 2f * vector3_1 + this.PlayerManager.CarriedInstance.Trile.Size / 2f * (Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor) + vector3_1);
            bool    flag      = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type);

            this.PlayerManager.Animation.Timing.Update(elapsed);
            int frame = this.PlayerManager.Animation.Timing.Frame;

            Vector2[] vector2Array = flag ? Lift.LightTrilePositioning : Lift.HeavyTrilePositioning;
            this.PlayerManager.CarriedInstance.PhysicsState.Center = vector3_2 + (vector2Array[frame].X * -vector3_1 + vector2Array[frame].Y * Vector3.Up * (float)Math.Sign(this.CollisionManager.GravityFactor)) * (1.0 / 16.0) + 3.0 / 16.0 * vector3_1;
            this.PlayerManager.CarriedInstance.PhysicsState.UpdateInstance();
            if (this.PlayerManager.Animation.Timing.Ended)
            {
                this.PlayerManager.Action = flag ? ActionType.CarryIdle : ActionType.CarryHeavyIdle;
            }
            return(false);
        }
Exemplo n.º 28
0
        public MultipleHits <CollisionResult> CollideEdge(Vector3 position, Vector3 impulse, Vector3 halfSize, Direction2D direction, QueryOptions options, float elasticity, Viewpoint viewpoint)
        {
            MultipleHits <CollisionResult> multipleHits = new MultipleHits <CollisionResult>();

            if (impulse == Vector3.Zero)
            {
                return(multipleHits);
            }
            bool    flag      = (options & QueryOptions.Simple) == QueryOptions.Simple;
            Vector3 vector3_1 = new Vector3((float)Math.Sign(impulse.X), (float)Math.Sign(impulse.Y), (float)Math.Sign(impulse.Z));

            if (!flag)
            {
                Vector3 position1 = position;
                Vector3 position2 = position;
                switch (direction)
                {
                case Direction2D.Horizontal:
                    position1 += (vector3_1 + Vector3.Down) * halfSize;
                    position2 += (vector3_1 + Vector3.Up) * halfSize;
                    break;

                case Direction2D.Vertical:
                    Vector3 vector3_2 = FezMath.RightVector(viewpoint) * (float)FezMath.Sign(this.PlayerManager.LookingDirection);
                    position1 += (vector3_1 - vector3_2) * halfSize;
                    position2 += (vector3_1 + vector3_2) * halfSize;
                    break;
                }
                multipleHits.NearLow = this.CollidePoint(position1, impulse, options, elasticity, viewpoint);
                multipleHits.FarHigh = this.CollidePoint(position2, impulse, options, elasticity, viewpoint);
            }
            if (flag || !multipleHits.NearLow.Collided)
            {
                Vector3 position1 = position + vector3_1 * halfSize;
                multipleHits.NearLow = this.CollidePoint(position1, impulse, options, elasticity, viewpoint);
            }
            return(multipleHits);
        }
Exemplo n.º 29
0
        private void DetermineOverlapsInternal(IPhysicsEntity entity, Viewpoint viewpoint)
        {
            QueryOptions options = QueryOptions.None;

            if (entity.Background)
            {
                options |= QueryOptions.Background;
            }
            Vector3 center = entity.Center;

            if (entity.CornerCollision.Length == 1)
            {
                entity.CornerCollision[0] = new PointCollision(center, this.LevelManager.NearestTrile(center, options, new Viewpoint?(viewpoint)));
            }
            else
            {
                Vector3 vector3_1 = FezMath.RightVector(viewpoint);
                Vector3 vector3_2 = entity.Size / 2f - new Vector3(1.0 / 1000.0);
                if ((double)this.CollisionManager.GravityFactor < 0.0)
                {
                    vector3_2 *= new Vector3(1f, -1f, 1f);
                }
                Vector3 vector3_3 = center + (vector3_1 + Vector3.Up) * vector3_2;
                entity.CornerCollision[0] = new PointCollision(vector3_3, this.LevelManager.NearestTrile(vector3_3, options, new Viewpoint?(viewpoint)));
                if (entity.CornerCollision[0].Instances.Deep == null && this.PlayerManager.CarriedInstance != null)
                {
                    this.PlayerManager.CarriedInstance.PhysicsState.UpdatingPhysics = true;
                    entity.CornerCollision[0] = new PointCollision(center, this.LevelManager.NearestTrile(center, options, new Viewpoint?(viewpoint)));
                    this.PlayerManager.CarriedInstance.PhysicsState.UpdatingPhysics = false;
                }
                Vector3 vector3_4 = center + (vector3_1 + Vector3.Down) * vector3_2;
                entity.CornerCollision[1] = new PointCollision(vector3_4, this.LevelManager.NearestTrile(vector3_4, options, new Viewpoint?(viewpoint)));
                Vector3 vector3_5 = center + (-vector3_1 + Vector3.Up) * vector3_2;
                entity.CornerCollision[2] = new PointCollision(vector3_5, this.LevelManager.NearestTrile(vector3_5, options, new Viewpoint?(viewpoint)));
                Vector3 vector3_6 = center + (-vector3_1 + Vector3.Down) * vector3_2;
                entity.CornerCollision[3] = new PointCollision(vector3_6, this.LevelManager.NearestTrile(vector3_6, options, new Viewpoint?(viewpoint)));
            }
        }
Exemplo n.º 30
0
 protected override void TestConditions()
 {
     if (!FezMath.In <ActionType>(this.PlayerManager.Action, ActionType.Sliding, ActionType.GrabCornerLedge, ActionType.Running, ActionType.RunTurnAround, ActionType.Walking, ActionType.Landing, ActionType.WalkingTo, ActionType.GrabTombstone, (IEqualityComparer <ActionType>)ActionTypeComparer.Default) && !this.PlayerManager.Climbing && (!this.PlayerManager.Swimming && !ActionTypeExtensions.IsIdle(this.PlayerManager.Action)) && (this.PlayerManager.Action != ActionType.Falling || !this.PlayerManager.CanDoubleJump) && (this.PlayerManager.Action != ActionType.Grabbing && this.PlayerManager.Action != ActionType.Pushing && !ActionTypeExtensions.IsLookingAround(this.PlayerManager.Action)) || this.InputManager.Jump != FezButtonState.Pressed && (!this.PlayerManager.Grounded && !ActionTypeExtensions.IsOnLedge(this.PlayerManager.Action) || (double)this.PlayerManager.Velocity.Y * (double)Math.Sign(this.CollisionManager.GravityFactor) <= 0.1))
     {
         return;
     }
     this.PlayerManager.PushedInstance = (TrileInstance)null;
     if (this.PlayerManager.CanDoubleJump)
     {
         this.PlayerManager.CanDoubleJump = false;
     }
     if (FezButtonStateExtensions.IsDown(this.InputManager.Down) && (this.PlayerManager.Grounded && this.PlayerManager.Ground.First.GetRotatedFace(FezMath.VisibleOrientation(this.CameraManager.Viewpoint)) == CollisionType.TopOnly || this.PlayerManager.Climbing))
     {
         return;
     }
     if (this.PlayerManager.Action == ActionType.GrabCornerLedge)
     {
         HorizontalDirection horizontalDirection = FezMath.DirectionFromMovement(this.InputManager.Movement.X);
         if (horizontalDirection == HorizontalDirection.None || horizontalDirection == this.PlayerManager.LookingDirection)
         {
             return;
         }
         Vector3 position = this.PlayerManager.Position;
         this.PlayerManager.Position += FezMath.RightVector(this.CameraManager.Viewpoint) * (float)-FezMath.Sign(this.PlayerManager.LookingDirection);
         this.PhysicsManager.DetermineInBackground((IPhysicsEntity)this.PlayerManager, true, false, false);
         this.PlayerManager.Position = position;
     }
     if (this.InputManager.Jump == FezButtonState.Pressed)
     {
         this.sinceJumped  = TimeSpan.Zero;
         this.scheduleJump = true;
     }
     else
     {
         this.DoJump();
     }
     this.PlayerManager.Action = ActionType.Jumping;
 }