Example #1
0
        public void SetStand(IAnimalActionPointUser animal, Transform t)
        {
            if (animal == null || Object.op_Equality((Object)t, (Object)null))
            {
                return;
            }
            IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false));

            iconnectableObservable.Connect();
            Vector3    position = animal.Position;
            Quaternion rotation = animal.Rotation;

            switch (this._directionType)
            {
            case AnimalActionPoint.DirectionKind.Lock:
                ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value())));
                break;

            case AnimalActionPoint.DirectionKind.Look:
                Quaternion lookRotation = Quaternion.LookRotation(Vector3.Normalize(Vector3.op_Subtraction(t.get_position(), animal.Position)));
                ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                break;
            }
            if (!this._enabledPositionValue)
            {
                return;
            }
            ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value())));
        }
Example #2
0
 public void RemoveBooking(IAnimalActionPointUser animal)
 {
     if (!this.bookings.Contains(animal))
     {
         return;
     }
     this.bookings.Remove(animal);
 }
Example #3
0
 public void AddBooking(IAnimalActionPointUser animal)
 {
     if (this.bookings.Contains(animal))
     {
         return;
     }
     this.bookings.Add(animal);
 }
Example #4
0
 public bool StopUsing(IAnimalActionPointUser animal)
 {
     if (this.User != animal)
     {
         return(false);
     }
     this.User = (IAnimalActionPointUser)null;
     return(true);
 }
Example #5
0
        public void SetUsedCoolTime(IAnimalActionPointUser _animal, float _time, bool _nonSetting)
        {
            int instanceId = _animal.InstanceID;

            if (_nonSetting && this.UsedCoolTime.ContainsKey(instanceId))
            {
                return;
            }
            this.UsedCoolTime[instanceId] = _time;
        }
Example #6
0
        public bool AvailableOutCoolTime(IAnimalActionPointUser _animal)
        {
            if ((this.AnimalType & _animal.AnimalType) == (AnimalTypes)0 || this.InUsed)
            {
                return(false);
            }
            int   instanceId = _animal.InstanceID;
            float num;

            return((!this.UsedCoolTime.TryGetValue(instanceId, out num) || 0.0 >= (double)num) && (!this.SearchedCoolTime.TryGetValue(instanceId, out num) || 0.0 >= (double)num));
        }
Example #7
0
        public void SetStand(IAnimalActionPointUser animal, Transform t, Action completeEvent)
        {
            if (animal == null || Object.op_Equality((Object)t, (Object)null))
            {
                if (completeEvent == null)
                {
                    return;
                }
                completeEvent();
            }
            else
            {
                IConnectableObservable <TimeInterval <float> > iconnectableObservable = (IConnectableObservable <TimeInterval <float> >)Observable.Publish <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false));
                iconnectableObservable.Connect();
                Vector3    position = animal.Position;
                Quaternion rotation = animal.Rotation;
                switch (this._directionType)
                {
                case AnimalActionPoint.DirectionKind.Lock:
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, t.get_rotation(), ((TimeInterval <float>) ref x).get_Value())));
                    break;

                case AnimalActionPoint.DirectionKind.Look:
                    Quaternion lookRotation = Quaternion.LookRotation(Vector3.Normalize(Vector3.op_Subtraction(t.get_position(), animal.Position)));
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Rotation = Quaternion.Slerp(rotation, lookRotation, ((TimeInterval <float>) ref x).get_Value())));
                    break;
                }
                if (this._enabledPositionValue)
                {
                    ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)iconnectableObservable, (Action <M0>)(x => animal.Position = Vector3.Lerp(position, t.get_position(), ((TimeInterval <float>) ref x).get_Value())));
                }
                Action comEvent = completeEvent;
                ObservableExtensions.Subscribe <TimeInterval <float>[]>(Observable.TakeUntilDestroy <TimeInterval <float>[]>((IObservable <M0>)Observable.WhenAll <TimeInterval <float> >((IObservable <M0>[]) new IObservable <TimeInterval <float> >[1]
                {
                    (IObservable <TimeInterval <float> >)iconnectableObservable
                }), ((Component)this).get_gameObject()), (Action <M0>)(_ =>
                {
                    Action action = comEvent;
                    if (action == null)
                    {
                        return;
                    }
                    action();
                }));
            }
        }
Example #8
0
 public bool SetUse(IAnimalActionPointUser animal)
 {
     if (animal == null)
     {
         return(false);
     }
     this.RemoveBooking(animal);
     if (this.InUsed && this.User != animal)
     {
         animal.MissingActionPoint();
         return(false);
     }
     this.RemoveAllBooking((Action <IAnimalActionPointUser>)(x => x?.MissingActionPoint()));
     if (this.User == null)
     {
         this.User = animal;
     }
     return(true);
 }
Example #9
0
 public bool MyUse(IAnimalActionPointUser animal)
 {
     return(animal == this.User);
 }
Example #10
0
 public bool ContainsBooking(IAnimalActionPointUser animal)
 {
     return(this.bookings.Contains(animal));
 }
Example #11
0
 public bool Available(IAnimalActionPointUser _animal)
 {
     return((this.AnimalType & _animal.AnimalType) != (AnimalTypes)0 && !this.InUsed);
 }