示例#1
0
        public override ICompletable Perform(GameObject sourceContainer, GameObject targetContainer, Direction direction, float duration)
        {
            var sequencer = IsSequential ? (ISequencer)Sequence.Create() : Parallel.Create();

            PerformTransition(sourceContainer, targetContainer, IsSequential ? duration * 0.5f : duration, sequencer);
            return(sequencer);
        }
示例#2
0
        public virtual IEnumerator Hide()
        {
            yield return(Parallel.Create(this.gameObject.Move(Vector3.zero, this.HideTime, this.SpawnDelay, Curves.BackIn),
                                         this.gameObject.Scale(Vector3.zero, this.HideTime, this.SpawnDelay, Curves.BackIn)));

            this.Disable();
        }
示例#3
0
        public override ICompletable Perform(GameObject sourceContainer, GameObject targetContainer,
                                             Direction direction, float duration)
        {
            return(Parallel.Create(parallel =>
            {
                base.Perform(sourceContainer, targetContainer, direction, duration)
                .In(parallel);

                var targetTransform = (RectTransform)targetContainer.transform;

                if (sourceContainer != null)
                {
                    var sourceTransform = (RectTransform)sourceContainer.transform;
                    var offset = Offset.Multiply(targetTransform.rect.size) *
                                 (direction == Direction.Forward ? -1 : 1);
                    sourceTransform
                    .MoveAnchorTo(offset, duration, Easer)
                    .In(parallel);
                }

                targetTransform
                .MoveAnchorTo(Vector2.zero, duration, Easer)
                .In(parallel);
            }));
        }
示例#4
0
        public virtual IEnumerator Show()
        {
            this.Enable();
            var position = this.gameObject.transform.localPosition;
            var scale    = this.gameObject.transform.localScale;

            this.gameObject.transform.localPosition = Vector3.zero;
            this.gameObject.transform.localScale    = Vector3.zero;

            yield return(Parallel.Create(this.gameObject.Move(position, this.SpawnTime, this.SpawnDelay, Curves.ElasticOut),
                                         this.gameObject.Scale(scale, this.SpawnTime, this.SpawnDelay, Curves.ElasticOut)));
        }
示例#5
0
        private Nav StartNavigation(Presentation presentation)
        {
            var nav = new Nav(
                presentation.SourceView,
                presentation.TargetView,
                Parallel.Create(),
                presentation.Transition,
                presentation.Duration);

            _navigating.OnNext(nav);
            _view.Value = null;
            return(nav);
        }
示例#6
0
        public IEnumerator Launch(Vector3 startPosition, Vector3 direction)
        {
            this.Rigibody.velocity       = Vector3.zero;
            this.transform.localPosition = Vector3.zero;
            this.transform.localScale    = Vector3.zero;
            this.Rigibody.simulated      = false;
            this.Enable();

            yield return(Parallel.Create(
                             this.gameObject.Move(startPosition, this.BulletSpawTime, curve: Curves.CircularIn),
                             this.gameObject.Scale(this.BulletSpawScale, this.BulletSpawTime, curve: Curves.CircularIn)));

            this.Rigibody.simulated = true;
            this.Rigibody.velocity  = direction.normalized * this.BulletSpeed;
            yield return(new WaitUntil(() => this.transform.position.magnitude > 30));

            this.Disable();
        }
示例#7
0
        public override ICompletable Perform(GameObject sourceContainer, GameObject targetContainer,
                                             Direction direction, float duration)
        {
            return(Parallel.Create(step =>
            {
                base.Perform(sourceContainer, targetContainer, direction, duration)
                .In(step);

                if (sourceContainer != null)
                {
                    var scale = direction == Direction.Forward ? EndScale : StartScale;
                    var rectTransform = (RectTransform)sourceContainer.transform;
                    rectTransform
                    .ScaleTo(scale, duration, Easer)
                    .In(step);
                }

                var targetRectTransform = (RectTransform)targetContainer.transform;
                targetRectTransform
                .ScaleTo(1f, duration, Easer)
                .In(step);
            }));
        }
示例#8
0
 private ICompletable ShowHideText(Vector3 position, float alpha) =>
 Parallel.Create(
     () => Text.GetComponent <CanvasGroup>().FadeTo(alpha, ShowHideTextDuration, Easer.InOutCubic),
     () => Text.transform.MoveTo(position, ShowHideTextDuration, Easer.InOutCubic));
示例#9
0
 public override void Setup()
 {
     base.Setup();
     _parallel = Parallel.Create();
 }
示例#10
0
 private IObservable <Unit> ShowHideText(Vector3 position, float alpha) =>
 Parallel.Create(
     () => Text.GetComponent <CanvasGroup>().DOFadeTo(alpha, ShowHideTextDuration).SetEase(Ease.InOutCubic).ToObservable(),
     () => Text.transform.DOLocalMove(position, ShowHideTextDuration).SetEase(Ease.InOutCubic).ToObservable());