public void AcceptsFalse() { subject.rule = new RuleContainer { Interface = new FalseRuleStub() }; Assert.IsTrue(container.Accepts(containingObject)); }
public IEnumerator AcceptsMatch() { UnityObjectObservableList objects = containingObject.AddComponent <UnityObjectObservableList>(); yield return(null); subject.Objects = objects; objects.Add(containingObject); Assert.IsTrue(container.Accepts(containingObject)); }
public IEnumerator AcceptsMatch() { StringObservableList tags = containingObject.AddComponent <StringObservableList>(); yield return(null); subject.Tags = tags; tags.Add(validTag); Assert.IsTrue(container.Accepts(containingObject)); }
public void AcceptsExactMatch() { Vector3 toFind = new Vector3(1f, 2f, 1f); subject.Target = new Vector3(1f, 2f, 1f); Assert.IsTrue(container.Accepts(toFind)); }
public void AcceptsMatch() { subject.rules.Add( new RuleContainer { Interface = new TrueRuleStub() }); subject.rules.Add( new RuleContainer { Interface = new FalseRuleStub() }); Assert.IsTrue(container.Accepts(containingObject)); }
/// <summary> /// Determines whether events should be emitted. /// </summary> /// <param name="data">The data to check.</param> /// <returns><see langword="true"/> if events should be emitted.</returns> protected virtual bool CanEmit(EventData data) { return((data.isTrigger && emittedTypes.HasFlag(CollisionTypes.Trigger) || !data.isTrigger && emittedTypes.HasFlag(CollisionTypes.Collision)) && (data.forwardSource == null || forwardingSourceValidity.Accepts(data.forwardSource.gameObject))); }
/// <summary> /// Determines whether the <see cref="RaycastHit"/> data contains a valid surface. /// </summary> /// <param name="collisionData">The <see cref="RaycastHit"/> data to check for validity on.</param> /// <returns><see langword="true"/> if the <see cref="RaycastHit"/> data contains a valid surface.</returns> protected virtual bool ValidSurface(RaycastHit collisionData) { if (targetValidity != null && collisionData.transform != null) { return(targetValidity.Accepts(collisionData.transform.gameObject)); } return(true); }
/// <summary> /// Consumes data from a from a <see cref="ActiveCollisionPublisher"/>. /// </summary> /// <param name="publisher">The publisher of the data.</param> /// <param name="currentCollision">The current collision within published data.</param> public virtual void Consume(ActiveCollisionPublisher publisher, CollisionNotifier.EventData currentCollision) { if (!isActiveAndEnabled || !publisherValidity.Accepts(publisher.gameObject)) { return; } PublisherSource = publisher; CurrentCollision = currentCollision; Consumed?.Invoke(eventData.Set(PublisherSource, currentCollision)); }
public IEnumerator AcceptsMatch() { RuleContainerObservableList rules = containingObject.AddComponent <RuleContainerObservableList>(); yield return(null); subject.Rules = rules; rules.Add( new RuleContainer { Interface = new TrueRuleStub() }); rules.Add( new RuleContainer { Interface = new TrueRuleStub() }); Assert.IsTrue(container.Accepts(containingObject)); }
public void AcceptsInRange() { int toFind = 3; subject.Range = new IntRange(1, 4); Assert.IsTrue(container.Accepts(toFind)); }
public void AcceptsInRange() { float toFind = 3f; subject.Range = new FloatRange(1f, 4f); Assert.IsTrue(container.Accepts(toFind)); }
public void AcceptsOnNullContainer() { subject = null; Assert.IsTrue(subject.Accepts(argument)); }
public bool Accepts(object obj) { Debug.Log("accepted!"); return(container.Accepts(obj)); }
public void AcceptsMatch() { containingObject.SetActive(true); Assert.IsTrue(container.Accepts(containingObject)); }
/// <inheritdoc /> protected override bool IsTargetValid(GameObject target) { return(base.IsTargetValid(target) && targetValidity.Accepts(target)); }
/// <inheritdoc /> protected override bool IsSourceValid(GameObject source) { return(base.IsSourceValid(source) && sourceValidity.Accepts(source)); }
public void AcceptsFound() { string toFind = "found"; StringObservableList list = containingObject.AddComponent <StringObservableList>(); list.Add(toFind); subject.InListPattern = toFind; Assert.IsTrue(container.Accepts(containingObject)); }
public void AcceptsExactMatch() { string toFind = "test"; subject.TargetPattern = "test"; Assert.IsTrue(container.Accepts(toFind)); }
public void AcceptsMatch() { subject.objects.Add(containingObject); Assert.IsTrue(container.Accepts(containingObject)); }
public void AcceptsMatch() { subject.tags.Add(validTag); Assert.IsTrue(container.Accepts(containingObject)); }
/// <inheritdoc /> protected override bool IsValid() { return(base.IsValid() && receiveValidity.Accepts(Payload)); }
/// <summary> /// Determines whether the <see cref="RaycastHit"/> data contains a valid collision against the given rule. /// </summary> /// <param name="collisionData">The <see cref="RaycastHit"/> data to check for validity on.</param> /// <param name="rule">The <see cref="RuleContainer"/> to check the validity against.</param> /// <returns>Whether the <see cref="RaycastHit"/> data contains a valid collision.</returns> protected virtual bool CollisionMatchesRule(RaycastHit collisionData, RuleContainer rule) { return(collisionData.transform != null && rule.Accepts(collisionData.transform.gameObject)); }
/// <inheritdoc /> protected override bool IsValid() { return(base.IsValid() && publisherValidity.Accepts(Payload?.publisher?.PublisherContainer)); }
public void AcceptsMatch() { containingObject.layer = LayerMask.NameToLayer("UI"); subject.LayerMask = LayerMask.GetMask("UI"); Assert.IsTrue(container.Accepts(containingObject)); }
/// <inheritdoc /> public bool Accepts(object target) { return(!rule.Accepts(target)); }
/// <inheritdoc /> protected override bool IsValid() { return(base.IsValid() && receiveValidity.Accepts(GetTargetToCheck())); }
/// <summary> /// Determines if the current collision is valid. /// </summary> /// <param name="collisionData">The collision to check.</param> /// <returns>The validity result of the collision.</returns> protected virtual bool IsValidCollision(CollisionNotifier.EventData collisionData) { return(collisionData.collider != null && collisionValidity.Accepts(collisionData.collider.gameObject)); }