void OnDrawGizmosSelected() { Evade2D.DrawGizmos(Agent, evadeSensor); Arrive2D.DrawGizmos(Agent, arriveSensor); // Draw the obstacle sensor dimensions DrawUtil.DrawCircle(_obstacleSensor.transform.position, _obstacleSensorCollider.radius, Color.yellow); }
public override Vector2 SteerForce() { if (!evadeSensor.ShouldAvoid(Agent)) { arriveSensor.target = _lastHidingSpot; return(Arrive2D.SteerForce(Agent, arriveSensor)); } Vector2 hidingSpot = Vector2.zero; // Arrive at the hiding position. if (getNearestHidingSpot(ref hidingSpot)) { _lastHidingSpot = hidingSpot; arriveSensor.target = hidingSpot; return(Arrive2D.SteerForce(Agent, arriveSensor)); } // No hiding position available, evade target. else { return(Evade2D.SteerForce(Agent, evadeSensor)); } }