/// <summary> /// mutates an item in the eviction condition store, and returns true if it's not flagged for eviction /// </summary> /// <param name="soId"></param> /// <returns></returns> protected bool TouchExpirable(StoredObjectId soId) { if (soId == null) { return(false); } bool isExpired = false; //get the item's condition from the condition store var record = this.ExpirableStore.Get <ContextualId <StoredObjectId, IExpirable> >(soId); //if the eviction condition is touchable, touch it if (record != null && record.Context != null) { isExpired = record.Context.IsExpired(); //if the expirable is touchable, touch it if (record.Context is ITouchable) { ITouchable touch = (ITouchable)record.Context; touch.Touch(); } else if (record.Context is IPolyfacing) //or if it's polyfacing with a touchable face { IPolyfacing poly = (IPolyfacing)record.Context; var touch = poly.RootFace.AsHasTouchable(); if (touch != null) { touch.Touch(); } } } return(!isExpired); }
private void OnTriggerEnter2D(Collider2D other) { currentActionable = other.gameObject; ITouchable touchable = currentActionable.GetComponent <ITouchable>(); if (touchable != null) { touchable.Touch(); } }
public void WillOmitSelfFromCollection() { IMutablePicoContainer pico = GetDefaultPicoContainer(); pico.RegisterComponentImplementation(typeof(SimpleTouchable)); pico.RegisterComponentImplementation(typeof(TouchableObserver)); ITouchable observer = (ITouchable)pico.GetComponentInstanceOfType(typeof(TouchableObserver)); Assert.IsNotNull(observer); observer.Touch(); SimpleTouchable touchable = (SimpleTouchable)pico.GetComponentInstanceOfType(typeof(SimpleTouchable)); Assert.IsTrue(touchable.WasTouched); }
public static TouchResponseData TouchGameObject(TouchData touchData, object subject) { ITouchable touchable = ExtractTouchable(subject); if (touchable != null) { return(touchable.Touch(touchData)); } /*IActor actor = ExtractActor(subject); * if (actor != null) * { * return actor.ActorTouch(touchData); * }*/ return(TouchResponseData.block); }
public DependsOnTouchable(ITouchable touchable) { Assert.IsNotNull(touchable, "Touchable cannot be passed in as null"); touchable.Touch(); this.touchable = touchable; }
public void Touch() { theDelegate.Touch(); }