using UnityEngine;
using System.Collections;

public static class WorldExtension  {

    // Konvertuje Vektor3 u 2D Vektor3
    public static Vector3 ToVector3_2D(this Vector3 coordinate)
    {
        return new Vector3(coordinate.x, coordinate.y, 0);
    }

    // Konvertuje koordinate prosotra ekrana u Vektor2 
    public static Vector2 GetScreenPositionIn2D(this Vector3 screenCoordinate)
    {
        Vector3 wp = Camera.main.ScreenToWorldPoint(screenCoordinate);
        return new Vector2(wp.x, wp.y);
    }

    // Konvertuje koordinate prosotra ekrana u Vektor3 sa vrerdnostima za 2D
    public static Vector3 GetScreenPositionFor2D(this Vector3 screenCoordinate)
    {
        Vector3 wp = Camera.main.ScreenToWorldPoint(screenCoordinate);
        return wp.ToVector3_2D();
    }

}
