-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a MapDrawer component to render map items
- Loading branch information
1 parent
11579c3
commit 00d2a96
Showing
9 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class MapDrawer : MonoBehaviour { | ||
|
||
private GameObject textureObject; | ||
private Transform textureTransform; | ||
public Texture2D texture; | ||
public bool navigatable = false; | ||
public Texture2D nagivationTexture; | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
// Create a cylinder game object and assign it to the map layer | ||
textureObject = GameObject.CreatePrimitive(PrimitiveType.Cylinder); | ||
textureObject.name = "MapItem"; | ||
textureObject.layer = LayerMask.NameToLayer(HUDConstants.LAYER_MAP); | ||
|
||
// Transform properties | ||
textureTransform = textureObject.transform; | ||
|
||
// TODO: Fix player transform | ||
//textureTransform.parent = gameObject.transform; | ||
//textureTransform.localScale = new Vector3(4f, 0f, 4f); | ||
// For now: | ||
textureTransform.parent = gameObject.GetComponentInChildren<CarHandling>().transform; | ||
textureTransform.localScale = new Vector3(10f, 0f, 10f); | ||
|
||
textureTransform.localPosition = new Vector3(0f, 1f, 0f); | ||
|
||
// Add texture | ||
Material mat = textureObject.renderer.material; | ||
mat.SetTexture("_MainTex", texture); | ||
mat.shader = Shader.Find("Unlit/Transparent"); | ||
Destroy(textureObject.collider); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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