SubTachyon SubTachyon - 2 months ago 103 0

Bunnies are really soft and squishy.

ActionScript

Help me Martin, you're my only hope. Not counting Google + patience.

using UnityEngine;

public class Region : MonoBehaviour
{
    public string regionName;
    public GameObject controllingPlayer;

    private Player playerScript;
    private Color regionColor;
    private Renderer rend;

    void Start()
    {
        playerScript = controllingPlayer.GetComponent(typeof(Player)) as Player;
        rend = GetComponent<Renderer>();
    }
    
    void Update() //temporary
    {
        playerScript = controllingPlayer.GetComponent(typeof(Player)) as Player;
        updateRegionColour();
    }

    void updateRegionColour()
    {
        if (controllingPlayer == null)
        {
            regionColor = Color.white;
            return;
        }

        regionColor = playerScript.playerColor;

        rend.material.shader = Shader.Find("Specular");
        rend.material.SetColor("_SpecColor", regionColor);
    }
}
Comments