public PortalInstruction(string type, XYZOrientation location, XYZ endpoint1, XYZ endpoint2) { Type = type; Location = location; Endpoint1 = endpoint1; Endpoint2 = endpoint2; }
public void PortalInstruction_OffMapEndpointFromString_IsCorrect() { var portal = PortalInstruction.FromString("Portal-Door: (1,1,1); End1=(1,2,0); End2=(OffMap)"); Assert.AreEqual("Door", portal.Type); Assert.AreEqual(XYZOrientation.FromString("1,1,1,U"), portal.Location); Assert.AreEqual(new XYZ(1, 2, 0), portal.Endpoint1); Assert.AreEqual(SpecialLocation.OffOfMap, portal.Endpoint2); }
public static PortalInstruction FromString(string arg) { if (!arg.Contains("Portal-") || !arg.Contains("End1") || !arg.Contains("End2")) { throw new ArgumentException($"Invalid Portal Instruction: {arg}"); } var sections = arg.CleanAndSplit(':'); var type = sections[0].Replace("Portal-", ""); var props = sections[1].Split(';'); var location = XYZOrientation.FromString(props[0]); var endpoint1 = GetXYZ(props.GetValue("End1")); var endpoint2 = GetXYZ(props.GetValue("End2")); return(new PortalInstruction(type, location, endpoint1, endpoint2)); }
public XYZOriented(XYZOrientation xyzo, T obj) : this(xyzo.X, xyzo.Y, xyzo.Z, xyzo.Orientation, obj) { }