Example #1
0
 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);
     }
 }
Example #2
0
        public void AddLayer(string name, Color color)
        {
            LayerNames.Add(name);
            LayerColors.Add(color);
            var result = Count - 1;

            CurrentLayer           = result;
            VisibleIndices[result] = true;
        }
Example #3
0
 // 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();
 }
Example #4
0
        public void RemoveLayer(int layerIndex, Document document)
        {
            if (layerIndex < CurrentLayer)
            {
                CurrentLayer--;
            }
            var children = new List <Node>(document.Root.Children.Values);

            foreach (var child in children)
            {
                var interpreter = child.Set <LayerVisibilityInterpreter>();
                if (interpreter.TagIndex == layerIndex)
                {
                    DeleteNode(child, document);
                }
                if (interpreter.TagIndex > layerIndex)
                {
                    interpreter.TagIndex--;
                }
            }
            LayerNames.RemoveAt(layerIndex);
            LayerColors.RemoveAt(layerIndex);
        }