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; public class Guild : MonoBehaviour { public string guildName; public int maxStrength; public GameObject baseObject; [HideInInspector] public int strenghth public virtual void Awake() { strength = maxStrength; } }
It also needs a drop-off function. This time, however, we wanted to create an example using Euclidean distance:
public virtual float GetDropOff(float distance) ...