﻿using UnityEngine;
using System.Collections;

public class CubeMove : MonoBehaviour {
	public GameObject obj;
	public bool color;
	public Material Red;
	public Material Green;
	//public float i;
	public int c;
	private Renderer rend;	//Вызвать рендер для работы материал
	//public static int Range = 1;  //ху знает зачем

	//public Vector3 v = new Vector3(1,1,1); присвоить v значение Вектора
	
	void Start () {
		//name = "CubeMove";
		//transform.position = new Vector3 (3, 3, 3);
		//Vector3 position = new Vector3(Random.Range(-10.0F, 10.0F), 0, Random.Range(-10.0F, 10.0F));
		//Instantiate(obj, position, Quaternion.identity);
		//хуй знает зачем
		rend = GetComponent<Renderer>();

	}
	void Update (){
		//меняем позицию обьекта рандоммо
		transform.localPosition = new Vector3(Random.Range(0f,1f),Random.Range(2f,3f),Random.Range(0f,1f));
		//!!!!!! Instantiate(obj, transform.localPosition , Quaternion.identity); //!!!!УБИВАЕТ ИГРУ!!!!!
		transform.rotation = Random.rotation;
		transform.localScale = new Vector3(Random.Range(0.9f,1f),Random.Range(0.9f,1f),Random.Range(0.9f,1f));
		c = (Random.Range(1,3));
		if (c == 2) {
			//rend.sharedMaterial = red;
			rend.material = Red;
			//Material = red;
		} else {
			//Material = Green;
			//rend.sharedMaterial = Green;
			rend.material = Green;
		}
	}
}
