Example #1
0
    void LateUpdate()
    {
        VTile      t = tile.GetTile();
        VLayer     l = t.GetLayer(layerIndex);
        VAnimation a = t.GetAnimation(animationIndex);

        bool active = layerIndex == t.GetLayerIndex() && animationIndex == t.GetAnimationIndex() && frameIndex == t.GetFrameIndex();

        cachedVChunk = t.GetChunk(layerIndex, animationIndex, frameIndex);

        if (GetChunk().IsDirty() || t.GetPalette().IsDirty() || l.IsDirty() || a.IsDirty())
        {
            Refresh();
        }
        bool visible = l.GetVisible() && animationIndex == t.GetAnimationIndex() && frameIndex == t.GetFrameIndex();

        gameObject.layer = (visible && (active || (!l.GetOutline() && !l.GetTransparent()))) ? 10 : 0;
        if (Tool.editing && active)
        {
            visible = false;
        }
        if (mr)
        {
            mr.enabled = visible;
        }
    }