public GameObject GetGameObject() { GameObject gao = new GameObject("SO @ " + Offset + " - " + type); if (data.Value != null) { if (data.Value is PhysicalObject) { PhysicalObjectComponent poc = ((PhysicalObject)data.Value).GetGameObject(gao); } else if (data.Value is Sector) { SectorComponent sc = ((Sector)data.Value).GetGameObject(gao); } } if (children.Value != null) { foreach (Reference <SuperObject> so in children.Value.superObjects) { if (so.Value != null) { GameObject soGao = so.Value.GetGameObject(); if (soGao != null) { soGao.transform.SetParent(gao.transform); ROMTransform.Apply(so.Value.transform, soGao); } } } } return(gao); }
protected override void ReadInternal(Reader reader) { //Loader.print(Pointer.Current(reader)); perso = new Reference <Perso>(reader); transformIndex = reader.ReadUInt16(); flags = reader.ReadUInt16(); unkByte = reader.ReadUInt16(); unk = reader.ReadUInt32(); transform = new ROMTransform(transformIndex); perso.Resolve(reader); }
protected override void ReadInternal(Reader reader) { transformIndex = reader.ReadUInt16(); dataIndex = reader.ReadUInt16(); children = new Reference <SuperObjectArray>(reader, false); boundingVolume = new Reference <CompressedVector3Array>(reader, true, v => v.length = 2); type = reader.ReadUInt16(); num_children = reader.ReadUInt16(); unk = reader.ReadUInt16(); unk2 = reader.ReadUInt16(); flags = reader.ReadUInt32(); transform = new ROMTransform(transformIndex); children.Resolve(reader, soa => soa.length = num_children); data = new GenericReference(type, dataIndex, reader, true); }
public static void Apply(ROMTransform transform, GameObject gao) { if (gao == null) { return; } if (transform != null) { transform.Apply(gao); } else { gao.transform.localPosition = Vector3.zero; gao.transform.localRotation = Quaternion.identity; gao.transform.localScale = Vector3.one; } }
protected override void ReadInternal(Reader reader) { near = reader.ReadSingle(); far = reader.ReadSingle(); fogBlendFar = reader.ReadSingle(); fogBlendNear = reader.ReadSingle(); backgroundColor = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); color = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); // looks like color objectLightedFlag = reader.ReadUInt16(); lightProperties = reader.ReadUInt16(); vec3_34 = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); vec3_40 = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); vec3_4C = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); vec3_58 = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); transformIndex = reader.ReadUInt16(); flags = reader.ReadUInt16(); transform = new ROMTransform(transformIndex); }
public GameObject GetGameObject() { GameObject gao = new GameObject("SO @ " + Offset + " - " + type); SuperObjectComponent soc = gao.AddComponent <SuperObjectComponent>(); gao.layer = LayerMask.NameToLayer("SuperObject"); soc.soROM = this; MapLoader.Loader.controller.superObjects.Add(soc); if (data.Value != null) { if (data.Value is PhysicalObject) { PhysicalObjectComponent poc = ((PhysicalObject)data.Value).GetGameObject(gao); } else if (data.Value is Sector) { SectorComponent sc = ((Sector)data.Value).GetGameObject(gao); } } if (children.Value != null) { foreach (Reference <SuperObject> so in children.Value.superObjects) { if (so.Value != null) { GameObject soGao = so.Value.GetGameObject(); if (soGao != null) { soc.Children.Add(soGao.GetComponent <SuperObjectComponent>()); soGao.transform.SetParent(gao.transform); ROMTransform.Apply(so.Value.transform, soGao); } } } } return(gao); }
public GameObject GetGameObject() { GameObject gao = new GameObject("Hierarchy Root @ " + Offset); if (fatherSector.Value != null) { GameObject fsGao = fatherSector.Value.GetGameObject(); fsGao.name = "[Father Sector] " + fsGao.name; fsGao.transform.SetParent(gao.transform); ROMTransform.Apply(fatherSector.Value.transform, fsGao); } if (persos.Value != null) { GameObject dynGao = new GameObject("Dynamic World @ " + persos.Value.Offset); dynGao.transform.SetParent(gao.transform); foreach (SuperObjectDynamic sod in persos.Value.superObjects) { GameObject sodGao = sod.GetGameObject(); sodGao.transform.SetParent(dynGao.transform); ROMTransform.Apply(sod.transform, sodGao); } } return(gao); }