using UnityEngine;
using System.Collections;

public class CameraChange : MonoBehaviour {
	//Public
	[Header("Kamery")]
	public GameObject	cameraThird	= null;
	public GameObject	cameraSky	= null;
	
	//Private
	private float changeTimer	= 0f;
	
	void Start() {
	
	}
	
	void Update() {
		changeTimer	+= Time.deltaTime;
		if (Input.GetAxisRaw("CameraChange") == 1f && changeTimer > 0.5f) {
			if (cameraThird.activeSelf) {
				cameraThird.SetActive(false);
				cameraSky.transform.position	= new Vector3(
					cameraSky.transform.position.x,
					100f,
					cameraSky.transform.position.z
				);
				cameraSky.SetActive(true);
			} else if (cameraSky.activeSelf) {
				cameraSky.SetActive(false);
				cameraThird.SetActive(true);
			}
			changeTimer	= 0f;
		}
		
		if (cameraSky.activeSelf) {
			cameraSky.transform.position	= new Vector3(
				cameraSky.transform.position.x,
				cameraSky.transform.position.y + Input.GetAxis("MouseScrollWheel") * 10f,
				cameraSky.transform.position.z
			);
		}
		if (cameraSky.transform.position.y < 10f) {
			cameraSky.transform.position	= new Vector3(
				cameraSky.transform.position.x,
				10f,
				cameraSky.transform.position.z
			);
		}
		if (cameraSky.transform.position.y > 200f) {
			cameraSky.transform.position	= new Vector3(
				cameraSky.transform.position.x,
				200f,
				cameraSky.transform.position.z
			);
		}
	}
}
