public GameObjectSerializable(PersistedGameObject _go)
 {
     Position = new Vector3Serializable(_go.Position);
     Rotation = new QuaternionSerializable(_go.Rotation);
     Scale    = new Vector3Serializable(_go.Scale);
     Enabled  = _go.Enabled;
 }
Пример #2
0
 public ShapeData ToShapeData()
 {
     return(new ShapeData(
                Vector3Serializable.FromVector(transform.localScale), ColorRGB.FromColor(material.color),
                Vector3Serializable.FromVector(transform.position), Vector3Serializable.FromVector(rb.velocity),
                Vector3Serializable.FromVector(rb.angularVelocity),
                Vector3Serializable.FromVector(transform.rotation.eulerAngles)));
 }
Пример #3
0
        public static void AddVector3(this SerializationInfo info, string name, Vector3Serializable v)
        {
            if (info is null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            info.AddValue(name, v);
        }
Пример #4
0
 public override bool Equals(object obj)
 {
     if (obj is Vector3Serializable || obj is Vector3)
     {
         Vector3Serializable vector = ( Vector3Serializable )obj;
         return(this.x == vector.x && this.y == vector.y && this.z == vector.z);
     }
     return(false);
 }
Пример #5
0
    static public Vector3Serializable CreateVector3Serializable(Vector3 v)
    {
        Vector3Serializable save = new Vector3Serializable
        {
            x = v.x,
            y = v.y,
            z = v.z
        };

        return(save);
    }
Пример #6
0
 public ShapeData(Vector3Serializable scale, ColorRGB color, Vector3Serializable position,
                  Vector3Serializable velocity, Vector3Serializable angularVelocity,
                  Vector3Serializable rotation)
 {
     Scale           = scale;
     Color           = color;
     Position        = position;
     Velocity        = velocity;
     AngularVelocity = angularVelocity;
     Rotation        = rotation;
 }
Пример #7
0
    public static MagicCubeSaveData CreateSaveData(MagicCubeManager manager)
    {
        MagicCubeSaveData savedata = new MagicCubeSaveData();

        //deep copies to be safe.
        foreach (var cubeTile in manager.GetCubeTileListReference())
        {
            savedata.positions.Add(Vector3Serializable.CreateVector3Serializable(cubeTile.transform.position));
            savedata.rotations.Add(QuaternionSerializable.CreateQuaternionSerializable(cubeTile.transform.rotation));
            savedata.cubeTileIDs.Add(cubeTile.GetComponent <CubeTileInfo>().GetID());
        }
        foreach (var action in manager.GetUndoListReference())
        {
            savedata.undoActions.Add(ActionSaveData.CreateSaveData(action));
        }

        savedata.magicCubeSize = manager.GetMagicCubeSize();
        savedata.time          = manager.GetTimePassed();

        return(savedata);
    }
Пример #8
0
 public CameraXZData(Camera camera)
 {
     Location = camera.transform.position;
     Zoom     = camera.orthographicSize;
 }
Пример #9
0
 // We will have a SceneItem Instance for every item in our scene, which will allow us to save a serializable itemCode, position, and itemName
 public SceneItem()
 {
     position = new Vector3Serializable();
 }
Пример #10
0
 public void SetAngularVelocity(Vector3 veloToSet)
 {
     this.angularVelo = new Vector3Serializable(veloToSet.x, veloToSet.y, veloToSet.z);
 }
Пример #11
0
 public void SetColor(Color colorToSet)
 {
     this.color = new Vector3Serializable(colorToSet.r, colorToSet.g, colorToSet.b);
 }
Пример #12
0
 public RigidBodySerializable(Rigidbody r)
 {
     velocity = new Vector3Serializable(r.velocity);
     angularVelocity = new Vector3Serializable(r.angularVelocity);
 }
 public static Vector2 ToVector2xz(this Vector3Serializable vs)
 {
     return(new Vector2(vs.x, vs.z));
 }
Пример #14
0
 public SceneItem()
 {
     location = new Vector3Serializable();
 }
Пример #15
0
 public BezierSplinePointSerializable(BezierSplinePoint other)
 {
     this.position     = other.position;
     this.rotation     = other.rotation;
     this.controlPoint = other.controlPoint;
 }
Пример #16
0
 public void SetPosition(Vector3 posToSet)
 {
     this.pos = new Vector3Serializable(posToSet.x, posToSet.y, posToSet.z);
 }
Пример #17
0
 public void SetRotation(Vector3 rotToSet)
 {
     this.rot = new Vector3Serializable(rotToSet.x, rotToSet.y, rotToSet.z);
 }
Пример #18
0
 public TransformSerializable(Transform t)
 {
     position = new Vector3Serializable(t.localPosition);
     rotation = new QuaternionSerializable(t.localRotation);
     scale = new Vector3Serializable(t.localScale);
 }
Пример #19
0
 public PrefabSaveData(PrefabObject prefabObject)
 {
     PrefabPath = AssetDatabase.GetAssetPath(prefabObject.GetSourcePrefab());
     Position   = Vector3Serializable.ToVector3Serializable(prefabObject.GetLocation());
 }