using UnityEngine;
using System.Collections;

public class Box_Move_X : MonoBehaviour {

	public float movmentSpeed = 1f;
	float minMove = 0.75f;
	float maxMove = 2f;

	float movePos;




	public CharacterController Player;
		



	
	
	void OnCollisionEnter (Collision collison){
		movmentSpeed = movmentSpeed * -1;
		
	}

	void Awake(){
		movePos = Random.Range(0,2);


	}
	
	// Use this for initialization
	void Start () {

		if(movePos == 0){
			movmentSpeed = movmentSpeed * -1;

		}

		movmentSpeed = Random.Range(minMove,maxMove);
















		
	}
	
	// Update is called once per frame
	void Update () {

	



		
		if(Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0 || !Player.isGrounded){
			transform.Translate(movmentSpeed * Time.deltaTime,0,0);
			
		}
		
		
		
		
		
		
		
	}
}
