public MSBBB.Region Serialize(MSBBB.Region region, GameObject parent) { region.Name = parent.name; region.Position.X = parent.transform.position.x; region.Position.Y = parent.transform.position.y; region.Position.Z = parent.transform.position.z; //var rot = ConvertEuler(parent.transform.rotation.eulerAngles); //region.Rotation.X = rot.X; //region.Rotation.Y = rot.Y; //region.Rotation.Z = rot.Z; region.Rotation = EulerUtils.quaternion2EulerDeg(parent.transform.rotation.normalized, EulerUtils.RotSeq.yzx); region.Unk2 = Unk2; region.Unk3 = Unk3; region.Unk4 = Unk4; region.EventEntityID = EventEntityID; if (parent.GetComponent <SphereCollider>() != null && IsPointOrCircle) { region.Shape = new MSBBB.Shape.Point(); } else if (parent.GetComponent <CapsuleCollider>() != null && IsPointOrCircle) { var shape = new MSBBB.Shape.Circle(); var col = parent.GetComponent <CapsuleCollider>(); shape.Radius = col.radius; region.Shape = shape; } else if (parent.GetComponent <BoxCollider>() != null) { var shape = new MSBBB.Shape.Box(); var col = parent.GetComponent <BoxCollider>(); 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 shape = new MSBBB.Shape.Cylinder(); var col = parent.GetComponent <CapsuleCollider>(); shape.Radius = col.radius; shape.Height = col.height; region.Shape = shape; } else if (parent.GetComponent <SphereCollider>() != null) { var shape = new MSBBB.Shape.Sphere(); var col = parent.GetComponent <SphereCollider>(); shape.Radius = col.radius; region.Shape = shape; } return(region); }
public void setBaseRegion(MSBBB.Region region) { Unk2 = region.Unk2; Unk3 = region.Unk3; Unk4 = region.Unk4; EventEntityID = region.EventEntityID; if (region.Shape is MSBBB.Shape.Point || region.Shape is MSBBB.Shape.Circle) { IsPointOrCircle = true; } }
public void setBaseRegion(MSBBB.Region region) { ID = region.ID; Unk2 = region.Unk2; Unk3 = region.Unk3; Unk4 = region.Unk4; EventEntityID = region.EventEntityID; if (region is MSBBB.Region.Point) { IsPoint = true; } }
public void Serialize(MSBBB.Region region, GameObject parent) { region.Name = parent.name; region.ID = ID; region.Position.X = parent.transform.position.x; region.Position.Y = parent.transform.position.y; region.Position.Z = parent.transform.position.z; var rot = ConvertEuler(parent.transform.rotation.eulerAngles); region.Rotation.X = rot.X; region.Rotation.Y = rot.Y; region.Rotation.Z = rot.Z; region.Unk2 = Unk2; region.Unk3 = Unk3; region.Unk4 = Unk4; region.EventEntityID = EventEntityID; if (region is MSBBB.Region.Box) { var shape = (MSBBB.Region.Box)region; var col = parent.GetComponent <BoxCollider>(); shape.Width = col.size.x; shape.Height = col.size.y; shape.Length = col.size.z; } else if (region is MSBBB.Region.Cylinder) { var shape = (MSBBB.Region.Cylinder)region; var col = parent.GetComponent <CapsuleCollider>(); shape.Radius = col.radius; shape.Height = col.height; } else if (region is MSBBB.Region.Sphere) { var shape = (MSBBB.Region.Sphere)region; var col = parent.GetComponent <SphereCollider>(); shape.Radius = col.radius; } else if (region is MSBBB.Region.Point) { } }