public SavedInteractableObject(int[] tileID, Vector3 position, Quaternion rotation, InteractableObjectType objectType) { this.tileID = tileID; this.position = position; this.rotation = rotation; this.objectType = objectType; }
public override void DrawInitValueEditor() { var _xInit = InitValue.x; var _yInit = InitValue.y; var _zInit = InitValue.z; var _wInit = InitValue.w; using (new GUILayout.HorizontalScope()) { GUI.color = Color.yellow; GUILayout.Label("Init Value:", GUILayout.Width(120)); GUI.color = Color.white; GUILayout.Label("x:"); _xInit = GUIFloatField.FloatField(_xInit); GUILayout.Label("y:"); _yInit = GUIFloatField.FloatField(_yInit); GUILayout.Label("z:"); _zInit = GUIFloatField.FloatField(_zInit); GUILayout.Label("w:"); _wInit = GUIFloatField.FloatField(_wInit); } InitValue = new SerializableQuaternion(_xInit, _yInit, _zInit, _wInit); }
static void Postfix() { World.inst.ForEachTile(0, 0, World.inst.GridWidth, World.inst.GridHeight, (World.EvaluateCell)((x, z, cell) => { foreach (Building building in cell.OccupyingStructure) { if (building.transform.GetChild(0).childCount > 0) { string rotationString = LoadSave.ReadDataBuilding(modName, building); if (rotationString != null) { string[] rotationStringSplit = rotationString.Split(splitChar); if (rotationStringSplit.Length == 4) { List <float> rotationList = new List <float>(); foreach (string rotation in rotationStringSplit) { float parsedFloat = 0; if (float.TryParse(rotation, out parsedFloat)) { rotationList.Add(parsedFloat); } } if (rotationList.Count == 4) { SerializableQuaternion serializableQuaternion = new SerializableQuaternion(rotationList[0], rotationList[1], rotationList[2], rotationList[3]); building.transform.GetChild(0).GetChild(0).rotation = (Quaternion)serializableQuaternion; } } } } } })); }
public SerializableCyberonActor(CyberonActor actor) { name = actor.gameObject.name.ToString(); position = actor.gameObject.transform.position; rotation = actor.gameObject.transform.rotation; isDead = actor.isDead; }
public override void DrawEditor() { //var _q = Value; var _x = Value.x; var _y = Value.y; var _z = Value.z; var _w = Value.w; using (new GUILayout.HorizontalScope()) { GUILayout.Label("x:"); _x = GUIFloatField.FloatField(_x); GUILayout.Label("y:"); _y = GUIFloatField.FloatField(_y); GUILayout.Label("z:"); _z = GUIFloatField.FloatField(_z); GUILayout.Label("w:"); _w = GUIFloatField.FloatField(_w); } // convert string to quaternion Value = new SerializableQuaternion(_x, _y, _z, _w); }
public SerializableNoteData(string newText, SerializableVector3 newPosition, SerializableQuaternion newRotation, float newScale) { text = newText; position = newPosition; rotation = newRotation; scale = newScale; }
public TransformMessage(int receiverId) { position = new SerializableVector3(); scale = new SerializableVector3(); rotation = new SerializableQuaternion(); this.receiverId = receiverId; }
private Save CreateSaveGameObject() { // create screenshot for thumbnail string screenshotPath = Application.dataPath + "/Resources/Thumbnail/" + DateTime.Now.ToString("MM/dd/yyyy HHmm") + "_Thumbnail.png"; StartCoroutine(TakeScreenShot(screenshotPath)); // creating variables Save save = new Save(); GridObject[] gridObjects = FindObjectsOfType <GridObject>(); List <Transform> placeableTransform = new List <Transform>(); List <GridTypes> placeableType = new List <GridTypes>(); List <int> saveObjectIndex = new List <int>(); List <int> saveTransformIndex = new List <int>(); // filter out not relevant GridObject for (int i = 0; i < gridObjects.Length; i++) { if (gridObjects[i].myType != GridTypes.objectsnap) { placeableTransform.Add(gridObjects[i].transform); placeableType.Add(gridObjects[i].myType); saveObjectIndex.Add(gridObjects[i].objectIndex); saveTransformIndex.Add(gridObjects[i].childIndex); } } // Creating seriazable variables SerializableVector3[] placeablePos = new SerializableVector3[placeableTransform.Count]; SerializableQuaternion[] placeableRot = new SerializableQuaternion[placeableTransform.Count]; // splitting data for (int i = 0; i < placeableTransform.Count; i++) { placeablePos[i] = placeableTransform[i].position; placeableRot[i] = placeableTransform[i].rotation; } // assigning data save.allposition = placeablePos; save.allRotation = placeableRot; save.gridtype = placeableType.ToArray(); save.objectIndex = saveObjectIndex.ToArray(); save.childTransformIndex = saveTransformIndex.ToArray(); // assigning grid info save.xGrid = (int)xSlider.value; save.yGrid = (int)ySlider.value; save.zGrid = int.Parse(zText.text); save.gridRange = rangeSlider.value; save.pathThumbnail = screenshotPath; return(save); }
public Message_RequestSpawn_Result(Vector3D position, Quaternion rotation, ulong vehicleUID, int playerCount) { this.position = position; this.rotation = rotation; this.vehicleUID = vehicleUID; this.playerCount = playerCount; type = MessageType.RequestSpawn_Result; }
public GameData() { MovableObjectPos = new List <SerializableVector3>(); MovableObjectMaterialIndex = new List <int>(); PlayerPosition = new SerializableVector3(Vector3.zero); PlayerRotation = new SerializableQuaternion(Quaternion.identity); SceneIndex = 2; }
public SavedDataPerGame(int newSceneID, Vector3 position, Quaternion rotation, int currentHealth, bool hasKey) { this.SceneID = newSceneID; this.position = position; this.rotation = rotation; this.currentHealth = currentHealth; this.hasKey = hasKey; }
public Message_ShipUpdate(Vector3D position, SerializableQuaternion rotation, Vector3D velocity, ulong uID) { this.position = position; this.rotation = rotation; this.velocity = velocity; UID = uID; type = MessageType.ShipUpdate; }
public RotateObjectSave(RotateObject rotate) : base(rotate) { this.useLocalCoordinates = rotate.useLocalCoordinates; this.rotationsPerSecondX = rotate.rotationsPerSecondX; this.rotationsPerSecondY = rotate.rotationsPerSecondY; this.rotationsPerSecondZ = rotate.rotationsPerSecondZ; this.rotation = rotate.useLocalCoordinates ? rotate.transform.localRotation : rotate.transform.rotation; }
/// <summary> /// Initializes a new instance of the <see cref="EmaModel"/> class. /// </summary> /// <param name="inscription">Inscription.</param> /// <param name="type">Type.</param> /// <param name="gameObject">Game object.</param> public EmaModel (string inscription, EmaType type, GameObject gameObject) { Inscription = inscription; Type = type; GameObject = gameObject; Position = new SerializableVector3 (gameObject.transform.position); Rotation = new SerializableQuaternion (gameObject.transform.rotation); }
public Message_Respawn(ulong uID, Vector3D position, Quaternion rotation, bool leftTeam) { UID = uID; this.position = position; this.rotation = rotation; this.isLeftie = leftTeam; type = MessageType.Respawn; }
public Player() { position = new SerializableVector3(Vector3.zero); rotation = new SerializableQuaternion(Quaternion.identity); firstCheckPointReached = false; pathName = ""; currentHealth = 0; maxHealth = 0; }
public static StuffToSaveClass ConvertToSerializable(FileInfo info, GameObject obj) { var pos = obj.transform.position; var position = new SerializableVector3(pos.x, pos.y, pos.z); var rot = obj.transform.rotation; var rotation = new SerializableQuaternion(rot.x, rot.y, rot.z, rot.w); return(new StuffToSaveClass(position, rotation, info)); }
public Message_Respawn(ulong uID, Vector3D position, Quaternion rotation, bool leftTeam, string name, VTOLVehicles vehicle) { UID = uID; this.position = position; this.rotation = rotation; this.isLeftie = leftTeam; this.tagName = name; this.vehicle = vehicle; type = MessageType.Respawn; }
public ObjectPoint(Vector3 position, Quaternion rotation, int biomeId, int worldResourcePrefabId, float chunkPartCoordX, float chunkPartCoordZ) { this.position = position; this.rotation = rotation; this.biomeId = biomeId; this.worldResourcePrefabId = worldResourcePrefabId; this.chunkPartCoordX = chunkPartCoordX; this.chunkPartCoordZ = chunkPartCoordZ; }
public Message_RigidbodyUpdate(Vector3D velocity, Vector3D angularVelocity, Vector3D position, Quaternion rotation, ulong sequenceNumber, ulong networkUID) { this.velocity = velocity; this.angularVelocity = angularVelocity; this.position = position; this.rotation = rotation; this.sequenceNumber = sequenceNumber; this.networkUID = networkUID; type = MessageType.RigidbodyUpdate; }
//Quaternion rotation 을 string 으로 변환. private string RotToStr(Quaternion rot) { float X = rot.x; float Y = rot.y; float Z = rot.z; float W = rot.w; SerializableQuaternion data = new SerializableQuaternion(X, Y, Z, W); return(data.ToString()); }
public override void Deserialize(byte[] array) { var shift = 0; var idMsg = NetworkBinary.Deserialize <ObjectSpawnMessage>(array, ref shift); Id = idMsg.Id; AssetId = idMsg.AssetId; SceneId = idMsg.SceneId; Position = idMsg.Position; Rotation = idMsg.Rotation; }
public void Save() { savedLocalPos = this.gameObject.transform.localPosition; savedLocalRot = this.gameObject.transform.localRotation; savedLocalScale = this.gameObject.transform.localScale; components = this.GetComponentsInChildren <IMRWObjectComponent>().ToList(); foreach (IMRWObjectComponent c in components) { c.Save(); components.Add(c); } }
static void Postfix(Building b) { Quaternion buildingRotation = Quaternion.identity; if (b.transform.GetChild(0).childCount > 0) { buildingRotation = b.transform.GetChild(0).GetChild(0).rotation; } SerializableQuaternion serializableQuaternion = (SerializableQuaternion)buildingRotation; string rotationString = serializableQuaternion.x.ToString() + splitChar + serializableQuaternion.y.ToString() + splitChar + serializableQuaternion.z.ToString() + splitChar + serializableQuaternion.w.ToString(); LoadSave.SaveDataBuilding(modName, b, rotationString); }
public LightProjectorSave(LightProjector lightProjector) : base(lightProjector) { this.currentSize = lightProjector.currentSize; this.curSideToSideAnimTime = lightProjector.curSideToSideAnimTime; this.desiredSideToSideAnimTime = lightProjector.desiredSideToSideAnimTime; this.desiredCircumferenceRotation = lightProjector.desiredCircumferenceRotation; this.curCircumferenceRotation = lightProjector.curCircumferenceRotation; this.curUpAndDownAnimTime = lightProjector.curUpAndDownAnimTime; this.desiredUpAndDownAnimTime = lightProjector.desiredUpAndDownAnimTime; }
public NetworkPlayerData(Vector3[] pos, Quaternion[] rot) { positions = new SerializableVector3[pos.Length]; for (int i = 0; i < positions.Length; i++) { positions[i] = new SerializableVector3(pos[i]); } rotations = new SerializableQuaternion[rot.Length]; for (int i = 0; i < rotations.Length; i++) { rotations[i] = new SerializableQuaternion(rot[i]); } }
public SavedCharacter(int[] tileID, Vector3 position, Quaternion rotation, int currentHealth, int maxHealth, int attackStrength, int defenseStrength, int maxActionPoints, int turnOrderRating, CharacterBehaviourType behaviour) { this.tileID = tileID; this.position = position; this.rotation = rotation; this.currentHealth = currentHealth; this.maxHealth = maxHealth; this.attackStrength = attackStrength; this.defenseStrength = defenseStrength; this.maxActionPoints = maxActionPoints; this.turnOrderRating = turnOrderRating; this.behaviour = behaviour; }
public DataBuilding(Building building) { if (building.getPlanet() == null) { building.refreshPlanet(); } planetNr = building.getPlanet().getNumber(); added = building.isAdded(); //disturbing = building.distObj(); exactName = building.getName(); position = building.gameObject.transform.position; rotation = building.gameObject.transform.rotation; }
void load_movement() { if (File.Exists(movement_path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream tech_file = File.Open(movement_path, FileMode.Open); string tech_name = (string)bf.Deserialize(tech_file); float tech_time = (float)bf.Deserialize(tech_file); SerializableVector3 tech_vector = (SerializableVector3)bf.Deserialize(tech_file); SerializableQuaternion tech_rot = (SerializableQuaternion)bf.Deserialize(tech_file); tech_file.Close(); } }
// public int playerCount; public Message_SpawnPlayerVehicle(VTOLVehicles vehicle, Vector3D position, Quaternion rotation, ulong csteamID, ulong networkID, HPInfo[] hpLoadout, int[] cmLoadout, float normalizedFuel, bool isLeftie) { this.vehicle = vehicle; this.position = position; this.rotation = rotation; this.csteamID = csteamID; this.networkID = networkID; this.hpLoadout = hpLoadout; this.cmLoadout = cmLoadout; this.normalizedFuel = normalizedFuel; this.leftie = isLeftie; // this.playerCount = playerCount; type = MessageType.SpawnPlayerVehicle; }
public override void Convert(string _value) { System.Globalization.CultureInfo _ci = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.CurrentCulture.Clone(); _ci.NumberFormat.CurrencyDecimalSeparator = "."; string[] _chars = _value.Split(char.Parse(",")); Quaternion _q = new Quaternion(float.Parse(_chars[0], System.Globalization.NumberStyles.Any, _ci), float.Parse(_chars[1], System.Globalization.NumberStyles.Any, _ci), float.Parse(_chars[2], System.Globalization.NumberStyles.Any, _ci), float.Parse(_chars[3], System.Globalization.NumberStyles.Any, _ci)); Value = _q; InitValue = Value; }