using UnityEngine;
using System.Collections;

public class Trailer : MonoBehaviour {

	public int Colour;

	public void SetColour(int c)
	{
		Colour = c;
		Material colourMaterial;
		
		if (Colour == 0)
		{
			colourMaterial = Resources.Load("CustomMaterials/Trailer1", typeof(Material)) as Material;
		}
		else if (Colour == 1)
		{
			colourMaterial = Resources.Load("CustomMaterials/Trailer2", typeof(Material)) as Material;
		}
		else
		{
			colourMaterial = Resources.Load("CustomMaterials/Trailer3", typeof(Material)) as Material;
		}
		
		Debug.Log (colourMaterial.name);
		
		transform.Find ("body").gameObject.GetComponent<Renderer>().material = colourMaterial;
		transform.Find ("suspension").gameObject.GetComponent<Renderer>().material = colourMaterial;
	}

	// Use this for initialization
	void Start () {
		//SetColour(Random.Range(0,3));
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
