Commit bd5b92d2 authored by Luke Smith's avatar Luke Smith

Slight effeciency improvemnts to borders.cs.

Added changes to TagManager to include "Tiles Parent" addition.
parent 85c3fea0
......@@ -3,7 +3,7 @@ using UnityEditor;
public class Borders : MonoBehaviour
{
public int top = 2, right = 2, bottom = 2, left = 2; // Border sizes by pixel
public int top = 0, right = 0, bottom = 0, left = 0; // Border sizes by pixel
private enum Direction{none, t, r, rt, b, bt, br, brt, l, lt, lr, lrt, lb, lbt, lbr, lbrt}
// Binary representation:
......@@ -38,19 +38,19 @@ public class Borders : MonoBehaviour
World.setup();
}
if(!World.posIsThis(pos + Vector3.up, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
if(top > 0 && !World.posIsThis(pos + Vector3.up, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
{
d |= Direction.t;
}
if(!World.posIsThis(pos + Vector3.left, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
if(right > 0 && !World.posIsThis(pos + Vector3.left, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
{
d |= Direction.r;
}
if(!World.posIsThis(pos + Vector3.down, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
if(bottom > 0 && !World.posIsThis(pos + Vector3.down, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
{
d |= Direction.b;
}
if(!World.posIsThis(pos + Vector3.right, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
if(left > 0 && !World.posIsThis(pos + Vector3.right, (GameObject)PrefabUtility.GetPrefabParent(gameObject)))
{
d |= Direction.l;
}
......@@ -61,6 +61,7 @@ public class Borders : MonoBehaviour
{
if((d & Direction.t) > 0) // top
{
Debug.Log("set top");
for(int i = left; i < width - right; i++)
{
for(int j = height - top*2; j < height - top; j++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment