public static Dictionary <Vector2Int, UnityEngine.Object> CreateHoverData(Texture2D sheet) { Dictionary <Vector2Int, UnityEngine.Object> dictionary = new Dictionary <Vector2Int, UnityEngine.Object>(); List <Sprite> spritesFromTexture = TileDragAndDrop.GetSpritesFromTexture(sheet); Vector2Int cellPixelSize = TileDragAndDrop.EstimateGridPixelSize(spritesFromTexture); foreach (Sprite current in spritesFromTexture) { Vector2Int gridPosition = TileDragAndDrop.GetGridPosition(current, cellPixelSize); dictionary[gridPosition] = current; } return(dictionary); }
public static List <Texture2D> GetValidSpritesheets(UnityEngine.Object[] objects) { List <Texture2D> list = new List <Texture2D>(); for (int i = 0; i < objects.Length; i++) { UnityEngine.Object @object = objects[i]; if (@object is Texture2D) { Texture2D texture2D = @object as Texture2D; List <Sprite> spritesFromTexture = TileDragAndDrop.GetSpritesFromTexture(texture2D); if (spritesFromTexture.Count <Sprite>() > 1 && TileDragAndDrop.AllSpritesAreSameSize(spritesFromTexture)) { list.Add(texture2D); } } } return(list); }
public static List <Sprite> GetValidSingleSprites(UnityEngine.Object[] objects) { List <Sprite> list = new List <Sprite>(); for (int i = 0; i < objects.Length; i++) { UnityEngine.Object @object = objects[i]; if (@object is Sprite) { list.Add(@object as Sprite); } else if (@object is Texture2D) { Texture2D texture = @object as Texture2D; List <Sprite> spritesFromTexture = TileDragAndDrop.GetSpritesFromTexture(texture); if (spritesFromTexture.Count == 1 || !TileDragAndDrop.AllSpritesAreSameSize(spritesFromTexture)) { list.AddRange(spritesFromTexture); } } } return(list); }