The previous influence computation is good when dealing with simple influence that is based on individual units helping a faction. However, this could lead to holes in the map instead of covering a whole section. One technique to approach that problem is flooding; it's a technique based on Dijkstra's algorithm.
Improving influence with map flooding
Getting ready
In this recipe, we will combine two concepts into a class. First, tagging a vertex to represent that fact that it's owned by a faction; second, the drop-off function from units. Such a class is called Guild. This is a component to be attached to the game object; one component for each desired guild:
using UnityEngine; using System; using System.Collections...