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()))); }
public void RemoveBooking(IAnimalActionPointUser animal) { if (!this.bookings.Contains(animal)) { return; } this.bookings.Remove(animal); }
public void AddBooking(IAnimalActionPointUser animal) { if (this.bookings.Contains(animal)) { return; } this.bookings.Add(animal); }
public bool StopUsing(IAnimalActionPointUser animal) { if (this.User != animal) { return(false); } this.User = (IAnimalActionPointUser)null; return(true); }
public void SetUsedCoolTime(IAnimalActionPointUser _animal, float _time, bool _nonSetting) { int instanceId = _animal.InstanceID; if (_nonSetting && this.UsedCoolTime.ContainsKey(instanceId)) { return; } this.UsedCoolTime[instanceId] = _time; }
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)); }
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(); })); } }
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); }
public bool MyUse(IAnimalActionPointUser animal) { return(animal == this.User); }
public bool ContainsBooking(IAnimalActionPointUser animal) { return(this.bookings.Contains(animal)); }
public bool Available(IAnimalActionPointUser _animal) { return((this.AnimalType & _animal.AnimalType) != (AnimalTypes)0 && !this.InUsed); }