Created
December 20, 2017 03:41
-
-
Save erodozer/5f6c2ed4c52c1293c5193ddd81a00d14 to your computer and use it in GitHub Desktop.
Roguelike tile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Tilemaps; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
namespace Adventure.Tilemaps | |
{ | |
/// <summary> | |
/// RoguelikeTiles are an extension of regular Unity tiles, containing additional parameters | |
/// such as Density and Collision represented as a boolean, which are useful for traversing the | |
/// tilemap and providing FOV | |
/// </summary> | |
public class RoguelikeTile : Tile { | |
public float Density; | |
public bool Passable; | |
#if UNITY_EDITOR | |
// The following is a helper that adds a menu item to create a RoadTile Asset | |
[MenuItem("Assets/Create/RoguelikeTile")] | |
public static void CreateRoguelikeTile() | |
{ | |
string path = EditorUtility.SaveFilePanelInProject("Save Roguelike Tile", "New Roguelike Tile", "Asset", "Save Roguelike Tile", "Assets"); | |
if (path == "") | |
return; | |
AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<RoguelikeTile>(), path); | |
} | |
#endif | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment