using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WallController : MonoBehaviour {

	#region variables
	private Renderer _renderer;
	private float _targetOpacity = 1f;
	private float _transitionSpeed = 5f;
	#endregion


	#region events
	void Awake () {

		_renderer = GetComponent <Renderer> ();
		
	}

	void Update () {
		Color c = _renderer.material.color;
		c.a = Mathf.Lerp (c.a, _targetOpacity, Time.deltaTime * _transitionSpeed);
		_renderer.material.color = c;
	}
	#endregion


	#region methods
	public void Toggle (bool show) {

		_targetOpacity = Convert.ToSingle (show);

	}
	#endregion
	
}
