/* very simple collision detection method all bounding boxes used are rectangular to allow use of the Intersects() method */ public bool DetectCollision(Agent target){ if (this.BoundingBox.Intersects (target.BoundingBox)) { return true; } return false; }
public Sensor (Agent owner, float range) { this.owner = owner; this.range = range; }
public AdjacentAgentSensor(Agent owner, float range) : base (owner, range){ AgentsInRange = new Dictionary<Agent, Tuple<float, float>>(); }
public Rangefinder (Agent owner, int range, float headingOffset) : base(owner, range) { this.headingOffset = headingOffset; }
public PieSliceSensor (Agent owner, float range, float headingOffset, String marker) : base(owner, range) { this.headingOffset = headingOffset; this.marker = marker; DetectedAgents = new List<Agent> (); }
private void CheckConstraints(Agent a, float relativeHeading, float lowConstraint, float highConstraint) { if ((Orientation + relativeHeading) % MathHelper.ToRadians (360) < highConstraint && (Orientation + relativeHeading) % MathHelper.ToRadians (360) > lowConstraint) { ActivationLevel++; DetectedAgents.Add (a); } }