void Update() { //TODO: Lerp color if (rend.material.color != LayerColors.FindLayerColor(gameObject.layer)) { rend.material.color = Color.Lerp(rend.material.color, LayerColors.FindLayerColor(gameObject.layer), 0.1f); } }
// Use this for initialization void Start() { cubeSource = GetComponent <AudioSource>(); fallingSource = GetComponent <AudioSource>(); cubeRadius = transform.lossyScale.x * 0.5f; pivot = new GameObject("Pivot"); pivot.transform.SetParent(transform); rend = gameObject.GetComponent <Renderer> (); if (GameManager.instance.CustomSpawn()) { rend.material.color = LayerColors.FindLayerColor(gameObject.layer); } else { rend.material.color = LayerColors.defaultColor; } //Set the first spawnpoint to the inital location of the player prefab (as set in scene editor) GameManager.instance.SetSpawn(transform.position); AlignPosition(); }