public PersistentInterest(AsyncRef asyncRef) { interestList = new InterestList(); interestList.Add(asyncRef); interestList.Activate(); asyncRef.AddCallback(AsyncCompleteCallback); }
private void OnDamage(DamageInfo info, DamageablePart damageablePart) { Stimulation stim = null; if (info.sender != null) { stim = info.sender.GetComponentInChildren <Stimulation>(); } if (owner != null && stim != null && (owner.CurrentInterest == null || owner.CurrentInterest.stimulation == null || owner.CurrentInterest.stimulation != stim)) { AI_Interest interest = GetInterestIfExits(stim); if (interest != null) { interest.lastKnowPosition = info.sender.transform.position; } else { interest = new AI_Interest(stim, 0.35f); interest.lastKnowPosition = info.sender.transform.position; interest.inRange = true; interest.isAttackingMe = true; InterestList.Add(interest); } } }
private void HandleUpdate() { if (!needUpdate) { return; } needUpdate = false; Monitor.Enter(this); try { if (previewInterest != null) { previewInterest.Dispose(); previewInterest = null; waitingForCI = null; } if (_legend != null) { try { IFuture renderedLegendFuture = _legend.GetRenderedLegendFuture(displayableSource, (FutureFeatures)5); if (previewFuture != renderedLegendFuture) { previewFuture = renderedLegendFuture; AsyncRef asyncRef = (AsyncRef)renderedLegendFuture.Realize("LegendOptionsPanel.UpdatePreviewPanel"); if (asyncRef.present == null) { waitingForCI = new CallbackIgnorinator(this); asyncRef.AddCallback(waitingForCI.Callback); asyncRef.SetInterest(524296); previewInterest = new InterestList(); previewInterest.Add(asyncRef); previewInterest.Activate(); UpdatePreviewImage(null); } else { if (asyncRef.present is ImageRef) { UpdatePreviewImage((ImageRef)asyncRef.present); } } } } catch (Legend.RenderFailedException) { } } } finally { Monitor.Exit(this); } }
protected virtual void OnTriggerEnter(Collider other) { Stimulation stim = other.GetComponent <Stimulation>(); if (stim != null) { InterestList.Add(new AI_Interest(stim, CalculateInRangeAmount(stim))); } }
public List <Interest> GetInterestById(int id) { List <Interest> InterestList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.Interest_Get" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@ApplicantKey", id); } , map : delegate(IDataReader reader, short set) { int TransactionId = 0; Interest Interest = MapInterest(reader, out TransactionId); if (InterestList == null) { InterestList = new List <Interest>(); } InterestList.Add(Interest); } ); return(InterestList); }
private List <PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder) { List <PaintKit> list = new List <PaintKit>(); CoordinateSystemIfc defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem(); TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size); AsyncRef asyncRef; try { asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7) .Realize("ViewerControl.PaintLayer boundsRef"); } catch (Exception ex) { MessagePainter item = new MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0); foreach (TileDisplayDescriptor current in tileArrayDescriptor) { list.Add(new PaintKit(current.paintLocation) { annotations = { item } }); } return(list); } Region clipRegion = null; if (asyncRef.present == null) { asyncRef.AddCallback(BoundsRefAvailable); asyncRef.SetInterest(524290); } if ((ShowSourceCrop == null || ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider) { clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion( defaultCoordinateSystem.GetUnclippedMapWindow(center().llz, e.Size), center().llz.zoom, defaultCoordinateSystem); UpdateUserRegion(); } new PersistentInterest(asyncRef); int num = 0; foreach (TileDisplayDescriptor current2 in tileArrayDescriptor) { PaintKit paintKit = new PaintKit(current2.paintLocation); D.Sayf(10, "count {0} tdd {1}", new object[] { num, current2.tileAddress }); num++; if (e.SynchronousTiles) { D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[] { tileSource.GetHashCode(), current2.tileAddress }); } bool arg_1F5_0 = e.SynchronousTiles; Present present = tileSource.GetImagePrototype(null, (FutureFeatures)15) .Curry(new ParamDict(new object[] { TermName.TileAddress, current2.tileAddress })) .Realize("ViewerControl.PaintLayer imageAsyncRef"); AsyncRef asyncRef2 = (AsyncRef)present; Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation); int interest = rectangle.Height * rectangle.Width + 524296; asyncRef2.SetInterest(interest); if (asyncRef2.present == null) { AsyncNotifier @object = new AsyncNotifier(this); asyncRef2.AddCallback(@object.AsyncRecordComplete); } activeTiles.Add(asyncRef2); asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer"); if (e.SynchronousTiles) { D.Assert(false, "unimpl"); } if (asyncRef2.present == null) { D.Assert(!e.SynchronousTiles); } bool flag; if (asyncRef2.present != null && asyncRef2.present is ImageRef) { flag = false; ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc"); paintKit.meatyParts.Add(new ImagePainter(imageRef, clipRegion)); } else { if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds) { flag = false; } else { if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode) { flag = false; PresentFailureCode presentFailureCode = (PresentFailureCode)asyncRef2.present; MessagePainter item2 = new MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0); paintKit.annotations.Add(item2); } else { flag = true; MessagePainter item3 = new MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0); if (stackOrder == 0) { paintKit.meatyParts.Add(item3); } else { paintKit.annotations.Add(item3); } } } } tilesRequired++; if (!flag) { tilesAvailable++; } if (flag && stackOrder == 0 || MapDrawingOption.IsEnabled(ShowTileBoundaries)) { paintKit.annotations.Add(new TileBoundaryPainter()); } if (MapDrawingOption.IsEnabled(ShowTileNames)) { paintKit.annotations.Add(new TileNamePainter(current2.tileAddress.ToString())); } asyncRef2.Dispose(); list.Add(paintKit); } return(list); }