Example #1
0
 public void Stop(bool _copy = true)
 {
     StudioTween.Stop(((Component)this.childRoot).get_gameObject());
     if (this.disposable != null)
     {
         this.disposable.Dispose();
         this.disposable = (SingleAssignmentDisposable)null;
     }
     if (!this.listPoint.IsNullOrEmpty <OCIRoutePoint>() && _copy)
     {
         this.disposable = new SingleAssignmentDisposable();
         this.disposable.set_Disposable((IDisposable)DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.EveryLateUpdate(), (Action <M0>)(_ =>
         {
             Transform transform = this.listPoint[0].objectItem.get_transform();
             this.childRoot.SetPositionAndRotation(transform.get_position(), transform.get_rotation());
         })), (Component)this.childRoot));
     }
     this.nowIndex         = 0;
     this.routeInfo.active = false;
 }
Example #2
0
        private bool Move()
        {
            StudioTween.Stop(((Component)this.childRoot).get_gameObject());
            if (this.routeInfo.loop)
            {
                if (this.nowIndex >= this.listPoint.Count)
                {
                    this.nowIndex = 0;
                }
            }
            else if (this.nowIndex >= this.listPoint.Count - 1)
            {
                this.routeInfo.active = false;
                Singleton <Studio.Studio> .Instance.routeControl.SetState(this.objectInfo, RouteNode.State.End);

                return(false);
            }
            Hashtable args = new Hashtable();

            switch (this.listPoint[this.nowIndex].connection)
            {
            case OIRoutePointInfo.Connection.Line:
                Transform[] transformArray;
                if (this.nowIndex == this.listPoint.Count - 1)
                {
                    transformArray = new Transform[2]
                    {
                        this.listPoint[this.listPoint.Count - 1].objectItem.get_transform(),
                        this.listPoint[0].objectItem.get_transform()
                    }
                }
                ;
                else
                {
                    transformArray = this.listPoint.Skip <OCIRoutePoint>(this.nowIndex).Take <OCIRoutePoint>(2).Select <OCIRoutePoint, Transform>((Func <OCIRoutePoint, Transform>)(v => v.objectItem.get_transform())).ToArray <Transform>();
                }
                args.Add((object)"path", (object)transformArray);
                break;

            case OIRoutePointInfo.Connection.Curve:
                List <Transform> list = ((IEnumerable <Transform>) this.listPoint[this.nowIndex].transform).ToList <Transform>();
                if (this.nowIndex + 1 >= this.listPoint.Count)
                {
                    list.Add(this.listPoint[0].objectItem.get_transform());
                }
                else
                {
                    list.Add(this.listPoint[this.nowIndex + 1].objectItem.get_transform());
                }
                args.Add((object)"path", (object)list.ToArray());
                break;
            }
            args.Add((object)"speed", (object)(float)((double)this.listPoint[this.nowIndex].routePointInfo.speed * 10.0));
            args.Add((object)"easetype", (object)this.listPoint[this.nowIndex].routePointInfo.easeType);
            args.Add((object)"looptype", (object)StudioTween.LoopType.none);
            switch (this.routeInfo.orient)
            {
            case OIRouteInfo.Orient.XY:
                args.Add((object)"orienttopath", (object)true);
                break;

            case OIRouteInfo.Orient.Y:
                args.Add((object)"orienttopath", (object)true);
                args.Add((object)"axis", (object)"y");
                break;
            }
            StudioTween.MoveTo(((Component)this.childRoot).get_gameObject(), args).onComplete += new StudioTween.CompleteFunction(this.Move);
            ++this.nowIndex;
            return(true);
        }