public Stairs(Vector3 position, bool westEast, bool shapeL) : base(position) { Position = position; var original = new CubeGraphic { Position = position, DrawFaces = CubeFaces.All ^ CubeFaces.Front ^ CubeFaces.Floor }; var nextFloor = new CubeGraphic { Position = original.Position + Vector3.Down, DrawFaces = CubeFaces.Sides ^ CubeFaces.Front }; var stairs = new ModelGraphic { Position = nextFloor.Position }; original.Texture = nextFloor.Texture = nextFloor.Resources.Content.Load<Texture2D>("Textures/Wall"); if (shapeL) { stairs.Model = stairs.Resources.Content.Load<Model>("Models/stairs1"); if (westEast) nextFloor.DrawFaces ^= CubeFaces.Right; else nextFloor.DrawFaces ^= CubeFaces.Left; } else { stairs.Model = stairs.Resources.Content.Load<Model>("Models/stairs"); nextFloor.DrawFaces ^= CubeFaces.Back; } if (westEast) { original.Rotation = nextFloor.Rotation = new Vector3(0, MathHelper.PiOver2, 0); stairs.Rotation = new Vector3(0, MathHelper.PiOver2, 0); stairs.MirrorX = true; } graphics = new GraphicsCollection(original, nextFloor, stairs); graphicsProviders.SubProviders.Add(graphics); }
public Door(Vector3 position, bool isWestEast, bool isOpen, Items.Door door) : base(position) { doorFrame = new ModelGraphic(); doorFrame.Model = doorFrame.Resources.Content.Load<Model>("Models/outterDoor"); doorFrame.Rotation = isWestEast ? new Vector3(0, MathHelper.PiOver2, 0) : Vector3.Zero; doorFrame.Position = position + (isWestEast ? new Vector3(0.4f, 0, 0) : new Vector3(0, 0, 0.4f)); doorFrame.Scale = new Vector3(1, 0.98f, 0.2f); this.door = door; door.Graphic.Rotation = isWestEast ? new Vector3(0, MathHelper.PiOver2, 0) : Vector3.Zero; door.Position = position + new Vector3((1 - door.Size.X) / 2f, 0, (1 - door.Size.Z) / 2f); SubItems.Add(door); graphics = new GraphicsCollection(wallGraphic, doorFrame); graphics.SubDrawable.Add(door); graphicsProviders.SubProviders.Add(graphics); ContentActivated = isOpen; if (door.HasButton) { Vector3 shift = !isWestEast ? new Vector3(0, 0, 0.4f) : new Vector3(0.4f, 0, 0); var t = new SwitchActuator(position + new Vector3(0, 0.2f, 0) + shift, this, new ActionStateX(ActionState.Toggle, 0, isOnceOnly: false)); SubItems.Add(t); } }