예제 #1
0
        private void SetSprite(FairyType iType, FairyState iState, int nIndex)
        {
            this.fairySprite.spriteName = ((iType != 0) ? $"mini{(int)iType}_{iState.ToString()}_{nIndex:D2}" : string.Empty);
            UISprite           fairySprite        = this.fairySprite;
            FairyAnimParameter fairyAnimParameter = _listFairyAnimationParameter[(int)iType];

            fairySprite.localSize = fairyAnimParameter.baseSpriteSize;
        }
예제 #2
0
        public void ImmediateIdle()
        {
            ((Collider)collider).enabled = false;
            base.transform.LTCancel();
            Transform          transform          = base.transform;
            FairyAnimParameter fairyAnimParameter = _listFairyAnimationParameter[(int)_iType];

            transform.LTMoveLocal(fairyAnimParameter.startPos, 0.15f).setEase(LeanTweenType.easeOutSine);
            base.transform.LTRotateLocal(Vector3.zero, 0.15f).setEase(LeanTweenType.easeOutSine);
            ReqFairyState(FairyState.Idle);
        }
예제 #3
0
        public void Show(FairyType iType, FairyState iState, Action onFinished)
        {
            ReqFairyType(iType);
            Transform          transform          = base.transform;
            FairyAnimParameter fairyAnimParameter = _listFairyAnimationParameter[(int)iType];

            transform.localPosition = fairyAnimParameter.startPos;
            PreparaAnimation(isFoward: true, delegate
            {
                ((Collider)collider).enabled = true;
                ReqFairyState(iState);
                Dlg.Call(ref onFinished);
            });
        }
예제 #4
0
        private void ReqFairyState(FairyState iState)
        {
            if (_iType == FairyType.None)
            {
                return;
            }
            StateParam stateParam = _listFairyAnimationParameter[(int)_iType].GetStateParam(iState);

            if (stateParam.spriteNum <= 0)
            {
                return;
            }
            _nSpriteIndex = 0;
            _listObserverStream.ForEach(delegate(IDisposable x)
            {
                x?.Dispose();
            });
            List <IDisposable> listObserverStream = _listObserverStream;
            FairyState         index2             = iState;
            StateParam         stateParam2        = _listFairyAnimationParameter[(int)_iType].GetStateParam(iState);

            listObserverStream[(int)index2] = (from x in Observable.IntervalFrame(stateParam2.drawIntervalFrame)
                                               select _nSpriteIndex ++).Subscribe(delegate(int index)
            {
                StateParam stateParam3 = _listFairyAnimationParameter[(int)_iType].GetStateParam(iState);
                int num = index % stateParam3.spriteNum;
                StateParam stateParam4 = _listFairyAnimationParameter[(int)_iType].GetStateParam(iState);
                int nIndex             = stateParam4.convertSpriteNumber[num];
                SetSprite(_iType, iState, nIndex);
            }).AddTo(base.gameObject);
            _iStatePrev = _iState;
            _iState     = iState;
            switch (iState)
            {
            case FairyState.Idle:
                break;

            case FairyState.Jump:
            {
                FairyAnimParameter fairyAnimParameter3 = _listFairyAnimationParameter[(int)_iType];
                Observable.TimerFrame(fairyAnimParameter3.jumpFrame).Subscribe(delegate
                    {
                        ReqFairyState(_iStatePrev);
                    });
                break;
            }

            case FairyState.Move:
                if (_iStatePrev != FairyState.Jump)
                {
                    FairyAnimParameter fairyAnimParameter = _listFairyAnimationParameter[(int)_iType];
                    float tripTime = fairyAnimParameter.tripTime;
                    FairyAnimParameter fairyAnimParameter2 = _listFairyAnimationParameter[(int)_iType];
                    float rotTime   = fairyAnimParameter2.rotTime;
                    float delayTime = tripTime * 2f;
                    base.transform.LTCancel();
                    base.transform.LTDelayedCall(delayTime, (Action) delegate
                    {
                        base.transform.LTRotateLocal(Vector3.zero, rotTime).setEase(LeanTweenType.easeOutSine);
                        Transform transform = base.transform;
                        FairyAnimParameter fairyAnimParameter4 = _listFairyAnimationParameter[(int)_iType];
                        transform.LTMoveLocalX(fairyAnimParameter4.endPos.x, tripTime).setEase(LeanTweenType.linear);
                        base.transform.LTRotateLocal(Vector3.up * 180f, rotTime).setDelay(tripTime).setEase(LeanTweenType.easeOutSine);
                        Transform transform2 = base.transform;
                        FairyAnimParameter fairyAnimParameter5 = _listFairyAnimationParameter[(int)_iType];
                        transform2.LTMoveLocalX(fairyAnimParameter5.startPos.x, tripTime).setDelay(tripTime).setEase(LeanTweenType.linear);
                    }).setOnCompleteOnStart(isOn: true).setLoopClamp();
                }
                break;
            }
        }