Ejemplo n.º 1
0
        public void SetParams(float?duration      = null, EaseType?easeType = null, SheetAlignment?beforeAlignment = null,
                              Vector3?beforeScale = null, float?beforeAlpha = null, SheetAlignment?afterAlignment  = null,
                              Vector3?afterScale  = null, float?afterAlpha  = null)
        {
            if (duration.HasValue)
            {
                _duration = duration.Value;
            }

            if (easeType.HasValue)
            {
                _easeType = easeType.Value;
            }

            if (beforeAlignment.HasValue)
            {
                _beforeAlignment = beforeAlignment.Value;
            }

            if (beforeScale.HasValue)
            {
                _beforeScale = beforeScale.Value;
            }

            if (beforeAlpha.HasValue)
            {
                _beforeAlpha = beforeAlpha.Value;
            }

            if (afterAlignment.HasValue)
            {
                _afterAlignment = afterAlignment.Value;
            }

            if (afterScale.HasValue)
            {
                _afterScale = afterScale.Value;
            }

            if (afterAlpha.HasValue)
            {
                _afterAlpha = afterAlpha.Value;
            }
        }
Ejemplo n.º 2
0
        public static Vector3 ToPosition(this SheetAlignment self, RectTransform rectTransform)
        {
            Vector3 position;
            var     rect   = rectTransform.rect;
            var     width  = rect.width;
            var     height = rect.height;
            var     z      = rectTransform.localPosition.z;

            switch (self)
            {
            case SheetAlignment.Left:
                position = new Vector3(-width, 0, z);
                break;

            case SheetAlignment.Top:
                position = new Vector3(0, height, z);
                break;

            case SheetAlignment.Right:
                position = new Vector3(width, 0, z);
                break;

            case SheetAlignment.Bottom:
                position = new Vector3(0, -height, z);
                break;

            case SheetAlignment.Center:
                position = new Vector3(0, 0, z);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(self), self, null);
            }

            return(position);
        }