Exemplo n.º 1
0
        // Use this for initialization
        public override void Init()
        {
            //Alpha Fade in einbauen zusätzlich
            PanelImage = ObjectToAnimate.GetComponent <Image> ();
            if (PanelImage != null)
            {
                StandardColor = PanelImage.color;
                if (InOrOutMovement == InOrOut.IN)
                {
                    FadeInAnimation(DontDestroyAfterAnim);
                }
                else
                {
                    FadeOutAnimation(DontDestroyAfterAnim);
                }
            }
            else
            {
                //Theoretisch müsste jedes UI Objekt ein Image haben. Wenn es das nicht hat, dann ist es auch nicht
                //zu sehen und dann macht dieses Script keinen Sinn und löscht sich selbst.
                Destroy(this);
            }
            if (RandomMoveSpeed)
            {
                Speed = Random.Range(5f, 15f);
            }
            //Speed muss hier deutlich kleiner sein??
            Speed *= 0.30f;
//		DestroyAfterAnim = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// gibt die äußere Position abhängig von der richtungsangabe wieder
        /// diese wird dann als start oder target position verwendet,
        /// je nachdem ob nach innen oder nach außen geflogen wird.
        /// </summary>
        /// <returns>The distant position.</returns>
        private Vector3 GetDistantPosition()
        {
            Vector3       targetPosition = TransformToAnimate.localPosition;
            RectTransform OBRectTrans    = ObjectToAnimate.GetComponent <RectTransform> ();
            Rect          OBRect         = OBRectTrans.rect;

            //Berechnung der Startposition
            if (MoveDirectionMovement == MoveDirection.DOWN)
            {
                targetPosition = new Vector3(TransformToAnimate.localPosition.x, TransformToAnimate.localPosition.y + OBRect.height * MoveDistanceFactor, TransformToAnimate.localPosition.z);
            }
            else if (MoveDirectionMovement == MoveDirection.UP)
            {
                targetPosition = new Vector3(TransformToAnimate.localPosition.x, TransformToAnimate.localPosition.y - OBRect.height * MoveDistanceFactor, TransformToAnimate.localPosition.z);
            }
            else if (MoveDirectionMovement == MoveDirection.LEFT)
            {
                targetPosition = new Vector3(TransformToAnimate.localPosition.x + OBRect.width * MoveDistanceFactor, TransformToAnimate.localPosition.y, TransformToAnimate.localPosition.z);
            }
            else if (MoveDirectionMovement == MoveDirection.RIGHT)
            {
                targetPosition = new Vector3(TransformToAnimate.localPosition.x - OBRect.width * MoveDistanceFactor, TransformToAnimate.localPosition.y, TransformToAnimate.localPosition.z);
            }
            return(targetPosition);
        }