calculateLayerDepthForChild() public method

gets the layerDepth for a child composite. It calculates it by first getting the composite (parent) layerDepth the standard way (via zIndexMin/Max) and then subtracting the inverse of the child (O2DMainItem) layerDepth which uses zIndexMaxChild. For this to work intelligently zIndexMaxComp should be the standard scene.zIndexMax value and zIndexMaxChild should be a much higher number. The reason for this is so that the parent component has a small offset to use for each child and so they dont overflow to the next zIndex. Example: parent is 14. Any children must end up being between 14 and 15 so they dont overflow on top of another composite.
public calculateLayerDepthForChild ( float zIndexMin, float zIndexMax, MainItemVO child, float zIndexMaxChild = 100 ) : float
zIndexMin float
zIndexMax float
child MainItemVO Child.
zIndexMaxChild float Z index max child.
return float
Exemplo n.º 1
0
		/// <summary>
		/// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
		/// </summary>
		/// <returns>The depth.</returns>
		/// <param name="zIndexMax">Z index max.</param>
		public float calculateLayerDepth( float zIndexMin, float zIndexMax, CompositeItemVO compositeItem )
		{
			if( compositeItem != null )
				return compositeItem.calculateLayerDepthForChild( zIndexMin, zIndexMax, this );

			return Mathf.map01( (float)zIndex, zIndexMin, zIndexMax );
		}
Exemplo n.º 2
0
        /// <summary>
        /// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
        /// </summary>
        /// <returns>The depth.</returns>
        /// <param name="zIndexMax">Z index max.</param>
        public float calculateLayerDepth(float zIndexMax, CompositeItemVO compositeItem)
        {
            if (compositeItem != null)
            {
                return(compositeItem.calculateLayerDepthForChild(zIndexMax, this));
            }

            return((zIndexMax - (float)zIndex) / zIndexMax);
        }
Exemplo n.º 3
0
        /// <summary>
        /// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
        /// </summary>
        /// <returns>The depth.</returns>
        /// <param name="zIndexMax">Z index max.</param>
        public float calculateLayerDepth(float zIndexMin, float zIndexMax, CompositeItemVO compositeItem)
        {
            if (compositeItem != null)
            {
                return(compositeItem.calculateLayerDepthForChild(zIndexMin, zIndexMax, this));
            }

            return(Mathf.map01((float)zIndex, zIndexMin, zIndexMax));
        }