// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.TransformInfo
using UnityEngine;

public class TransformInfo
{
    public Transform parentTransform;

    public Vector3 position;

    public Vector3 localPosition;

    public Quaternion rotation;

    public Quaternion localRotation;

    public Vector3 localScale;

    public string name;

    public TransformInfo(Transform t)
    {
        this.parentTransform = t.parent;
        this.position = t.position;
        this.localPosition = t.localPosition;
        this.rotation = t.rotation;
        this.localRotation = t.localRotation;
        this.localScale = t.localScale;
        this.name = t.name;
    }

    public void ApplyToTransform(Transform t, bool applyParent, bool applyPosition, bool applyRotation, bool applyScale, bool applyName = false)
    {
        if (applyParent)
        {
            t.SetParent(this.parentTransform, worldPositionStays: true);
            if (applyPosition)
            {
                t.localPosition = this.localPosition;
            }
            if (applyRotation)
            {
                t.localRotation = this.localRotation;
            }
            if (applyScale)
            {
                t.localScale = this.localScale;
            }
        }
        else
        {
            if (applyPosition)
            {
                t.position = this.position;
            }
            if (applyRotation)
            {
                t.rotation = this.rotation;
            }
            if (applyScale)
            {
                t.localScale = this.localScale;
            }
        }
        if (applyName)
        {
            t.name = this.name;
        }
    }
}
