Created
October 15, 2016 04:20
-
-
Save PabloAlexandre/6368007ad7df1cce8c4bd5f939afc13e to your computer and use it in GitHub Desktop.
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 UnityEngine; | |
| public class IsometricMap : MonoBehaviour { | |
| public Texture2D pattern; | |
| public int pixelToUnit = 100; | |
| public Vector2 pixelSize = new Vector2(64, 64); | |
| public Vector2 markerPosition; | |
| void OnDrawGizmosSelected() { | |
| drawIcon(markerPosition, pixelSize, pixelToUnit); | |
| } | |
| public void drawIcon(Vector3 markerPosition, Vector2 pixelSize, int pixelToUnit){ | |
| Gizmos.DrawLine(new Vector3(markerPosition.x — (pixelSize.x * 0.5f) / pixelToUnit, markerPosition.y, markerPosition.z), | |
| new Vector3(markerPosition.x, markerPosition.y + (pixelSize.y * 0.25f) / pixelToUnit, markerPosition.z)); | |
| Gizmos.DrawLine(new Vector3(markerPosition.x — (pixelSize.x * 0.5f) / pixelToUnit, markerPosition.y, markerPosition.z), | |
| new Vector3(markerPosition.x, markerPosition.y — (pixelSize.y * 0.25f) / pixelToUnit, markerPosition.z)); | |
| Gizmos.DrawLine(new Vector3(markerPosition.x + (pixelSize.x * 0.5f) / pixelToUnit, markerPosition.y, markerPosition.z), | |
| new Vector3(markerPosition.x, markerPosition.y + (pixelSize.y * 0.25f) / pixelToUnit, markerPosition.z)); | |
| Gizmos.DrawLine(new Vector3(markerPosition.x + (pixelSize.x * 0.5f) / pixelToUnit, markerPosition.y, markerPosition.z), | |
| new Vector3(markerPosition.x, markerPosition.y — (pixelSize.y * 0.25f) / pixelToUnit, markerPosition.z)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment