public void StartDrag(Vector3 dragPoint, FaceOrientation orientation) { if (orientation == FaceOrientation.up) { Up.StartDrag(dragPoint); } if (orientation == FaceOrientation.down) { Down.StartDrag(dragPoint); } if (orientation == FaceOrientation.north) { North.StartDrag(dragPoint); } if (orientation == FaceOrientation.south) { South.StartDrag(dragPoint); } if (orientation == FaceOrientation.east) { East.StartDrag(dragPoint); } if (orientation == FaceOrientation.west) { West.StartDrag(dragPoint); } }
public static FaceOrientation GetOppositeFace(FaceOrientation Orientation) { switch (Orientation) { case FaceOrientation.Top: return(FaceOrientation.Bottom); case FaceOrientation.Bottom: return(FaceOrientation.Top); case FaceOrientation.North: return(FaceOrientation.South); case FaceOrientation.East: return(FaceOrientation.West); case FaceOrientation.South: return(FaceOrientation.North); case FaceOrientation.West: return(FaceOrientation.East); default: return(FaceOrientation.Top); } }
public void SetColor(Color4 color, FaceOrientation orientation) { if (orientation == FaceOrientation.up) { Up.Color = color; } if (orientation == FaceOrientation.down) { Down.Color = color; } if (orientation == FaceOrientation.north) { North.Color = color; } if (orientation == FaceOrientation.south) { South.Color = color; } if (orientation == FaceOrientation.east) { East.Color = color; } if (orientation == FaceOrientation.west) { West.Color = color; } }
public void TraverseInto(FaceOrientation face) { switch (face) { case FaceOrientation.Left: --this.X; break; case FaceOrientation.Down: --this.Y; break; case FaceOrientation.Back: --this.Z; break; case FaceOrientation.Top: ++this.Y; break; case FaceOrientation.Front: ++this.Z; break; default: ++this.X; break; } }
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); } } } } }
public static GlobalVoxelOffset GetFaceNeighborOffset(FaceOrientation Orientation) { switch (Orientation) { case FaceOrientation.Top: return(new GlobalVoxelOffset(0, 1, 0)); case FaceOrientation.Bottom: return(new GlobalVoxelOffset(0, -1, 0)); case FaceOrientation.North: return(new GlobalVoxelOffset(0, 0, -1)); case FaceOrientation.East: return(new GlobalVoxelOffset(1, 0, 0)); case FaceOrientation.South: return(new GlobalVoxelOffset(0, 0, 1)); case FaceOrientation.West: return(new GlobalVoxelOffset(-1, 0, 0)); default: return(new GlobalVoxelOffset(0, 0, 0)); } }
private static bool ShouldDrawFace(FaceOrientation face, RampType neighborRamp, RampType myRamp) { switch (face) { case FaceOrientation.Top: case FaceOrientation.Bottom: return(true); case FaceOrientation.South: return(CheckRamps(myRamp, RampType.TopBackLeft, RampType.TopBackRight, neighborRamp, RampType.TopFrontLeft, RampType.TopFrontRight)); case FaceOrientation.North: return(CheckRamps(myRamp, RampType.TopFrontLeft, RampType.TopFrontRight, neighborRamp, RampType.TopBackLeft, RampType.TopBackRight)); case FaceOrientation.West: return(CheckRamps(myRamp, RampType.TopBackLeft, RampType.TopFrontLeft, neighborRamp, RampType.TopBackRight, RampType.TopFrontRight)); case FaceOrientation.East: return(CheckRamps(myRamp, RampType.TopBackRight, RampType.TopFrontRight, neighborRamp, RampType.TopBackLeft, RampType.TopFrontLeft)); default: return(false); } }
private void Invalidate(ArtObjectMaterializer.InvalidationContext context) { using (IEnumerator <TrixelEmplacement> enumerator = context.Trixels.GetEnumerator()) { while (enumerator.MoveNext()) { TrixelEmplacement trixel = enumerator.Current; for (int index = 0; index < 6; ++index) { FaceOrientation face = (FaceOrientation)index; TrixelEmplacement traversed = trixel.GetTraversal(face); if (this.IsBorderTrixelFace(traversed)) { if (Enumerable.Any <TrixelSurface>((IEnumerable <TrixelSurface>) this.surfaces, (Func <TrixelSurface, bool>)(x => { if (x.Orientation == face) { return(x.AnyRectangleContains(trixel)); } else { return(false); } }))) { context.Removed.Add(new TrixelFace(trixel, face)); } if (context.TrixelsExist) { context.Added.Add(new TrixelFace(trixel, face)); } } else { FaceOrientation oppositeFace = FezMath.GetOpposite(face); if (Enumerable.Any <TrixelSurface>((IEnumerable <TrixelSurface>) this.surfaces, (Func <TrixelSurface, bool>)(x => { if (x.Orientation == oppositeFace) { return(x.AnyRectangleContains(traversed)); } else { return(false); } }))) { context.Removed.Add(new TrixelFace(traversed, oppositeFace)); } if (!context.TrixelsExist) { context.Added.Add(new TrixelFace(traversed, oppositeFace)); } } } } } }
public TrixelSurface(FaceOrientation orientation, TrixelEmplacement firstTrixel) { this.RectangularParts = new List <RectangularTrixelSurfacePart>(); this.Orientation = orientation; this.Initialize(); this.Trixels.Add(firstTrixel); this.MarkAsDirty(); this.InitializeDepth(); }
public async Task <ActionResult> DeleteConfirmed(int id) { FaceOrientation faceOrientation = await db.FaceOrientations.FindAsync(id); db.FaceOrientations.Remove(faceOrientation); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public TrixelSurface(FaceOrientation orientation, TrixelEmplacement firstTrixel) { this.RectangularParts = new List<RectangularTrixelSurfacePart>(); this.Orientation = orientation; this.Initialize(); this.Trixels.Add(firstTrixel); this.MarkAsDirty(); this.InitializeDepth(); }
public bool Pick(Vector2 curMousePos, out float dist, out Vector3 hitPoint, out FaceOrientation orientation) { dist = float.MaxValue; float distArrow; orientation = FaceOrientation.up; bool hitUp = Up.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.up; dist = distArrow; } bool hitDown = Down.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.down; dist = distArrow; } bool hitNorth = North.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.north; dist = distArrow; } bool hitSouth = South.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.south; dist = distArrow; } bool hitEast = East.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.east; dist = distArrow; } bool hitWest = West.Pick(curMousePos.X, curMousePos.Y, out hitPoint, out distArrow); if (distArrow < dist && distArrow >= 0) { orientation = FaceOrientation.west; dist = distArrow; } return(hitUp | hitDown | hitNorth | hitSouth | hitEast | hitWest); }
public static bool IsSide(this FaceOrientation orientation) { if (orientation != FaceOrientation.Down) { return(orientation != FaceOrientation.Top); } else { return(false); } }
public void SetPhiLight(byte orientation) { #if !UNITY Data.PositionPhi.W = (float)((int)orientation - 2) * 1.570796f; #else Data.PositionPhi.w = (float)((int)orientation - 2) * 1.570796f; #endif phiQuat = TrileInstance.QuatLookup[orientation]; phiOri = TrileInstance.OrientationLookup[orientation]; }
public async Task <ActionResult> Edit([Bind(Include = "FaceOrientationID,Orientation")] FaceOrientation faceOrientation) { if (ModelState.IsValid) { db.Entry(faceOrientation).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(faceOrientation)); }
public bool IsBorderTrile(ref TrileEmplacement id) { bool flag = false; for (int index = 0; index < 6 && !flag; ++index) { FaceOrientation face = (FaceOrientation)index; flag = flag | this.IsBorderTrileFace(ref id, ref face); } return(flag); }
public async Task <ActionResult> Create([Bind(Include = "FaceOrientationID,Orientation")] FaceOrientation faceOrientation) { if (ModelState.IsValid) { db.FaceOrientations.Add(faceOrientation); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(faceOrientation)); }
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; } }
public CubeFace GetFace(FaceOrientation orientation) { CubeFace result = null; foreach (CubeFace face in _faces) { if (face.Orientation == orientation) { result = face; } } return(result); }
public bool IsBorderTrileFace(ref TrileEmplacement id, ref FaceOrientation face) { TrileInstance trileInstance; if (this.levelData.Triles.TryGetValue(id.GetTraversal(ref face), out trileInstance) && !trileInstance.Trile.SeeThrough) { return(trileInstance.ForceSeeThrough); } else { return(true); } }
private bool DoesContainFace(FaceOrientation orientation) { bool result = false; foreach (CubeFace face in _faces) { if (face.Orientation == orientation) { result = true; } } return(result); }
private static Point SelectTile(VoxelType VoxelType, FaceOrientation Orientation) { switch (Orientation) { case FaceOrientation.Top: return(VoxelType.Top); case FaceOrientation.Bottom: return(VoxelType.Bottom); default: return(VoxelType.Sides); } }
// GET: FaceOrientations/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FaceOrientation faceOrientation = await db.FaceOrientations.FindAsync(id); if (faceOrientation == null) { return(HttpNotFound()); } return(View(faceOrientation)); }
private bool Pick(Vector2 curMousePos, out float dist, out Vector3 hitPoint, out FaceOrientation orientation) { hitPoint = Vector3.Zero; orientation = FaceOrientation.up; dist = float.MaxValue; if (Enabled) { return(_arrows.Pick(curMousePos, out dist, out hitPoint, out orientation)); } else { return(false); } }
public ActionResult Index() { ViewBag.Title = "Home"; FaceOrientation orien = new FaceOrientation(); var lll = orien.FaceOrient(); //foreach (var face in orien.faceList){ // lookingAtScreen = orien.CountFacesLookingAtScreen(face); //} var test = orien.lookingAtBoard; ViewBag.Title = test; return(View(test)); }
private bool NoTop(TrileInstance instance) { FaceOrientation face = FaceOrientation.Top; TrileEmplacement traversal = instance.Emplacement.GetTraversal(ref face); TrileInstance trileInstance = this.LevelManager.TrileInstanceAt(ref traversal); if (trileInstance != null && trileInstance.Enabled) { return(trileInstance.Trile.Immaterial); } else { return(true); } }
public static Axis AsAxis(this FaceOrientation face) { switch (face) { case FaceOrientation.Left: case FaceOrientation.Right: return(Axis.X); case FaceOrientation.Back: case FaceOrientation.Front: return(Axis.Z); default: return(Axis.Y); } }
private void Initialize() { this.Trixels = new HashSet <TrixelEmplacement>(); this.tangentFace = FezMath.GetTangent(this.Orientation); this.bitangentFace = FezMath.GetBitangent(this.Orientation); this.tangentFaces = new FaceOrientation[4] { this.tangentFace, this.bitangentFace, FezMath.GetOpposite(this.tangentFace), FezMath.GetOpposite(this.bitangentFace) }; this.normal = FezMath.AsVector(this.Orientation); this.Tangent = FezMath.AsVector(this.tangentFace); this.Bitangent = FezMath.AsVector(this.bitangentFace); }
private void Initialize() { this.Trixels = new HashSet<TrixelEmplacement>(); this.tangentFace = FezMath.GetTangent(this.Orientation); this.bitangentFace = FezMath.GetBitangent(this.Orientation); this.tangentFaces = new FaceOrientation[4] { this.tangentFace, this.bitangentFace, FezMath.GetOpposite(this.tangentFace), FezMath.GetOpposite(this.bitangentFace) }; this.normal = FezMath.AsVector(this.Orientation); this.Tangent = FezMath.AsVector(this.tangentFace); this.Bitangent = FezMath.AsVector(this.bitangentFace); }
public bool IsCornerTrile(ref TrileEmplacement id, ref FaceOrientation face1, ref FaceOrientation face2) { TrileInstance trileInstance; if (!this.levelData.Triles.TryGetValue(id.GetTraversal(ref face1), out trileInstance) || trileInstance.Trile.SeeThrough || trileInstance.ForceSeeThrough) { return(true); } TrileEmplacement traversal = id.GetTraversal(ref face2); if (!this.levelData.Triles.TryGetValue(traversal, out trileInstance) || trileInstance.Trile.SeeThrough || trileInstance.ForceSeeThrough) { return(true); } traversal = traversal.GetTraversal(ref face1); return(!this.levelData.Triles.TryGetValue(traversal, out trileInstance) || trileInstance.Trile.SeeThrough || trileInstance.ForceSeeThrough); }
public CubeFace(Vector3 from, Vector3 to, FaceOrientation orientation, Vector4 uV, string textureName, bool visible, Box parentBox) { _orientation = orientation; _textureName = textureName; _visible = visible; CullFace = CullFace.none; _rotation = 0; TintIndex = -1; _uV = uV; _parentBox = parentBox; _treeNode = new TreeNodeFace(this); SetVertices(from, to); SetIndices(); SetVertexBuffer(_vertices); SetIndexBuffer(_indices); }
public CubeFace(JsonFace face, Vector3 from, Vector3 to, Box parentBox) { _orientation = face.Orientation; _textureName = face.TextureName; _visible = face.Visible; CullFace = face.CullFace; _rotation = face.Rotation; TintIndex = face.TintIndex; _uV = face.UV; _parentBox = parentBox; _treeNode = new TreeNodeFace(this); SetVertices(from, to); SetIndices(); SetVertexBuffer(_vertices); SetIndexBuffer(_indices); }
public ZuishSlot(string trileName, FaceOrientation face) { this.TrileName = trileName; this.Face = face; }
public void SetPhiLight(byte orientation) { this.data.PositionPhi.W = (float) ((int) orientation - 2) * 1.570796f; this.phiQuat = TrileInstance.QuatLookup[(int) orientation]; this.phiOri = TrileInstance.OrientationLookup[(int) orientation]; }
public bool Equals(FaceOrientation x, FaceOrientation y) { return x == y; }
private void CullInstances(bool viewChanged) { if (this.CameraManager.ProjectionTransition && (FezMath.IsOrthographic(this.CameraManager.Viewpoint) || this.lastUpdateAction == TrileUpdateAction.NoCull) || this.EngineState.SkipRendering) return; if (this.EngineState.LoopRender) this.lastUpdateAction = TrileUpdateAction.None; TrileUpdateAction action = this.DetermineCullType(); bool flag1 = false; float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); switch (action) { case TrileUpdateAction.SingleFaceCullPartial: case TrileUpdateAction.SingleFaceCullFull: Vector3 vector3_1 = FezMath.SideMask(this.CameraManager.Viewpoint); BoundingFrustum frustum1 = this.CameraManager.Frustum; BoundingBox boundingBox1 = new BoundingBox() { Min = { X = -frustum1.Left.D * frustum1.Left.DotNormal(vector3_1), Y = -frustum1.Bottom.D * frustum1.Bottom.Normal.Y }, Max = { X = -frustum1.Right.D * frustum1.Right.DotNormal(vector3_1), Y = -frustum1.Top.D * frustum1.Top.Normal.Y } }; Vector3 vector3_2 = FezMath.Min(boundingBox1.Min, boundingBox1.Max); Vector3 vector3_3 = FezMath.Max(boundingBox1.Min, boundingBox1.Max); this.cullingBounds = new Rectangle() { X = (int) Math.Floor((double) vector3_2.X) - 1, Y = (int) Math.Floor((double) vector3_2.Y) - 1, Width = (int) Math.Ceiling((double) vector3_3.X - (double) vector3_2.X) + 3, Height = (int) Math.Ceiling((double) vector3_3.Y - (double) vector3_2.Y) + 3 }; if (this.cullingBounds.Width < 0 || this.cullingBounds.Height < 0 || (double) this.CameraManager.Radius > 120.0 * (double) viewScale) this.cullingBounds = this.lastCullingBounds; flag1 = ((flag1 ? 1 : 0) | (Math.Abs(this.lastCullingBounds.X - this.cullingBounds.X) > 0 ? 1 : (Math.Abs(this.lastCullingBounds.Y - this.cullingBounds.Y) > 0 ? 1 : 0))) != 0; break; case TrileUpdateAction.TwoFaceCullPartial: case TrileUpdateAction.TwoFaceCullFull: Vector3 vector3_4 = FezMath.SideMask(this.CameraManager.Viewpoint); BoundingFrustum frustum2 = this.CameraManager.Frustum; Vector3 vector3_5 = FezMath.Sign(this.CameraManager.View.Forward); FaceOrientation faceOrientation1 = FezMath.OrientationFromDirection(vector3_5.X * Vector3.UnitX); FaceOrientation faceOrientation2 = FezMath.OrientationFromDirection(-vector3_5.Z * Vector3.UnitZ); bool flag2 = ((flag1 ? 1 : 0) | (faceOrientation1 != this.xOrientation ? 1 : (faceOrientation2 != this.zOrientation ? 1 : 0))) != 0; this.xOrientation = faceOrientation1; this.zOrientation = faceOrientation2; BoundingBox boundingBox2 = new BoundingBox() { Min = { X = -frustum2.Left.D * frustum2.Left.DotNormal(vector3_4), Y = -frustum2.Bottom.D * frustum2.Bottom.Normal.Y }, Max = { X = -frustum2.Right.D * frustum2.Right.DotNormal(vector3_4), Y = -frustum2.Top.D * frustum2.Top.Normal.Y } }; Vector3 vector3_6 = FezMath.Min(boundingBox2.Min, boundingBox2.Max); Vector3 vector3_7 = FezMath.Max(boundingBox2.Min, boundingBox2.Max); this.cullingBounds = new Rectangle() { X = (int) Math.Floor((double) vector3_6.X) - 1, Y = (int) Math.Floor((double) vector3_6.Y) - 1, Width = (int) Math.Ceiling((double) vector3_7.X - (double) vector3_6.X) + 3, Height = (int) Math.Ceiling((double) vector3_7.Y - (double) vector3_6.Y) + 3 }; if (this.cullingBounds.Width < 0 || this.cullingBounds.Height < 0 || (double) this.CameraManager.Radius > 120.0 * (double) viewScale) this.cullingBounds = this.lastCullingBounds; flag1 = flag2 | Math.Abs(this.lastCullingBounds.Y - this.cullingBounds.Y) > 0; break; case TrileUpdateAction.TriFaceCull: Vector3 vector3_8 = FezMath.Sign(this.CameraManager.View.Forward); FaceOrientation faceOrientation3 = FezMath.OrientationFromDirection(vector3_8.X * Vector3.UnitX); FaceOrientation faceOrientation4 = FezMath.OrientationFromDirection(-vector3_8.Z * Vector3.UnitZ); flag1 = ((flag1 ? 1 : 0) | (faceOrientation3 != this.xOrientation ? 1 : (faceOrientation4 != this.zOrientation ? 1 : 0))) != 0; this.xOrientation = faceOrientation3; this.zOrientation = faceOrientation4; if ((double) Math.Abs(this.CameraManager.InterpolatedCenter.Y - this.lastCullHeight) >= 1.0 || (double) this.lastRadius != (double) this.CameraManager.Radius) { flag1 = true; break; } else break; case TrileUpdateAction.NoCull: if ((double) Math.Abs(this.CameraManager.InterpolatedCenter.Y - this.lastCullHeight) >= 5.0) { flag1 = true; break; } else break; } this.lastHeight = this.CameraManager.InterpolatedCenter.Y; this.lastRadius = this.CameraManager.Radius; if (((flag1 | viewChanged ? 1 : 0) | (this.lastUpdateAction == action || this.lastUpdateAction == TrileUpdateAction.SingleFaceCullFull && action == TrileUpdateAction.SingleFaceCullPartial ? 0 : (this.lastUpdateAction != TrileUpdateAction.TwoFaceCullFull ? 1 : (action != TrileUpdateAction.TwoFaceCullPartial ? 1 : 0)))) != 0) { this.UpdateInstances(action); this.lastCullingBounds = this.cullingBounds; this.lastCullHeight = this.CameraManager.InterpolatedCenter.Y; } this.lastUpdateAction = action; }
public CollisionType GetRotatedFace(FaceOrientation face) { FaceOrientation index = FezMath.OrientationFromPhi(FezMath.ToPhi(face) - this.Phi); CollisionType collisionType = this.Trile.Faces[index]; if (collisionType == CollisionType.TopOnly) { TrileEmplacement emplacement = this.Emplacement; ++emplacement.Y; Vector3 mask = FezMath.GetMask(FezMath.AsAxis(face)); TrileInstance trileInstance; if (TrileInstance.LevelManager.Triles.TryGetValue(emplacement, out trileInstance) && trileInstance.Enabled && !trileInstance.IsMovingGroup && (trileInstance.Trile.Geometry == null || !trileInstance.Trile.Geometry.Empty || trileInstance.Trile.Faces[index] != CollisionType.None) && (!trileInstance.Trile.Immaterial && trileInstance.Trile.Faces[index] != CollisionType.Immaterial && (!trileInstance.Trile.Thin && !ActorTypeExtensions.IsPickable(trileInstance.Trile.ActorSettings.Type)) && (((double) trileInstance.Trile.Size.Y == 1.0 || trileInstance.ForceTopMaybe) && FezMath.AlmostEqual(FezMath.Dot(trileInstance.Center, mask), FezMath.Dot(this.Center, mask))))) collisionType = CollisionType.None; } return collisionType; }
public int GetHashCode(FaceOrientation obj) { return (int) obj; }
private void BuildMesh() { Vector3 a = (this.Volume.To - this.Volume.From) / 2f; float num1 = a.Y * 2f; Mesh mesh1 = new Mesh(); Mesh mesh2 = new Mesh(); FaceOrientation[] faceOrientationArray = new FaceOrientation[4] { FaceOrientation.Front, FaceOrientation.Right, FaceOrientation.Back, FaceOrientation.Left }; foreach (FaceOrientation faceOrientation in faceOrientationArray) { Vector3 vector3_1 = FezMath.AsVector(FezMath.IsSide(FezMath.GetTangent(faceOrientation)) ? FezMath.GetTangent(faceOrientation) : FezMath.GetBitangent(faceOrientation)); Vector3 origin = this.Center + FezMath.AsVector(faceOrientation) * a; float num2 = Math.Abs(FezMath.Dot(a, vector3_1)) * 2f; Vector3 vector3_2 = origin + (a - new Vector3(0.5f)) * (-vector3_1 - Vector3.UnitY); Vector3 vector3_3 = origin + (a - new Vector3(0.5f)) * (-vector3_1 + Vector3.UnitY); for (int index = 0; (double) index < (double) num2; ++index) { Vector3 p = vector3_2 + (float) index * vector3_1; if (!Enumerable.Any<Group>((IEnumerable<Group>) mesh1.Groups, (Func<Group, bool>) (g => FezMath.AlmostEqual(g.Position, p)))) mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p; p = vector3_3 + (float) index * vector3_1; if (!Enumerable.Any<Group>((IEnumerable<Group>) mesh1.Groups, (Func<Group, bool>) (g => FezMath.AlmostEqual(g.Position, p)))) mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p; } Vector3 vector3_4 = origin + (a - new Vector3(0.5f)) * (-vector3_1 - Vector3.UnitY); Vector3 vector3_5 = origin + (a - new Vector3(0.5f)) * (vector3_1 - Vector3.UnitY); for (int index = 0; (double) index < (double) num1; ++index) { Vector3 p = vector3_4 + (float) index * Vector3.UnitY; if (!Enumerable.Any<Group>((IEnumerable<Group>) mesh1.Groups, (Func<Group, bool>) (g => FezMath.AlmostEqual(g.Position, p)))) mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p; p = vector3_5 + (float) index * Vector3.UnitY; if (!Enumerable.Any<Group>((IEnumerable<Group>) mesh1.Groups, (Func<Group, bool>) (g => FezMath.AlmostEqual(g.Position, p)))) mesh1.AddFace(Vector3.One * 2f, Vector3.Zero, faceOrientation, true).Position = p; } mesh2.AddFace(num2 * FezMath.Abs(vector3_1) + num1 * Vector3.UnitY, origin, faceOrientation, Color.White, true); } foreach (Group group in mesh1.Groups) group.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.5 > this.Host.random.NextDouble() ? 0.5f : 0.0f, 0.5 > this.Host.random.NextDouble() ? 0.5f : 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f)); mesh2.Collapse<VertexPositionNormalColor>(); IndexedUserPrimitives<VertexPositionNormalColor> indexedUserPrimitives1 = mesh2.FirstGroup.Geometry as IndexedUserPrimitives<VertexPositionNormalColor>; mesh1.CollapseWithNormalTexture<FezVertexPositionNormalTexture>(); IndexedUserPrimitives<FezVertexPositionNormalTexture> indexedUserPrimitives2 = mesh1.FirstGroup.Geometry as IndexedUserPrimitives<FezVertexPositionNormalTexture>; this.instanceIndex = this.Host.HolesBodyMesh.Groups.Count; this.Host.HolesBodyMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionInstance>(Enumerable.ToArray<VertexPositionInstance>(Enumerable.Select<VertexPositionNormalColor, VertexPositionInstance>((IEnumerable<VertexPositionNormalColor>) indexedUserPrimitives1.Vertices, (Func<VertexPositionNormalColor, VertexPositionInstance>) (x => new VertexPositionInstance(x.Position) { InstanceIndex = (float) this.instanceIndex }))), indexedUserPrimitives1.Indices, PrimitiveType.TriangleList); this.Host.HolesFringeMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionTextureInstance>(Enumerable.ToArray<VertexPositionTextureInstance>(Enumerable.Select<FezVertexPositionNormalTexture, VertexPositionTextureInstance>((IEnumerable<FezVertexPositionNormalTexture>) indexedUserPrimitives2.Vertices, (Func<FezVertexPositionNormalTexture, VertexPositionTextureInstance>) (x => new VertexPositionTextureInstance(x.Position, x.TextureCoordinate) { InstanceIndex = (float) this.instanceIndex }))), indexedUserPrimitives2.Indices, PrimitiveType.TriangleList); }
public void Fill(MapTree.TreeFillContext context, MapNode parent, FaceOrientation origin) { if (this.Valid) return; TrileSet trileSet = (TrileSet) null; Level level; try { level = SdlSerializer.Deserialize<Level>(context.ContentRoot + "\\Levels\\" + this.LevelName + ".lvl.sdl"); if (level.TrileSetName != null) { if (!context.TrileSetCache.TryGetValue(level.TrileSetName, out trileSet)) context.TrileSetCache.Add(level.TrileSetName, trileSet = SdlSerializer.Deserialize<TrileSet>(context.ContentRoot + "\\Trile Sets\\" + level.TrileSetName + ".ts.sdl")); } } catch (Exception ex) { Console.WriteLine("Warning : Level " + this.LevelName + " could not be loaded because it has invalid markup. Skipping..."); this.Valid = false; return; } this.NodeType = level.NodeType; this.Conditions.ChestCount = Enumerable.Count<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) level.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObjectName.IndexOf("treasure", StringComparison.InvariantCultureIgnoreCase) != -1)) / 2; this.Conditions.ScriptIds = Enumerable.ToList<int>(Enumerable.Select<Script, int>(Enumerable.Where<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (x => x.IsWinCondition)), (Func<Script, int>) (x => x.Id))); this.Conditions.SplitUpCount = Enumerable.Count<TrileInstance>(Enumerable.Union<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, Enumerable.SelectMany<TrileInstance, TrileInstance>(Enumerable.Where<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, (Func<TrileInstance, bool>) (x => x.Overlaps)), (Func<TrileInstance, IEnumerable<TrileInstance>>) (x => (IEnumerable<TrileInstance>) x.OverlappedTriles))), (Func<TrileInstance, bool>) (x => { if (x.TrileId >= 0) return trileSet[x.TrileId].ActorSettings.Type == ActorType.GoldenCube; else return false; })); this.Conditions.CubeShardCount = Enumerable.Count<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, (Func<TrileInstance, bool>) (x => { if (x.TrileId >= 0) return trileSet[x.TrileId].ActorSettings.Type == ActorType.CubeShard; else return false; })); this.Conditions.OtherCollectibleCount = Enumerable.Count<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, (Func<TrileInstance, bool>) (x => { if (x.TrileId >= 0 && ActorTypeExtensions.IsTreasure(trileSet[x.TrileId].ActorSettings.Type)) return trileSet[x.TrileId].ActorSettings.Type != ActorType.CubeShard; else return false; })) + Enumerable.Count<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) level.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => x.ArtObjectName == "treasure_mapAO")); this.Conditions.LockedDoorCount = Enumerable.Count<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, (Func<TrileInstance, bool>) (x => { if (x.TrileId >= 0) return trileSet[x.TrileId].ActorSettings.Type == ActorType.Door; else return false; })); this.Conditions.UnlockedDoorCount = Enumerable.Count<TrileInstance>((IEnumerable<TrileInstance>) level.Triles.Values, (Func<TrileInstance, bool>) (x => { if (x.TrileId >= 0) return trileSet[x.TrileId].ActorSettings.Type == ActorType.UnlockedDoor; else return false; })); int num1 = Enumerable.Count<KeyValuePair<int, ArtObjectInstance>>((IEnumerable<KeyValuePair<int, ArtObjectInstance>>) level.ArtObjects, (Func<KeyValuePair<int, ArtObjectInstance>, bool>) (x => x.Value.ArtObjectName.IndexOf("fork", StringComparison.InvariantCultureIgnoreCase) != -1)); int num2 = Enumerable.Count<KeyValuePair<int, ArtObjectInstance>>((IEnumerable<KeyValuePair<int, ArtObjectInstance>>) level.ArtObjects, (Func<KeyValuePair<int, ArtObjectInstance>, bool>) (x => x.Value.ArtObjectName.IndexOf("qr", StringComparison.InvariantCultureIgnoreCase) != -1)); int num3 = Enumerable.Count<KeyValuePair<int, Volume>>((IEnumerable<KeyValuePair<int, Volume>>) level.Volumes, (Func<KeyValuePair<int, Volume>, bool>) (x => { if (x.Value.ActorSettings != null && x.Value.ActorSettings.CodePattern != null) return x.Value.ActorSettings.CodePattern.Length > 0; else return false; })); int num4 = this.LevelName == "OWL" ? 0 : Enumerable.Count<KeyValuePair<int, NpcInstance>>((IEnumerable<KeyValuePair<int, NpcInstance>>) level.NonPlayerCharacters, (Func<KeyValuePair<int, NpcInstance>, bool>) (x => x.Value.Name == "Owl")); int num5 = Enumerable.Count<KeyValuePair<int, ArtObjectInstance>>((IEnumerable<KeyValuePair<int, ArtObjectInstance>>) level.ArtObjects, (Func<KeyValuePair<int, ArtObjectInstance>, bool>) (x => { if (x.Value.ArtObjectName.Contains("BIT_DOOR")) return !x.Value.ArtObjectName.Contains("BROKEN"); else return false; })); int num6 = Enumerable.Count<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (s => Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) s.Actions, (Func<ScriptAction, bool>) (a => { if (a.Object.Type == "Level") return a.Operation == "ResolvePuzzle"; else return false; })))); int num7 = Enumerable.Contains<string>((IEnumerable<string>) MapNode.PuzzleLevels, this.LevelName) ? (this.LevelName == "CLOCK" ? 4 : 1) : 0; this.Conditions.SecretCount = num1 + num2 + num3 + num4 + num6 + num7 + num5; this.HasLesserGate = Enumerable.Any<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) level.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { if (x.ArtObjectName.IndexOf("lesser_gate", StringComparison.InvariantCultureIgnoreCase) != -1) return x.ArtObjectName.IndexOf("base", StringComparison.InvariantCultureIgnoreCase) == -1; else return false; })); this.HasWarpGate = Enumerable.Any<ArtObjectInstance>((IEnumerable<ArtObjectInstance>) level.ArtObjects.Values, (Func<ArtObjectInstance, bool>) (x => { if (!(x.ArtObjectName == "GATE_GRAVEAO") && !(x.ArtObjectName == "GATEAO") && (!(x.ArtObjectName == "GATE_INDUSTRIALAO") && !(x.ArtObjectName == "GATE_SEWERAO")) && !(x.ArtObjectName == "ZU_GATEAO")) return x.ArtObjectName == "GRAVE_GATEAO"; else return true; })); foreach (Script script in level.Scripts.Values) { foreach (ScriptAction scriptAction in script.Actions) { if (scriptAction.Object.Type == "Level" && scriptAction.Operation.Contains("Level")) { MapNode.Connection connection = new MapNode.Connection(); bool flag = true; foreach (ScriptTrigger scriptTrigger in script.Triggers) { if (scriptTrigger.Object.Type == "Volume" && scriptTrigger.Event == "Enter" && scriptTrigger.Object.Identifier.HasValue) { int key = scriptTrigger.Object.Identifier.Value; Volume volume; if (!level.Volumes.TryGetValue(key, out volume)) { Console.WriteLine("Warning : A level-changing script links to a nonexistent volume in " + (object) this.LevelName + " (Volume Id #" + (string) (object) key + ")"); flag = false; break; } else if (volume.ActorSettings != null && volume.ActorSettings.IsSecretPassage) { flag = false; break; } else { connection.Face = Enumerable.First<FaceOrientation>((IEnumerable<FaceOrientation>) volume.Orientations); break; } } } if (flag) { string key = scriptAction.Operation == "ReturnToLastLevel" ? parent.LevelName : scriptAction.Arguments[0]; if (!(key == "PYRAMID") && !(key == "CABIN_INTERIOR_A") && (!(key == "THRONE") || !(this.LevelName == "ZU_CITY_RUINS")) && (!(key == "ZU_CITY_RUINS") || !(this.LevelName == "THRONE"))) { MapNode mapNode; if (!context.LoadedNodes.TryGetValue(key, out mapNode)) { mapNode = new MapNode() { LevelName = key }; context.LoadedNodes.Add(key, mapNode); connection.Node = mapNode; if (connection.Node != parent) { if (parent != null && origin == connection.Face) connection.Face = FezMath.GetOpposite(origin); if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.UpLevels, key)) connection.Face = FaceOrientation.Top; else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.DownLevels, key)) connection.Face = FaceOrientation.Down; else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.OppositeLevels, key)) connection.Face = FezMath.GetOpposite(connection.Face); else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.BackLevels, key)) connection.Face = FaceOrientation.Back; else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.LeftLevels, key)) connection.Face = FaceOrientation.Left; else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.RightLevels, key)) connection.Face = FaceOrientation.Right; else if (Enumerable.Contains<string>((IEnumerable<string>) MapNode.FrontLevels, key)) connection.Face = FaceOrientation.Front; float num8; if (MapNode.OversizeLinks.TryGetValue(key, out num8)) connection.BranchOversize = num8; this.Connections.Add(connection); break; } else break; } else break; } } } } } this.Valid = true; foreach (MapNode.Connection connection in this.Connections) connection.Node.Fill(context, this, connection.Face); }
protected FaceOrientation GetHoveredFace(BoundingBox box, Ray ray) { float intersectionMin = float.MaxValue; BoundingBox[] sides = new BoundingBox[6]; sides[0] = new BoundingBox(new Vector3(box.Min.X, box.Min.Y, box.Min.Z), new Vector3(box.Min.X, box.Max.Y, box.Max.Z)); sides[1] = new BoundingBox(new Vector3(box.Max.X, box.Min.Y, box.Min.Z), new Vector3(box.Max.X, box.Max.Y, box.Max.Z)); sides[2] = new BoundingBox(new Vector3(box.Min.X, box.Min.Y, box.Min.Z), new Vector3(box.Max.X, box.Min.Y, box.Max.Z)); sides[3] = new BoundingBox(new Vector3(box.Min.X, box.Max.Y, box.Min.Z), new Vector3(box.Max.X, box.Max.Y, box.Max.Z)); sides[4] = new BoundingBox(new Vector3(box.Min.X, box.Min.Y, box.Min.Z), new Vector3(box.Max.X, box.Max.Y, box.Min.Z)); sides[5] = new BoundingBox(new Vector3(box.Min.X, box.Min.Y, box.Max.Z), new Vector3(box.Max.X, box.Max.Y, box.Max.Z)); FaceOrientation[] faces = new FaceOrientation[6]; faces[0] = FaceOrientation.Right; faces[1] = FaceOrientation.Left; faces[2] = FaceOrientation.Top; faces[3] = FaceOrientation.Down; faces[4] = FaceOrientation.Front; faces[5] = FaceOrientation.Back; FaceOrientation face = FaceOrientation.Top; for (int i = 0; i < 6; i++) { float? intersection = ray.Intersects(sides[i]); if (intersection.HasValue && intersection < intersectionMin) { intersectionMin = intersection.Value; face = faces[i]; } } return face; }
public bool IsBorderTrixelFace(TrixelEmplacement id, FaceOrientation face) { return this.IsBorderTrixelFace(id.GetTraversal(face)); }
public bool CanContain(TrixelEmplacement trixel, FaceOrientation face) { return face == this.Orientation && (int) Vector3.Dot(trixel.Position, this.normal) == this.depth && (this.Trixels.Contains(trixel + this.Tangent) || this.Trixels.Contains(trixel + this.Bitangent) || (this.Trixels.Contains(trixel - this.Tangent) || this.Trixels.Contains(trixel - this.Bitangent))); }