void HoleTypeSet() { if (type > 2 || type < -2) { type = 0; } if (type == 0) { HoleType = HoleType._potato; } else if (type == -1 || type == 2) { HoleType = HoleType._radish; } else if (type == 1 || type == -2) { HoleType = HoleType._pepper; } int left = (int)HoleType + 1; int right = (int)HoleType - 1; if (right < 0) { right = 2; } if (left > 2) { left = 0; } rightType = (HoleType)Enum.ToObject(typeof(HoleType), right); leftType = (HoleType)Enum.ToObject(typeof(HoleType), left); }
public void setWall(float lenght, float weight, float thick, Vector3 pos, int wallNum, Vector3 RoomPos, HoleType type = 0) { this.Type = type; this.wallNum = wallNum; this.shape.init(new Vector3(lenght, weight, thick)); this.pos.init(pos); this.RoomPos.init(RoomPos); }
public void Vertical_Hole1() { HoleType ht = new HoleType(new Point(1, 1), new Point(1, 1)); String expected = "Vertical"; String actual = ht.ToString(); Assert.AreEqual(expected, actual); }
public void Horizontal_Hole2() { HoleType ht = new HoleType(new Point(1, 1), new Point(1, 10)); String expected = "Horizontal"; String actual = ht.ToString(); Assert.AreEqual(expected, actual); }
public void Slanted_Hole2() { HoleType ht = new HoleType(new Point(1, 1), new Point(1, 5)); String expected = "Slanted"; String actual = ht.ToString(); Assert.AreEqual(expected, actual); }
public bool SetType(ProfileType profileType, HoleType holeType, PathType pathType) { bool valid = true; ProfileParameters.ProfileType = profileType; ProfileParameters.HoleType = holeType; PathParameters.PathType = pathType; return(valid); }
public Item GetOrFindHole(HoleType type) { if (type == Black) { return(blackHoleInstance ?? Item.list.Find(item => item.itemId == "BlackHoleSphere")); } else { return(whiteHoleInstance ?? Item.list.Find(item => item.itemId == "WhiteHoleSphere")); } }
public void SetHole(HoleType type, Vector2 pos) { if ((HoleType)type == HoleType.Door) { this.Hole = new door(wallNum, pos.x); } else if ((HoleType)type == HoleType.Windows) { this.Hole = new windows(wallNum, pos); } }
private void SetPrimShapeParams(LLPrimitive prim, int holeShape, Vector3 cut, float hollow, Vector3 twist, Vector3 topSize, Vector3 topShear) { HoleType hole = (HoleType)holeShape; if (hole != HoleType.Same && hole != HoleType.Circle && hole != HoleType.Square && hole != HoleType.Triangle) { hole = HoleType.Same; } // Clamp the cut values cut.X = Utils.Clamp(cut.X, 0f, 1f); cut.Y = Utils.Clamp(cut.Y, 0f, 1f); if (cut.Y - cut.X < 0.05f) { cut.X = cut.Y - 0.05f; if (cut.X < 0f) { cut.X = 0f; cut.Y = 0.05f; } } // Clamp hollow hollow = Utils.Clamp(hollow, 0f, 0.95f); // Clamp the twist values twist.X = Utils.Clamp(twist.X, -1f, 1f); twist.Y = Utils.Clamp(twist.Y, -1f, 1f); // Clamp the taper values topSize.X = Utils.Clamp(topSize.X, 0f, 2f); topSize.Y = Utils.Clamp(topSize.Y, 0f, 2f); // Clamp the top shear values topShear.X = Utils.Clamp(topShear.X, -0.5f, 0.5f); topShear.Y = Utils.Clamp(topShear.Y, -0.5f, 0.5f); prim.Prim.PrimData.ProfileHole = hole; prim.Prim.PrimData.ProfileBegin = cut.X; prim.Prim.PrimData.ProfileEnd = cut.Y; prim.Prim.PrimData.ProfileHollow = hollow; prim.Prim.PrimData.PathTwistBegin = twist.X; prim.Prim.PrimData.PathTwist = twist.Y; prim.Prim.PrimData.PathScaleX = topSize.Y; prim.Prim.PrimData.PathScaleY = topSize.Y; prim.Prim.PrimData.PathShearX = topShear.X; prim.Prim.PrimData.PathShearY = topShear.Y; }
private void SetPrimShapeParams(LLPrimitive prim, int holeShape, Vector3 cut, float hollow, Vector3 twist, Vector3 dimple) { HoleType hole = (HoleType)holeShape; if (hole != HoleType.Same && hole != HoleType.Circle && hole != HoleType.Square && hole != HoleType.Triangle) { hole = HoleType.Same; } // Clamp the cut values cut.X = Utils.Clamp(cut.X, 0f, 1f); cut.Y = Utils.Clamp(cut.Y, 0f, 1f); if (cut.Y - cut.X < 0.05f) { cut.X = cut.Y - 0.05f; if (cut.X < 0f) { cut.X = 0f; cut.Y = 0.05f; } } // Clamp hollow hollow = Utils.Clamp(hollow, 0f, 0.95f); // Clamp the twist values twist.X = Utils.Clamp(twist.X, -1f, 1f); twist.Y = Utils.Clamp(twist.Y, -1f, 1f); // Clamp the dimple values dimple.X = Utils.Clamp(dimple.X, 0f, 1f); dimple.Y = Utils.Clamp(dimple.Y, 0f, 1f); if (dimple.Y - cut.X < 0.05f) { dimple.X = cut.Y - 0.05f; } prim.Prim.PrimData.ProfileHole = hole; prim.Prim.PrimData.ProfileBegin = cut.X; prim.Prim.PrimData.ProfileEnd = cut.Y; prim.Prim.PrimData.ProfileHollow = hollow; prim.Prim.PrimData.PathTwistBegin = twist.X; prim.Prim.PrimData.PathTwist = twist.Y; // TODO: Is this right? If so, what is cut for? prim.Prim.PrimData.ProfileBegin = dimple.X; prim.Prim.PrimData.ProfileEnd = dimple.Y; }
/// <summary> /// それぞれの畑をセット /// </summary> void HoleParentSet() { HoleType type = cam.GetComponent <CameraRotate>().HoleType; switch (type) { case HoleType._potato: holeType = HoleSort[0]; break; case HoleType._radish: holeType = HoleSort[1]; break; case HoleType._pepper: holeType = HoleSort[2]; break; } }
public void Begin(HoleType type, ref Item otherHole, CosmicSelfMerge spellData) { nomEffect = nomEffect ?? Catalog.GetData <EffectData>("HoleAbsorb"); pewEffect = pewEffect ?? Catalog.GetData <EffectData>("HoleFire"); ambientEffect = ambientEffect ?? Catalog.GetData <EffectData>((type == Black) ? "BlackHoleAmbient" : "WhiteHoleAmbient"); itemSpamDelay = spellData.itemSpamDelay; friction = spellData.friction; throwTrackRange = spellData.throwTrackRange; throwTrackForce = spellData.throwTrackForce; throwForce = spellData.throwForce; pushForce = spellData.pushForce; pullForce = spellData.pullForce; if (active) { return; } this.otherHole = otherHole; item = GetComponent <Item>(); effect = ambientEffect.Spawn(transform); effect.Play(); this.type = type; }
protected void GenerateCircleHalf(ProfileParameters parameters, bool pathIsOpen, float lod, int split, bool isSculpted, int sculptSize) { // If this has a square hollow, we should adjust the // number of faces a bit so that the geometry lines up. HoleType hole_type = 0; // Number of faces is cut in half because it's only a half-circle. float circle_detail = Volume.MIN_DETAIL_FACES * lod * 0.5f; if (parameters.Hollow > 0f) { hole_type = parameters.HoleType; if (hole_type == HoleType.HoleSquare) { // Snap to the next multiple of four sides (div 2), // so that corners line up. circle_detail = Mathf.Ceil(circle_detail / 2.0f) * 2.0f; } } GenNGon(parameters, Mathf.FloorToInt(circle_detail), 0.5f, 0f, 0.5f); if (pathIsOpen) { AddCap(FaceId.PathBegin); } if (IsOpen && parameters.Hollow <= 0f) { AddFace(0, PointCount - 1, 0, FaceId.Outer0, false); } else { AddFace(0, PointCount, 0, FaceId.Outer0, false); } if (parameters.Hollow > 0f) { switch (hole_type) { case HoleType.HoleSquare: AddHole(parameters, true, 2, 0.5f, parameters.Hollow, 0.5f, split); break; case HoleType.HoleTriangle: AddHole(parameters, true, 3, 0.5f, parameters.Hollow, 0.5f, split); break; case HoleType.HoleCircle: case HoleType.HoleSame: default: AddHole(parameters, false, circle_detail, 0.5f, parameters.Hollow, 0.5f); break; } } // Special case for openness of sphere if ((parameters.End - parameters.Begin) < 1f) { IsOpen = true; } else if (parameters.Hollow <= 0f) { IsOpen = false; Points.Add(Points[0]); } }
public void SetDoor() { this.Type = HoleType.Door; this.shape.init(new Vector2(0.9f, 2.0f)); }
public void SetWindow() { this.Type = HoleType.Windows; this.shape.init(new Vector2(1, 0.8f)); }
public hole() { Type = HoleType.None; pos.init(new Vector2(0, 0)); }
static void SOPToXml(XmlTextWriter writer, PrimObject prim, PrimObject parent) { writer.WriteStartElement("SceneObjectPart"); writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); WriteUUID(writer, "CreatorID", prim.CreatorID); WriteUUID(writer, "FolderID", prim.FolderID); writer.WriteElementString("InventorySerial", (prim.Inventory != null) ? prim.Inventory.Serial.ToString() : "0"); // FIXME: Task inventory writer.WriteStartElement("TaskInventory"); if (prim.Inventory != null) { foreach (PrimObject.InventoryBlock.ItemBlock item in prim.Inventory.Items) { writer.WriteStartElement("", "TaskInventoryItem", ""); WriteUUID(writer, "AssetID", item.AssetID); writer.WriteElementString("BasePermissions", item.PermsBase.ToString()); writer.WriteElementString("CreationDate", (item.CreationDate.ToUniversalTime() - Utils.Epoch).TotalSeconds.ToString()); WriteUUID(writer, "CreatorID", item.CreatorID); writer.WriteElementString("Description", item.Description); writer.WriteElementString("EveryonePermissions", item.PermsEveryone.ToString()); writer.WriteElementString("Flags", item.Flags.ToString()); WriteUUID(writer, "GroupID", item.GroupID); writer.WriteElementString("GroupPermissions", item.PermsGroup.ToString()); writer.WriteElementString("InvType", ((int)item.InvType).ToString()); WriteUUID(writer, "ItemID", item.ID); WriteUUID(writer, "OldItemID", UUID.Zero); WriteUUID(writer, "LastOwnerID", item.LastOwnerID); writer.WriteElementString("Name", item.Name); writer.WriteElementString("NextPermissions", item.PermsNextOwner.ToString()); WriteUUID(writer, "OwnerID", item.OwnerID); writer.WriteElementString("CurrentPermissions", item.PermsOwner.ToString()); WriteUUID(writer, "ParentID", prim.ID); WriteUUID(writer, "ParentPartID", prim.ID); WriteUUID(writer, "PermsGranter", item.PermsGranterID); writer.WriteElementString("PermsMask", "0"); writer.WriteElementString("Type", ((int)item.Type).ToString()); writer.WriteElementString("OwnerChanged", "false"); writer.WriteEndElement(); } } writer.WriteEndElement(); PrimFlags flags = PrimFlags.None; if (prim.UsePhysics) { flags |= PrimFlags.Physics; } if (prim.Phantom) { flags |= PrimFlags.Phantom; } if (prim.DieAtEdge) { flags |= PrimFlags.DieAtEdge; } if (prim.ReturnAtEdge) { flags |= PrimFlags.ReturnAtEdge; } if (prim.Temporary) { flags |= PrimFlags.Temporary; } if (prim.Sandbox) { flags |= PrimFlags.Sandbox; } writer.WriteElementString("ObjectFlags", ((int)flags).ToString()); WriteUUID(writer, "UUID", prim.ID); writer.WriteElementString("LocalId", prim.LocalID.ToString()); writer.WriteElementString("Name", prim.Name); writer.WriteElementString("Material", ((int)prim.Material).ToString()); writer.WriteElementString("RegionHandle", prim.RegionHandle.ToString()); writer.WriteElementString("ScriptAccessPin", prim.RemoteScriptAccessPIN.ToString()); Vector3 groupPosition; if (parent == null) { groupPosition = prim.Position; } else { groupPosition = parent.Position; } WriteVector(writer, "GroupPosition", groupPosition); if (prim.ParentID == 0) { WriteVector(writer, "OffsetPosition", Vector3.Zero); } else { WriteVector(writer, "OffsetPosition", prim.Position); } WriteQuaternion(writer, "RotationOffset", prim.Rotation); WriteVector(writer, "Velocity", prim.Velocity); WriteVector(writer, "RotationalVelocity", Vector3.Zero); WriteVector(writer, "AngularVelocity", prim.AngularVelocity); WriteVector(writer, "Acceleration", prim.Acceleration); writer.WriteElementString("Description", prim.Description); writer.WriteStartElement("Color"); writer.WriteElementString("R", prim.TextColor.R.ToString(Utils.EnUsCulture)); writer.WriteElementString("G", prim.TextColor.G.ToString(Utils.EnUsCulture)); writer.WriteElementString("B", prim.TextColor.B.ToString(Utils.EnUsCulture)); writer.WriteElementString("A", prim.TextColor.G.ToString(Utils.EnUsCulture)); writer.WriteEndElement(); writer.WriteElementString("Text", prim.Text); writer.WriteElementString("SitName", prim.SitName); writer.WriteElementString("TouchName", prim.TouchName); writer.WriteElementString("LinkNum", prim.LinkNumber.ToString()); writer.WriteElementString("ClickAction", prim.ClickAction.ToString()); writer.WriteStartElement("Shape"); writer.WriteElementString("PathBegin", Primitive.PackBeginCut(prim.Shape.PathBegin).ToString()); writer.WriteElementString("PathCurve", prim.Shape.PathCurve.ToString()); writer.WriteElementString("PathEnd", Primitive.PackEndCut(prim.Shape.PathEnd).ToString()); writer.WriteElementString("PathRadiusOffset", Primitive.PackPathTwist(prim.Shape.PathRadiusOffset).ToString()); writer.WriteElementString("PathRevolutions", Primitive.PackPathRevolutions(prim.Shape.PathRevolutions).ToString()); writer.WriteElementString("PathScaleX", Primitive.PackPathScale(prim.Shape.PathScaleX).ToString()); writer.WriteElementString("PathScaleY", Primitive.PackPathScale(prim.Shape.PathScaleY).ToString()); writer.WriteElementString("PathShearX", ((byte)Primitive.PackPathShear(prim.Shape.PathShearX)).ToString()); writer.WriteElementString("PathShearY", ((byte)Primitive.PackPathShear(prim.Shape.PathShearY)).ToString()); writer.WriteElementString("PathSkew", Primitive.PackPathTwist(prim.Shape.PathSkew).ToString()); writer.WriteElementString("PathTaperX", Primitive.PackPathTaper(prim.Shape.PathTaperX).ToString()); writer.WriteElementString("PathTaperY", Primitive.PackPathTaper(prim.Shape.PathTaperY).ToString()); writer.WriteElementString("PathTwist", Primitive.PackPathTwist(prim.Shape.PathTwist).ToString()); writer.WriteElementString("PathTwistBegin", Primitive.PackPathTwist(prim.Shape.PathTwistBegin).ToString()); writer.WriteElementString("PCode", prim.PCode.ToString()); writer.WriteElementString("ProfileBegin", Primitive.PackBeginCut(prim.Shape.ProfileBegin).ToString()); writer.WriteElementString("ProfileEnd", Primitive.PackEndCut(prim.Shape.ProfileEnd).ToString()); writer.WriteElementString("ProfileHollow", Primitive.PackProfileHollow(prim.Shape.ProfileHollow).ToString()); WriteVector(writer, "Scale", prim.Scale); writer.WriteElementString("State", prim.State.ToString()); AssetPrim.ProfileShape shape = (AssetPrim.ProfileShape)(prim.Shape.ProfileCurve & 0x0F); HoleType hole = (HoleType)(prim.Shape.ProfileCurve & 0xF0); writer.WriteElementString("ProfileShape", shape.ToString()); writer.WriteElementString("HollowShape", hole.ToString()); writer.WriteElementString("ProfileCurve", prim.Shape.ProfileCurve.ToString()); writer.WriteStartElement("TextureEntry"); byte[] te; if (prim.Textures != null) { te = prim.Textures.GetBytes(); } else { te = Utils.EmptyBytes; } writer.WriteBase64(te, 0, te.Length); writer.WriteEndElement(); // FIXME: ExtraParams writer.WriteStartElement("ExtraParams"); writer.WriteEndElement(); writer.WriteEndElement(); WriteVector(writer, "Scale", prim.Scale); writer.WriteElementString("UpdateFlag", "0"); WriteVector(writer, "SitTargetOrientation", Vector3.UnitZ); // TODO: Is this really a vector and not a quaternion? WriteVector(writer, "SitTargetPosition", prim.SitOffset); WriteVector(writer, "SitTargetPositionLL", prim.SitOffset); WriteQuaternion(writer, "SitTargetOrientationLL", prim.SitRotation); writer.WriteElementString("ParentID", prim.ParentID.ToString()); writer.WriteElementString("CreationDate", ((int)Utils.DateTimeToUnixTime(prim.CreationDate)).ToString()); writer.WriteElementString("Category", "0"); writer.WriteElementString("SalePrice", prim.SalePrice.ToString()); writer.WriteElementString("ObjectSaleType", ((int)prim.SaleType).ToString()); writer.WriteElementString("OwnershipCost", "0"); WriteUUID(writer, "GroupID", prim.GroupID); WriteUUID(writer, "OwnerID", prim.OwnerID); WriteUUID(writer, "LastOwnerID", prim.LastOwnerID); writer.WriteElementString("BaseMask", ((uint)PermissionMask.All).ToString()); writer.WriteElementString("OwnerMask", ((uint)PermissionMask.All).ToString()); writer.WriteElementString("GroupMask", ((uint)PermissionMask.All).ToString()); writer.WriteElementString("EveryoneMask", ((uint)PermissionMask.All).ToString()); writer.WriteElementString("NextOwnerMask", ((uint)PermissionMask.All).ToString()); writer.WriteElementString("Flags", "None"); WriteUUID(writer, "SitTargetAvatar", UUID.Zero); writer.WriteEndElement(); }
protected void GenerateCircle(ProfileParameters parameters, bool pathIsOpen, float lod, int split, bool isSculpted, int sculptSize) { // If this has a square hollow, we should adjust the // number of faces a bit so that the geometry lines up. HoleType holeType = 0; float circleDetail = Volume.MIN_DETAIL_FACES * lod; if (parameters.Hollow > 0f) { holeType = parameters.HoleType; if (holeType == HoleType.HoleSquare) { // Snap to the next multiple of four sides, // so that corners line up. circleDetail = Mathf.Ceil(circleDetail / 4.0f) * 4.0f; } } int sides = (int)circleDetail; if (isSculpted) { sides = sculptSize; } GenNGon(parameters, sides); if (pathIsOpen) { AddCap(FaceId.PathBegin); } if (IsOpen && parameters.Hollow <= 0f) { AddFace(0, PointCount - 1, 0, FaceId.Outer0, false); } else { AddFace(0, PointCount, 0, FaceId.Outer0, false); } if (parameters.Hollow > 0f) { switch (holeType) { case HoleType.HoleSquare: AddHole(parameters, true, 4, 0, parameters.Hollow, 1f, split); break; case HoleType.HoleTriangle: AddHole(parameters, true, 3, 0, parameters.Hollow, 1f, split); break; case HoleType.HoleCircle: case HoleType.HoleSame: default: AddHole(parameters, false, circleDetail, 0, parameters.Hollow, 1f); break; } } }