Example #1
0
        public static IObservable <Color> PlayInOut(Color from, Color inEnd, Color outStart, Color to, IAnimator inAnimator, IAnimator outAnimator, IScheduler scheduler)
        {
            var       inVelocity  = inAnimator.CalcFinishVelocity(Vector4.Distance(inEnd, from)).PerSecond;
            var       outVelocity = outAnimator.CalcStartVelocity(Vector4.Distance(to, outStart)).PerSecond;
            IAnimator linearAnimator;

            if (Math.Abs(inVelocity - outVelocity) < EqualDelta)
            {
                linearAnimator = Motion.Uniform((float)((inVelocity + outVelocity) / 2.0));
            }
            else
            {
                var accel = (outVelocity * outVelocity - inVelocity * inVelocity) / (2.0f * Vector4.Distance(outStart, inEnd));
                linearAnimator = Motion.Acceleration((float)accel, (float)inVelocity);
            }

            var compositeAnimator = new CompositeAnimator(new[]
            {
                Tuple.Create(inAnimator, Vector4.Distance(inEnd, from)),
                Tuple.Create(linearAnimator, Vector4.Distance(outStart, inEnd)),
                Tuple.Create(outAnimator, Vector4.Distance(to, outStart)),
            });

            return(Play(new[] { from, inEnd, outStart, to }, compositeAnimator, scheduler));
        }
Example #2
0
    protected virtual void PuzzleMoveAnim()
    {
        float   _targetX  = MovePos.Value.x / DefineClass.PuzzleXSize;
        float   _targetY  = MovePos.Value.y / DefineClass.PuzzleYSize;
        Vector3 targetPos = MovePos.Value;

        targetPos.x  = x;
        targetPos.y += DefineClass.PuzzleYSize;
        if (targetPos.y != GetPos().y)
        {
            Anime.Play(GetPos(), targetPos, Motion.Uniform(DefineClass.PuzzleDropAnimVel * (y - _targetY)))
            .SubscribeToLocalPosition(gameObject).AddTo(this);
        }

        Observable.Interval(TimeSpan.FromSeconds(DefineClass.PuzzleDropAnimVel * (_targetY - y))).First().Subscribe(x =>
        {
            Anime.Play(GetPos(), MovePos.Value, Motion.Uniform(DefineClass.PuzzleDropAnimVel))
            .Subscribe(_ =>
            {
                transform.localPosition = _;
                if (GetPos() == MovePos.Value)
                {
                    PuzzleManager.instance.puzzleArray[y, x] = null;
                    x = (int)_targetX;
                    y = (int)_targetY;
                    PuzzleManager.instance.puzzleArray[y, x] = this;
                }
            }).AddTo(this);
        }).AddTo(this);
    }
Example #3
0
 protected virtual void PuzzleChangeAnim(PuzzleBaseItemObj _target)
 {
     Anime.Play(transform.localPosition, _target.GetPos(), Motion.Uniform(DefineClass.PuzzleItemChangeAnimVel))
     .Subscribe(_ =>
     {
         transform.localPosition = _;
         if (transform.localPosition == _target.transform.localPosition)
         {
             PuzzleManager.instance.DestroyPuzzleItem();
         }
     });
 }
Example #4
0
 public virtual void DestroyPuzzleItem()
 {
     Anime.Play(transform.localScale, DefineClass.Vector3Zero, Motion.Uniform(DefineClass.PuzzleItemDestroyAnimVel))
     .Subscribe(_ =>
     {
         transform.localScale = _;
         if (transform.localScale == DefineClass.Vector3Zero)
         {
             PuzzleManager.instance.puzzleArray[y, x] = null;
             PoolManager.instance.puzzlePool.Return(this);
         }
     });
 }
Example #5
0
    public void addTimePop(PopUpInfo _info, bool _bBackGround, PopUpObj _obj = null)
    {
        PopUpBase popUpBase = make_PopUp(_info, _bBackGround, _obj);

        GameObject popObj = popUpBase.gameObject;

        Anime.Play(DefineClass.Vector3One3, DefineClass.Vector3One, Motion.Uniform(DefineClass.PopUpPunchAnimVel))
        .Subscribe(_ => popObj.transform.localScale = _).AddTo(this);

        Observable.Interval(TimeSpan.FromSeconds(DefineClass.PopUpTime)).First().Subscribe(_ =>
        {
            m_PopBackGround.SetActive(false);
            popUpBase.BackPopUp();
        }).AddTo(this);
    }