using System; using Duality; using Duality.Editor; namespace Steering { /// /// Defines the basic reactive behavior of an Agent /// public interface IAgentCharacteristics { /// /// [GET / SET] The preferred speed of the agent. /// [EditorHintFlags(MemberFlags.Invisible)] float PreferredSpeed { get; set; } /// /// [GET] The maximum speed of the agent. /// [EditorHintFlags(MemberFlags.Invisible)] float MaxSpeed { get; } /// /// Calculates the "cost" of a given velocity which are used to decide which velocity an agent should actually /// choose. There are multiple things this method needs to consider: /// /// /// Target /// Where does the agent want to move to? /// /// /// Speed /// How fast does the agent want to travel? /// /// /// Time of impact /// There are velocities which will lead to collisions with obstacles in the future /// /// /// Side /// It's often usful to prefer a "side" on which an agent avoids obstacles because it can help to reduce oscillations /// /// /// Based on those the function should calculate the cost for a given velocity. To to this it should somehow combine different weighted scores. /// /// The agent for which the cost should be evaluated /// The velocity which should be evaluated /// /// Normalized time of impact (between 0 and 1) for the velocity. A value of 0 means we are already colliding /// and a value of 1 means that a collision will occure earliest at the . /// /// The cost for the given velocity which should be between 0 and 1 float CalculateVelocityCost(Agent agent, Vector2 sampleVelocity, float toiPenality); } }