123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System;
- using System.IO;
- using UnityEngine;
- public class PosRotScale
- {
- public PosRotScale()
- {
- }
- public PosRotScale(PosRotScale prs)
- {
- this.position = prs.position;
- this.scale = prs.scale;
- this.rotation = prs.rotation;
- }
- public void SetFromTransformLocal(Transform tr)
- {
- this.position = tr.localPosition;
- this.rotation = tr.localRotation;
- this.scale = tr.localScale;
- }
- public void SetToTransformLocal(Transform tr)
- {
- tr.localPosition = this.position;
- tr.localRotation = this.rotation;
- tr.localScale = this.scale;
- }
- public void Serialize(BinaryWriter bw)
- {
- bw.Write(this.position);
- bw.Write(this.scale);
- bw.Write(this.rotation);
- }
- public void Deserialize(BinaryReader br)
- {
- br.Read(out this.position);
- br.Read(out this.scale);
- br.Read(out this.rotation);
- }
- public Vector3 position;
- public Vector3 scale;
- public Quaternion rotation;
- }
|