private void Start()
 {
     _gameObjectColor              = GetComponent <GameObjectColor>();
     _skinnedMeshRenderer          = GetComponent <SkinnedMeshRenderer>();
     _colorTextureMapping          = GetComponent <ColorTextureMapping>();
     _skinnedMeshRenderer.material = _colorTextureMapping.GetTexture(_gameObjectColor.Value);
 }
 private void Update()
 {
     if (_lastColor != _gameObjectColor.Value)
     {
         _skinnedMeshRenderer.material = _colorTextureMapping.GetTexture(_gameObjectColor.Value);
     }
     _lastColor = _gameObjectColor.Value;
 }
Exemplo n.º 3
0
        private void Start()
        {
            _gameObjectColor = GetComponent <GameObjectColor>();
            Debug.AssertFormat(_gameObjectColor != null, "AutoMeshRepainter could not find a GameObjectColor attached" +
                               " to this object");
            _meshRenderer = GetComponent <MeshRenderer>();
            Debug.AssertFormat(_meshRenderer != null,
                               "AutoMeshRepainter could not find a MeshRenderer attached to this object");

            _colorTextureMapping = GetComponent <ColorTextureMapping>();
            Debug.AssertFormat(_colorTextureMapping != null,
                               "AutoMeshRepainter could not find a MeshRenderer attached to this object");

            _meshRenderer.material = _colorTextureMapping.GetTexture(_gameObjectColor.Value);
        }