using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName="Y2DSD", menuName ="Y2D sorter", order = 1)]
public class Y2DSorterData : ScriptableObject {
    public float zToYRatio = 1.0f;
    public bool oneTimeOnly = false;

    static Vector3 buf;
    static float heightBuf;

    public bool to2D = true;

    public Vector3 To2DShadow(Transform target) {
        buf = target.position;
        
        buf.y = buf.z * zToYRatio;
        buf.z = 0;

        return buf;
    }

    public Vector3 To2D(Transform target) {
        buf = target.position;

        buf.y = buf.y + buf.z * zToYRatio;
        buf.z = 0;
        return buf;
    }

    public Vector3 To3D(float height, Transform target) {
        buf = target.position;
        buf.z = buf.y;
        buf.y = height;
        
        return buf;
    }
}
