using UnityEngine;
using System.Collections;

public class WallScript : MonoBehaviour {
	public bool heaven;

	void Update () {
		float heightScale = WallsManager.AllWallsHeight;
		Vector3 s = transform.localScale;
		transform.localScale = new Vector3 (s.x, heightScale,s.z);
		Vector3 pos = transform.position;
		transform.position = new Vector3 (pos.x, -heightScale / 2, pos.z);
		if (heaven == true ) {// '&& heightScale > 0
			transform.localScale = new Vector3 (s.x, 0,s.z);
		}
		if (heaven == false && heightScale < 0) {
			transform.localScale = new Vector3 (s.x, 0,s.z);
		} else if (heaven == false) {
			transform.localScale = new Vector3 (s.x, heightScale * 2,s.z);
			transform.position = new Vector3 (pos.x, -heightScale, pos.z);
		}
	}
}
