Пример #1
0
        protected IObservable <TimeInterval <float> > FadeOutActionAsObservable(
            PlayerActor actor,
            int sex,
            Transform t,
            ActionPoint actionPoint)
        {
            if (Object.op_Inequality((Object)t, (Object)null))
            {
                Vector3         position = actor.Position;
                Quaternion      rotation = actor.Rotation;
                ActionPointInfo outInfo;
                actionPoint.TryGetPlayerActionPointInfo(actor.EventKey, out outInfo);
                Dictionary <int, Dictionary <int, PlayState> > dictionary1;
                Dictionary <int, PlayState> dictionary2;
                PlayState playState;
                if (Singleton <Resources> .Instance.Animation.PlayerActionAnimTable.TryGetValue(sex, out dictionary1) && dictionary1.TryGetValue(outInfo.eventID, out dictionary2) && dictionary2.TryGetValue(outInfo.poseID, out playState))
                {
                    IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(playState.MainStateInfo.OutStateInfo.FadeSecond, false), false));
                    iconnectableObservable.Connect();
                    switch (playState.DirectionType)
                    {
                    case 0:
                        if (playState.MainStateInfo.OutStateInfo.EnableFade)
                        {
                            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x =>
                            {
                                actor.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value());
                                actor.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value());
                            }));
                            break;
                        }
                        actor.Position = t.get_position();
                        actor.Rotation = t.get_rotation();
                        break;

                    case 1:
                        Quaternion lookRotation = Quaternion.LookRotation(Vector3.op_Subtraction(actionPoint.Position, position));
                        if (playState.MainStateInfo.OutStateInfo.EnableFade)
                        {
                            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => actor.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                            break;
                        }
                        actor.Rotation = lookRotation;
                        break;
                    }
                    return((IObservable <TimeInterval <float> >)iconnectableObservable);
                }
            }
            return((IObservable <TimeInterval <float> >)Observable.Empty <TimeInterval <float> >());
        }