Example #1
0
    void UpdateEvade()
    {
        var leaderPos = (Vector2)leader.transform.position;

        var leaderDir = SteeringBehaviour.GetDirection(leader);

        var evadeTarget = leaderPos + leaderDir * forwardDistance;
        var position    = (Vector2)transform.position;

        evade.enabled = (position - evadeTarget).magnitude < evadeRadius;
        evade.SetTarget(evadeTarget);
    }