public void setShape(MSBS.Shape.Composite shape) { ChildRegionName1 = shape.Children[0].RegionName; Unk041 = shape.Children[0].Unk04; ChildRegionName2 = shape.Children[1].RegionName; Unk042 = shape.Children[1].Unk04; ChildRegionName3 = shape.Children[2].RegionName; Unk043 = shape.Children[2].Unk04; ChildRegionName4 = shape.Children[3].RegionName; Unk044 = shape.Children[3].Unk04; ChildRegionName5 = shape.Children[4].RegionName; Unk045 = shape.Children[4].Unk04; ChildRegionName6 = shape.Children[5].RegionName; Unk046 = shape.Children[5].Unk04; ChildRegionName7 = shape.Children[6].RegionName; Unk047 = shape.Children[6].Unk04; ChildRegionName8 = shape.Children[7].RegionName; Unk048 = shape.Children[7].Unk04; }
public MSBS.Shape.Composite Serialize() { MSBS.Shape.Composite shape = new MSBS.Shape.Composite(); shape.Children[0].RegionName = ChildRegionName1; shape.Children[0].Unk04 = Unk041; shape.Children[1].RegionName = ChildRegionName2; shape.Children[1].Unk04 = Unk042; shape.Children[2].RegionName = ChildRegionName3; shape.Children[2].Unk04 = Unk043; shape.Children[3].RegionName = ChildRegionName4; shape.Children[3].Unk04 = Unk044; shape.Children[4].RegionName = ChildRegionName5; shape.Children[4].Unk04 = Unk045; shape.Children[5].RegionName = ChildRegionName6; shape.Children[5].Unk04 = Unk046; shape.Children[6].RegionName = ChildRegionName7; shape.Children[6].Unk04 = Unk047; shape.Children[7].RegionName = ChildRegionName8; shape.Children[7].Unk04 = Unk048; return(shape); }
internal void _Serialize(MSBS.Region region, GameObject parent) { region.Name = parent.name; region.Position = new System.Numerics.Vector3(parent.transform.position.x, parent.transform.position.y, parent.transform.position.z); //region.Rotation.X = parent.transform.eulerAngles.x; //region.Rotation.Y = parent.transform.eulerAngles.y; //region.Rotation.Z = parent.transform.eulerAngles.z; region.Rotation = ConvertEuler(parent.transform.rotation.eulerAngles); region.MapStudioLayer = MapStudioLayer; region.Unk2C = Unk2C; for (int i = 0; i < UnkA.Length; i++) { region.UnkA.Add(UnkA[i]); } for (int i = 0; i < UnkB.Length; i++) { region.UnkB.Add(UnkB[i]); } region.UnkC00 = UnkC00; region.UnkC04 = UnkC04; if (parent.GetComponent <SphereCollider>() != null) { var col = parent.GetComponent <SphereCollider>(); if (IsPoint) { region.Shape = new MSBS.Shape.Point(); } else { MSBS.Shape.Sphere shape = new MSBS.Shape.Sphere(); shape.Radius = col.radius; region.Shape = shape; } } else if (parent.GetComponent <BoxCollider>() != null) { var col = parent.GetComponent <BoxCollider>(); MSBS.Shape.Box shape = new MSBS.Shape.Box(); shape.Width = col.size.x; shape.Height = col.size.y; shape.Depth = col.size.z; region.Shape = shape; } else if (parent.GetComponent <CapsuleCollider>() != null) { var col = parent.GetComponent <CapsuleCollider>(); MSBS.Shape.Cylinder shape = new MSBS.Shape.Cylinder(); shape.Radius = col.radius; shape.Height = col.height; region.Shape = shape; } else if (parent.GetComponent <MSBSCompositeShape>() != null) { var col = parent.GetComponent <MSBSCompositeShape>(); MSBS.Shape.Composite shape = col.Serialize(); region.Shape = shape; } else { throw new Exception($@"Region {parent.name} has no shape. Attach a spherical, box, or capsule collider."); } }