Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
10
Assets/Scripts/UI/Tilemap/Brushes/Tint Brush/Scripts.meta
Normal file
10
Assets/Scripts/UI/Tilemap/Brushes/Tint Brush/Scripts.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0da715375d333a8418105408e081f130
|
||||
folderAsset: yes
|
||||
timeCreated: 1502200675
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 27c281d5970a0fd49bfebd8119dc790a
|
||||
folderAsset: yes
|
||||
timeCreated: 1502200680
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
namespace UnityEditor
|
||||
{
|
||||
[CustomGridBrush(false, false, false, "Tint Brush")]
|
||||
public class TintBrush : GridBrushBase
|
||||
{
|
||||
public Color m_Color = Color.white;
|
||||
|
||||
public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
|
||||
{
|
||||
// Do not allow editing palettes
|
||||
if (brushTarget.layer == 31)
|
||||
return;
|
||||
|
||||
Tilemap tilemap = brushTarget.GetComponent<Tilemap>();
|
||||
if (tilemap != null)
|
||||
{
|
||||
SetColor(tilemap, position, m_Color);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Erase(GridLayout grid, GameObject brushTarget, Vector3Int position)
|
||||
{
|
||||
// Do not allow editing palettes
|
||||
if (brushTarget.layer == 31)
|
||||
return;
|
||||
|
||||
Tilemap tilemap = brushTarget.GetComponent<Tilemap>();
|
||||
if (tilemap != null)
|
||||
{
|
||||
SetColor(tilemap, position, Color.white);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetColor(Tilemap tilemap, Vector3Int position, Color color)
|
||||
{
|
||||
TileBase tile = tilemap.GetTile(position);
|
||||
if (tile != null)
|
||||
{
|
||||
if ((tilemap.GetTileFlags(position) & TileFlags.LockColor) != 0)
|
||||
{
|
||||
if (tile is Tile)
|
||||
{
|
||||
Debug.LogWarning("Tint brush cancelled, because Tile (" + tile.name + ") has TileFlags.LockColor set. Unlock it from the Tile asset debug inspector.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("Tint brush cancelled. because Tile (" + tile.name + ") has TileFlags.LockColor set. Unset it in GetTileData().");
|
||||
}
|
||||
}
|
||||
|
||||
tilemap.SetColor(position, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[CustomEditor(typeof(TintBrush))]
|
||||
public class TintBrushEditor : UnityEditor.Tilemaps.GridBrushEditorBase
|
||||
{
|
||||
public override GameObject[] validTargets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GameObject.FindObjectsOfType<Tilemap>().Select(x => x.gameObject).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5461c6f43c33cae4e8367042630017f7
|
||||
timeCreated: 1502200727
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue