Exemplo n.º 1
0
 private void TryInitialize()
 {
     this.flashesMesh.ClearGroups();
     this.bombStates.Clear();
     this.indexedDg.Clear();
     this.destructibleGroups.Clear();
     foreach (TrileGroup trileGroup in (IEnumerable <TrileGroup>) this.LevelManager.Groups.Values)
     {
         if (trileGroup.Triles.Count != 0 && ActorTypeExtensions.IsDestructible(trileGroup.Triles[0].Trile.ActorSettings.Type) && ActorTypeExtensions.IsDestructible(trileGroup.Triles[trileGroup.Triles.Count - 1].Trile.ActorSettings.Type))
         {
             BombsHost.DestructibleGroup destructibleGroup = new BombsHost.DestructibleGroup()
             {
                 AllTriles = new List <TrileInstance>((IEnumerable <TrileInstance>)trileGroup.Triles),
                 Group     = trileGroup
             };
             this.destructibleGroups.Add(destructibleGroup);
             FaceOrientation face = FaceOrientation.Down;
             foreach (TrileInstance key in trileGroup.Triles)
             {
                 this.indexedDg.Add(key, destructibleGroup);
                 TrileEmplacement traversal = key.Emplacement.GetTraversal(ref face);
                 TrileInstance    instance  = this.LevelManager.TrileInstanceAt(ref traversal);
                 if (instance != null && !ActorTypeExtensions.IsDestructible(instance.Trile.ActorSettings.Type) && instance.PhysicsState == null)
                 {
                     instance.PhysicsState = new InstancePhysicsState(instance);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        private void JumpAftertouch(float secondsElapsed)
        {
            int frame = this.PlayerManager.Animation.Timing.Frame;
            int num   = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? 7 : 6;

            if (!this.PlayerManager.Grounded && (double)this.PlayerManager.Velocity.Y < 0.0)
            {
                this.PlayerManager.Animation.Timing.Step = Math.Max(this.PlayerManager.Animation.Timing.Step, 0.5f);
            }
            if (frame != 0 && frame < num && this.PlayerManager.Grounded)
            {
                this.PlayerManager.Animation.Timing.Step = (float)num / 8f;
            }
            else if (!this.PlayerManager.Grounded && (double)this.PlayerManager.Velocity.Y < 0.0)
            {
                this.PlayerManager.Animation.Timing.Step = Math.Min(this.PlayerManager.Animation.Timing.Step, (float)((double)num / 8.0 - 1.0 / 1000.0));
            }
            else if (frame < num)
            {
                this.PlayerManager.Animation.Timing.Step = Math.Min(this.PlayerManager.Animation.Timing.Step, 0.499f);
            }
            if (frame == 0 || frame >= num || this.InputManager.Jump != FezButtonState.Down)
            {
                return;
            }
            IPlayerManager playerManager = this.PlayerManager;
            Vector3        vector3       = playerManager.Velocity + (float)((double)secondsElapsed * 0.884999990463257 / 4.0) * Vector3.UnitY;

            playerManager.Velocity = vector3;
        }
Exemplo n.º 3
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Teetering:
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Idle:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
         if (!this.PlayerManager.Grounded || (double)this.InputManager.Movement.X == 0.0 || this.PlayerManager.LookingDirection == HorizontalDirection.None)
         {
             break;
         }
         TrileInstance trileInstance = this.PlayerManager.WallCollision.NearLow.Destination;
         if (trileInstance == null || !ActorTypeExtensions.IsPickable(trileInstance.Trile.ActorSettings.Type) || (trileInstance.GetRotatedFace(this.CameraManager.VisibleOrientation) != CollisionType.AllSides || trileInstance.Hidden) || (trileInstance.PhysicsState == null || !trileInstance.PhysicsState.Grounded))
         {
             break;
         }
         NearestTriles nearestTriles = this.LevelManager.NearestTrile(trileInstance.Position);
         if (nearestTriles.Surface != null && nearestTriles.Surface.Trile.ForceHugging || (double)Math.Abs(trileInstance.Center.Y - this.PlayerManager.Position.Y) > 0.5 || trileInstance.Trile.ActorSettings.Type == ActorType.Couch && FezMath.OrientationFromPhi(FezMath.ToPhi(trileInstance.Trile.ActorSettings.Face) + trileInstance.Phi) != FezMath.VisibleOrientation(FezMath.GetRotatedView(this.CameraManager.Viewpoint, this.PlayerManager.LookingDirection == HorizontalDirection.Right ? -1 : 1)))
         {
             break;
         }
         this.PlayerManager.Action         = ActionType.Grabbing;
         this.PlayerManager.PushedInstance = trileInstance;
         break;
     }
 }
Exemplo n.º 4
0
        private void InitBitPlanes()
        {
            if (this.lastBits == this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes)
            {
                return;
            }
            foreach (BackgroundPlane plane in this.BitPlanes)
            {
                this.LevelManager.RemovePlane(plane);
            }
            this.BitPlanes.Clear();
            if (this.AoInstance.Rotation == new Quaternion(0.0f, 0.0f, 0.0f, -1f))
            {
                this.AoInstance.Rotation = Quaternion.Identity;
            }
            int bitCount = ActorTypeExtensions.GetBitCount(this.AoInstance.ArtObject.ActorType);

            for (int index = 0; index < bitCount; ++index)
            {
                BackgroundPlane plane = new BackgroundPlane(this.LevelMaterializer.StaticPlanesMesh, index < this.GameState.SaveData.CubeShards ? (Texture)this.BitTexture : (Texture)this.AntiBitTexture)
                {
                    Rotation   = this.AoInstance.Rotation,
                    Opacity    = 0.0f,
                    Fullbright = true
                };
                this.BitPlanes.Add(plane);
                this.LevelManager.AddPlane(plane);
            }
            this.lastBits = this.GameState.SaveData.CubeShards + this.GameState.SaveData.SecretCubes;
        }
Exemplo n.º 5
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.º 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
        private void TryPushHorizontalStack(PickupState state, float elapsedSeconds)
        {
            TrileInstance trileInstance1 = state.Instance;
            TrileGroup    trileGroup     = state.Group;

            if (!BoxCollisionResultExtensions.AnyCollided(trileInstance1.PhysicsState.WallCollision))
            {
                return;
            }
            Vector3 vector3_1 = -FezMath.Sign(trileInstance1.PhysicsState.WallCollision.First.Response);

            trileInstance1.PhysicsState.Velocity = Vector3.Zero;
            TrileInstance instance = trileInstance1;

            while (instance != null && BoxCollisionResultExtensions.AnyCollided(instance.PhysicsState.WallCollision))
            {
                MultipleHits <CollisionResult> wallCollision = instance.PhysicsState.WallCollision;
                TrileInstance trileInstance2 = wallCollision.First.Destination;
                if (trileInstance2.PhysicsState != null && ActorTypeExtensions.IsPickable(trileInstance2.Trile.ActorSettings.Type) && (trileGroup == null || !trileGroup.Triles.Contains(trileInstance2)))
                {
                    Vector3 vector = -wallCollision.First.Response;
                    if (FezMath.Sign(vector) != vector3_1 || vector == Vector3.Zero)
                    {
                        instance = (TrileInstance)null;
                    }
                    else
                    {
                        instance = trileInstance2;
                        Vector3 velocity = instance.PhysicsState.Velocity;
                        instance.PhysicsState.Velocity = vector;
                        Vector3 center = instance.PhysicsState.Center;
                        if (instance.PhysicsState.Grounded)
                        {
                            instance.PhysicsState.Velocity += (float)(3.15000009536743 * (double)Math.Sign(this.CollisionManager.GravityFactor) * 0.150000005960464) * elapsedSeconds * Vector3.Down;
                        }
                        this.PhysicsManager.Update((ISimplePhysicsEntity)instance.PhysicsState, false, false);
                        if (trileInstance1.PhysicsState.Grounded)
                        {
                            instance.PhysicsState.Velocity = velocity;
                        }
                        instance.PhysicsState.UpdateInstance();
                        this.LevelManager.UpdateInstance(instance);
                        foreach (PickupState pickupState in this.PickupStates)
                        {
                            if (pickupState.Instance.PhysicsState.Ground.NearLow == instance || pickupState.Instance.PhysicsState.Ground.FarHigh == instance)
                            {
                                Vector3 vector3_2 = (instance.PhysicsState.Center - center) / 0.85f;
                                pickupState.Instance.PhysicsState.Velocity = vector3_2;
                            }
                        }
                    }
                }
                else
                {
                    instance = (TrileInstance)null;
                }
            }
        }
Exemplo n.º 8
0
 protected override void TestConditions()
 {
     if ((double)this.CollisionManager.GravityFactor < 0.0)
     {
         return;
     }
     switch (this.PlayerManager.Action)
     {
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Grabbing:
     case ActionType.Pushing:
     case ActionType.Teetering:
     case ActionType.Idle:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.Sliding:
     case ActionType.Landing:
         if (this.PlayerManager.Background || !this.PlayerManager.Grounded || this.InputManager.GrabThrow != FezButtonState.Pressed)
         {
             break;
         }
         TrileInstance key = this.PlayerManager.PushedInstance ?? this.PlayerManager.AxisCollision[VerticalDirection.Up].Deep ?? this.PlayerManager.AxisCollision[VerticalDirection.Down].Deep;
         if (key == null || !ActorTypeExtensions.IsPickable(key.Trile.ActorSettings.Type) || key.Trile.ActorSettings.Type == ActorType.Couch || !key.PhysicsState.Grounded)
         {
             break;
         }
         Vector3 halfSize = key.TransformedSize / 2f - new Vector3(0.004f);
         if (BoxCollisionResultExtensions.AnyCollided(this.CollisionManager.CollideEdge(key.Center, key.Trile.Size.Y * Vector3.Up * (float)Math.Sign(this.CollisionManager.GravityFactor), halfSize, Direction2D.Vertical)))
         {
             break;
         }
         TrileInstance trileInstance = this.LevelManager.ActualInstanceAt(key.Center + Vector3.UnitY * (float)Math.Sign(this.CollisionManager.GravityFactor));
         TrileGroup    trileGroup;
         if (trileInstance != null && trileInstance.PhysicsState != null && trileInstance.PhysicsState.Ground.First == key || this.LevelManager.PickupGroups.TryGetValue(key, out trileGroup) && trileGroup.Triles.Count > 1)
         {
             break;
         }
         ActionType actionType = ActorTypeExtensions.IsLight(key.Trile.ActorSettings.Type) ? ActionType.Lifting : ActionType.LiftingHeavy;
         if (this.PlayerManager.Action == ActionType.Grabbing)
         {
             this.PlayerManager.CarriedInstance = key;
             this.PlayerManager.Action          = actionType;
             break;
         }
         else
         {
             this.PlayerManager.PushedInstance = key;
             this.WalkTo.Destination           = new Func <Vector3>(this.GetDestination);
             this.WalkTo.NextAction            = actionType;
             this.PlayerManager.Action         = ActionType.WalkingTo;
             break;
         }
     }
 }
Exemplo n.º 9
0
 private void TryInitialize()
 {
     this.TrackedTreasures.Clear();
     foreach (TrileInstance trileInstance in (IEnumerable <TrileInstance>) this.LevelManager.Triles.Values)
     {
         if (trileInstance.Enabled && (ActorTypeExtensions.IsTreasure(trileInstance.Trile.ActorSettings.Type) || trileInstance.Trile.ActorSettings.Type == ActorType.GoldenCube))
         {
             this.TrackedTreasures.Add(trileInstance);
         }
     }
 }
Exemplo n.º 10
0
        protected override bool Act(TimeSpan elapsed)
        {
            this.PlayerManager.AirTime += elapsed;
            bool    flag1     = (double)this.CollisionManager.GravityFactor < 0.0;
            Vector3 vector3_1 = (float)(3.15000009536743 * (double)this.CollisionManager.GravityFactor * 0.150000005960464) * (float)elapsed.TotalSeconds * -Vector3.UnitY;

            if (this.PlayerManager.Action == ActionType.Suffering)
            {
                vector3_1 /= 2f;
            }
            IPlayerManager playerManager1 = this.PlayerManager;
            Vector3        vector3_2      = playerManager1.Velocity + vector3_1;

            playerManager1.Velocity = vector3_2;
            bool flag2 = this.PlayerManager.CarriedInstance != null;

            if (!this.PlayerManager.Grounded && this.PlayerManager.Action != ActionType.Suffering)
            {
                float          num1           = this.InputManager.Movement.X;
                IPlayerManager playerManager2 = this.PlayerManager;
                Vector3        vector3_3      = playerManager2.Velocity + Vector3.Transform(Vector3.UnitX * num1, this.CameraManager.Rotation) * 0.15f * 4.7f * (float)elapsed.TotalSeconds * 0.15f;
                playerManager2.Velocity = vector3_3;
                if ((flag1 ? ((double)this.PlayerManager.Velocity.Y > 0.0 ? 1 : 0) : ((double)this.PlayerManager.Velocity.Y < 0.0 ? 1 : 0)) != 0)
                {
                    IPlayerManager playerManager3 = this.PlayerManager;
                    int            num2           = playerManager3.CanDoubleJump & this.PlayerManager.AirTime < Fall.DoubleJumpTime ? 1 : 0;
                    playerManager3.CanDoubleJump = num2 != 0;
                }
            }
            else
            {
                this.PlayerManager.CanDoubleJump = true;
                this.PlayerManager.AirTime       = TimeSpan.Zero;
            }
            if (!this.PlayerManager.Grounded && ((flag1 ? ((double)this.PlayerManager.Velocity.Y > 0.0 ? 1 : 0) : ((double)this.PlayerManager.Velocity.Y < 0.0 ? 1 : 0)) != 0 && !flag2 && (!ActionTypeExtensions.PreventsFall(this.PlayerManager.Action) && this.PlayerManager.Action != ActionType.Falling)))
            {
                this.PlayerManager.Action = ActionType.Falling;
            }
            if (this.PlayerManager.GroundedVelocity.HasValue)
            {
                float val1 = 5.093625f * (float)elapsed.TotalSeconds;
                float val2 = (float)((double)val1 / 1.5 * (0.5 + (double)Math.Abs(this.CollisionManager.GravityFactor) * 1.5) / 2.0);
                if (this.PlayerManager.CarriedInstance != null && ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type))
                {
                    val1 *= 0.7f;
                    val2 *= 0.7f;
                }
                Vector3 vector3_3 = new Vector3(Math.Min(val1, Math.Max(Math.Max(Math.Abs(this.PlayerManager.GroundedVelocity.Value.X), val2), Math.Max(Math.Abs(this.PlayerManager.GroundedVelocity.Value.Z), val2))));
                this.PlayerManager.Velocity = new Vector3(MathHelper.Clamp(this.PlayerManager.Velocity.X, -vector3_3.X, vector3_3.X), this.PlayerManager.Velocity.Y, MathHelper.Clamp(this.PlayerManager.Velocity.Z, -vector3_3.Z, vector3_3.Z));
            }
            return(this.PlayerManager.Action == ActionType.Falling);
        }
Exemplo n.º 11
0
 protected override void Begin()
 {
     base.Begin();
     if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type))
     {
         SoundEffectExtensions.EmitAt(this.dropHeavySound, this.PlayerManager.Position);
     }
     else
     {
         SoundEffectExtensions.EmitAt(this.dropLightSound, this.PlayerManager.Position);
     }
     this.GomezService.OnDropObject();
 }
Exemplo n.º 12
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.º 13
0
        private void TryInitialize()
        {
            if (this.eIdleSpin != null && this.eIdleSpin.Cue != null && (!this.eIdleSpin.Cue.IsDisposed && this.eIdleSpin.Cue.State != SoundState.Stopped))
            {
                this.eIdleSpin.Cue.Stop(false);
            }
            this.eIdleSpin        = (SoundEmitter)null;
            this.rgbPlanes        = (Mesh)null;
            this.particles        = (PlaneParticleSystem)null;
            this.Phase            = LesserWarp.Phases.None;
            this.sinceInitialized = 0.0f;
            this.GateAo           = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x => x.ArtObject.ActorType == ActorType.LesserGate));
            if (this.GateAo == null)
            {
                return;
            }
            this.InitializeRgbGate();
            LesserWarp lesserWarp = this;
            Mesh       mesh1      = new Mesh();
            Mesh       mesh2      = mesh1;

            DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
            textured1.Fullbright = true;
            DefaultEffect.Textured textured2 = textured1;
            mesh2.Effect      = (BaseEffect)textured2;
            mesh1.DepthWrites = false;
            mesh1.Texture     = (Dirtyable <Texture>)((Texture)this.WhiteTexture);
            mesh1.Rotation    = Quaternion.CreateFromAxisAngle(Vector3.Right, -1.570796f);
            Mesh mesh3 = mesh1;

            lesserWarp.MaskMesh = mesh3;
            this.MaskMesh.AddFace(new Vector3(2f), Vector3.Zero, FaceOrientation.Front, true, true);
            this.MaskMesh.BakeTransformWithNormal <FezVertexPositionNormalTexture>();
            this.MaskMesh.Position = this.GateAo.Position - Vector3.UnitY * 1.25f;
            this.HasCubeShard      = Enumerable.Any <TrileInstance>((IEnumerable <TrileInstance>) this.LevelManager.Triles.Values, (Func <TrileInstance, bool>)(x =>
            {
                if (ActorTypeExtensions.IsCubeShard(x.Trile.ActorSettings.Type))
                {
                    return((double)Vector3.Distance(x.Center, this.GateAo.Position) < 3.0);
                }
                else
                {
                    return(false);
                }
            }));
            this.OriginalPosition = this.GateAo.Position;
            this.sRise            = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpRise");
            this.sLower           = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpLower");
            this.sActivate        = this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/WarpGateActivate");
            this.eIdleSpin        = SoundEffectExtensions.EmitAt(this.CMProvider.CurrentLevel.Load <SoundEffect>("Sounds/Zu/LesserWarpIdleSpin"), this.GateAo.Position, true, true);
        }
Exemplo n.º 14
0
 public void SyncCollisionSize()
 {
     if (this.carriedInstance != null && this.lastCarriedInstance == null)
     {
         this.variableSize = !ActorTypeExtensions.IsLight(this.carriedInstance.Trile.ActorSettings.Type) ? new Vector3(0.75f, 1.75f, 0.75f) : new Vector3(0.75f, 31.0 / 16.0, 0.75f);
         this.Position    -= (this.variableSize - this.BaseSize) / 2f * Vector3.UnitY;
     }
     else if (this.carriedInstance == null && this.lastCarriedInstance != null)
     {
         this.Position    += (this.variableSize - this.BaseSize) / 2f * Vector3.UnitY;
         this.variableSize = this.BaseSize;
     }
     this.lastCarriedInstance = this.carriedInstance;
 }
Exemplo n.º 15
0
 public override void Initialize()
 {
     base.Initialize();
     this.LevelManager.LevelChanged  += new Action(this.TryInitialize);
     this.LevelManager.TrileRestored += (Action <TrileInstance>)(t =>
     {
         if (!t.Enabled || !ActorTypeExtensions.IsTreasure(t.Trile.ActorSettings.Type) && t.Trile.ActorSettings.Type != ActorType.GoldenCube)
         {
             return;
         }
         this.TrackedTreasures.Add(t);
     });
     this.TryInitialize();
 }
Exemplo n.º 16
0
 public override void Update(GameTime gameTime)
 {
     if (this.GameState.Paused || this.GameState.InMap || (!this.CameraManager.ActionRunning || !FezMath.IsOrthographic(this.CameraManager.Viewpoint)))
     {
         return;
     }
     this.SinceAlive        += gameTime.ElapsedGameTime;
     this.SpawnMesh.Position = this.Instance.Center;
     if (this.sinceColorSwapped++ >= this.nextSwapIn)
     {
         int num1 = RandomHelper.Random.Next(0, 4);
         this.redVisible   = num1 == 0;
         this.greenVisible = num1 == 1;
         this.blueVisible  = num1 == 2;
         if (num1 == 3)
         {
             int num2 = RandomHelper.Random.Next(0, 3);
             if (num2 == 0)
             {
                 this.blueVisible = this.redVisible = true;
             }
             if (num2 == 1)
             {
                 this.greenVisible = this.redVisible = true;
             }
             if (num2 == 2)
             {
                 this.blueVisible = this.greenVisible = true;
             }
         }
         this.sinceColorSwapped = 0;
         this.nextSwapIn        = RandomHelper.Random.Next(1, 6);
     }
     if (this.SinceAlive.TotalSeconds <= 2.25)
     {
         return;
     }
     this.Instance.Hidden  = false;
     this.Instance.Enabled = true;
     if (ActorTypeExtensions.IsPickable(this.Instance.Trile.ActorSettings.Type))
     {
         this.Instance.PhysicsState.Respawned = true;
         this.Instance.PhysicsState.Vanished  = false;
     }
     this.LevelManager.RestoreTrile(this.Instance);
     this.LevelMaterializer.UpdateInstance(this.Instance);
     ServiceHelper.RemoveComponent <GlitchyRespawner>(this);
 }
Exemplo n.º 17
0
        public override void Initialize()
        {
            base.Initialize();
            lock (GlitchyRespawner.StaticLock)
            {
                if (GlitchyRespawner.FullbrightEffect == null)
                {
                    DefaultEffect.Textured local_0 = new DefaultEffect.Textured();
                    local_0.Fullbright = true;
                    GlitchyRespawner.FullbrightEffect = (DefaultEffect)local_0;
                }
                if (GlitchyRespawner.CubemappedEffect == null)
                {
                    GlitchyRespawner.CubemappedEffect = new CubemappedEffect();
                }
            }
            this.SpawnMesh = new Mesh()
            {
                SamplerState = SamplerState.PointClamp,
                DepthWrites  = false,
                Effect       = (BaseEffect)GlitchyRespawner.CubemappedEffect
            };
            ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = this.Instance.Trile.Geometry;
            IndexedUserPrimitives <VertexPositionNormalTextureInstance> indexedUserPrimitives        = new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
            Group group = this.SpawnMesh.AddGroup();

            group.Geometry = (IIndexedPrimitiveCollection)indexedUserPrimitives;
            group.Texture  = (Texture)this.LevelMaterializer.TrilesMesh.Texture;
            if (ActorTypeExtensions.IsPickable(this.Instance.Trile.ActorSettings.Type))
            {
                this.Instance.Phi = (float)FezMath.Round((double)this.Instance.Phi / 1.57079637050629) * 1.570796f;
            }
            group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.Instance.Phi);
            if (this.Instance.Trile.ActorSettings.Type == ActorType.CubeShard || this.Instance.Trile.ActorSettings.Type == ActorType.SecretCube || this.Instance.Trile.ActorSettings.Type == ActorType.PieceOfHeart)
            {
                group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Left, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Down, 0.7853982f) * group.Rotation;
            }
            this.Instance.Foreign = true;
            this.StarsTexture     = this.CMProvider.Global.Load <Texture2D>("Other Textures/black_hole/Stars");
            if (this.EmitOrNot)
            {
                SoundEmitter soundEmitter = SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load <SoundEffect>("Sounds/MiscActors/GlitchyRespawn"), this.Instance.Center);
                soundEmitter.PauseViewTransitions = true;
                soundEmitter.FactorizeVolume      = true;
            }
            this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights);
            this.LevelManager.LevelChanging          += new Action(this.Kill);
        }
Exemplo n.º 18
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.º 19
0
 public override void Initialize()
 {
     this.LevelManager.LevelChanging += (Action)(() =>
     {
         bool local_0 = false;
         foreach (TrileEmplacement item_0 in this.GameState.SaveData.ThisLevel.InactiveTriles)
         {
             TrileEmplacement local_2 = item_0;
             TrileInstance bottom = this.LevelManager.TrileInstanceAt(ref local_2);
             if (bottom != null && ActorTypeExtensions.IsDoor(bottom.Trile.ActorSettings.Type))
             {
                 local_2 = bottom.Emplacement + Vector3.UnitY;
                 TrileInstance local_3 = this.LevelManager.TrileInstanceAt(ref local_2);
                 ArtObjectInstance local_4;
                 TrileGroup group;
                 if ((group = Enumerable.FirstOrDefault <TrileGroup>((IEnumerable <TrileGroup>) this.LevelManager.Groups.Values, (Func <TrileGroup, bool>)(x => x.Triles.Contains(bottom)))) != null && (local_4 = Enumerable.FirstOrDefault <ArtObjectInstance>((IEnumerable <ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func <ArtObjectInstance, bool>)(x =>
                 {
                     int?local_0 = x.ActorSettings.AttachedGroup;
                     int local_1 = group.Id;
                     if (local_0.GetValueOrDefault() == local_1)
                     {
                         return(local_0.HasValue);
                     }
                     else
                     {
                         return(false);
                     }
                 }))) != null)
                 {
                     this.LevelManager.RemoveArtObject(local_4);
                 }
                 this.LevelManager.ClearTrile(bottom);
                 this.LevelManager.ClearTrile(local_3);
                 local_0 = true;
             }
         }
         if (!local_0 || this.GameState.FarawaySettings.InTransition)
         {
             return;
         }
         this.LevelMaterializer.CullInstances();
     });
     base.Initialize();
 }
Exemplo n.º 20
0
 protected override bool Act(TimeSpan elapsed)
 {
     if (this.PlayerManager.CarriedInstance == null)
     {
         this.PlayerManager.Action = ActionType.Idle;
         return(false);
     }
     else
     {
         bool flag = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type);
         if (this.PlayerManager.Action == ActionType.CarryWalk || this.PlayerManager.Action == ActionType.CarryHeavyWalk || (this.PlayerManager.Action == ActionType.CarryHeavyJump || this.PlayerManager.Action == ActionType.CarryJump) && this.PlayerManager.Grounded)
         {
             this.movementHelper.WalkAcceleration = flag ? 4.086957f : 2.35f;
             this.movementHelper.Update((float)elapsed.TotalSeconds);
         }
         float timeFactor = 1.2f;
         if (this.PlayerManager.Action == ActionType.CarryJump || this.PlayerManager.Action == ActionType.CarryHeavyJump)
         {
             timeFactor = 1f;
         }
         this.PlayerManager.Animation.Timing.Update(elapsed, timeFactor);
         if (this.PlayerManager.Action == ActionType.CarryJump || this.PlayerManager.Action == ActionType.CarryHeavyJump)
         {
             if (this.PlayerManager.Animation.Timing.Frame == 1 && this.PlayerManager.Grounded && !this.jumpIsFall)
             {
                 SoundEffectExtensions.EmitAt(this.jumpSound, this.PlayerManager.Position);
                 IPlayerManager playerManager1 = this.PlayerManager;
                 Vector3        vector3_1      = playerManager1.Velocity * FezMath.XZMask;
                 playerManager1.Velocity = vector3_1;
                 IPlayerManager playerManager2 = this.PlayerManager;
                 Vector3        vector3_2      = playerManager2.Velocity + 0.13275f * Vector3.UnitY * (flag ? 1f : 0.75f);
                 playerManager2.Velocity = vector3_2;
             }
             else
             {
                 this.JumpAftertouch((float)elapsed.TotalSeconds);
             }
         }
         this.MoveCarriedInstance();
         return(false);
     }
 }
Exemplo n.º 21
0
 protected override void Begin()
 {
     base.Begin();
     if (this.PlayerManager.CarriedInstance == null)
     {
         this.PlayerManager.Action = ActionType.Idle;
     }
     else
     {
         if (ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type))
         {
             SoundEffectExtensions.EmitAt(this.throwHeavySound, this.PlayerManager.Position);
         }
         else
         {
             SoundEffectExtensions.EmitAt(this.throwLightSound, this.PlayerManager.Position);
         }
         this.GomezService.OnThrowObject();
     }
 }
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 || this.InputManager.Down == FezButtonState.Down && !FezMath.AlmostEqual(this.InputManager.Movement, Vector2.Zero, 0.5f))
         {
             break;
         }
         this.PlayerManager.Action = ActorTypeExtensions.IsLight(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.Throwing : ActionType.ThrowingHeavy;
         this.thrown = false;
         break;
     }
 }
Exemplo n.º 23
0
 public void Checkpoint()
 {
     Waiters.Wait((Func <bool>)(() =>
     {
         if (this.PlayerManager.Grounded)
         {
             return(ActorTypeExtensions.IsSafe(this.PlayerManager.Ground.First.Trile.ActorSettings.Type));
         }
         else
         {
             return(false);
         }
     }), (Action)(() =>
     {
         if (this.LevelManager.Name == "LAVA" && (double)this.LevelManager.WaterHeight < 50.0)
         {
             this.LevelManager.WaterHeight = 132f;
         }
         this.PlayerManager.RecordRespawnInformation(true);
     }));
 }
Exemplo n.º 24
0
 protected override void TestConditions()
 {
     switch (this.PlayerManager.Action)
     {
     case ActionType.Teetering:
     case ActionType.IdlePlay:
     case ActionType.IdleSleep:
     case ActionType.IdleLookAround:
     case ActionType.IdleYawn:
     case ActionType.Idle:
     case ActionType.Walking:
     case ActionType.Running:
     case ActionType.CarryIdle:
     case ActionType.CarryWalk:
     case ActionType.CarrySlide:
     case ActionType.CarryHeavyIdle:
     case ActionType.CarryHeavyWalk:
     case ActionType.CarryHeavySlide:
     case ActionType.Sliding:
         if (!this.PlayerManager.TunnelVolume.HasValue || this.InputManager.ExactUp != FezButtonState.Pressed)
         {
             break;
         }
         if (this.PlayerManager.CarriedInstance == null)
         {
             this.WalkTo.Destination   = new Func <Vector3>(this.GetDestination);
             this.PlayerManager.Action = ActionType.WalkingTo;
             this.WalkTo.NextAction    = ActionType.EnteringTunnel;
             break;
         }
         else
         {
             Vector3 position = this.PlayerManager.Position;
             this.PlayerManager.Position = this.GetDestination();
             this.PlayerManager.CarriedInstance.Position += this.PlayerManager.Position - position;
             this.PlayerManager.Action = ActorTypeExtensions.IsHeavy(this.PlayerManager.CarriedInstance.Trile.ActorSettings.Type) ? ActionType.EnterTunnelCarryHeavy : ActionType.EnterTunnelCarry;
             break;
         }
     }
 }
Exemplo n.º 25
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;
     }
 }
Exemplo n.º 26
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.º 27
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;
        }
Exemplo n.º 28
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;
     }
 }
Exemplo n.º 29
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);
 }
Exemplo n.º 30
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;
         }
     }
 }