using UnityEngine;
using System.Collections;

public class WallController : MonoBehaviour {

    public Transform tracerReferencePoint;
    public Collider tracerCollider;
    public WallSegment wallPrefab;

    private WallSegment currentWall = null;

    public void TracerTurned() {

        if (currentWall != null) {
            currentWall.StopGrowing();
            Physics.IgnoreCollision(tracerCollider,
                        currentWall.wallCollider,
                        false);
        }

        currentWall = (WallSegment)Instantiate(
                              wallPrefab,
                              tracerReferencePoint.position,
                              tracerReferencePoint.rotation);

        Physics.IgnoreCollision(tracerCollider,
                                currentWall.wallCollider);

        currentWall.TracerReferencePoint = tracerReferencePoint;
    }

}
