public void AddVillagerTarget(VillagerTarget newTarget) { if (VillagerTargets == null) { VillagerTargets = new List <VillagerTarget>(); } VillagerTargets.Add(newTarget); }
public VillagerTarget GetVillagerTarget(Vector3 villagerLocation, VillagerTarget currentBestTarget = null) { float currentInterestLevel = 0; if (currentBestTarget) { currentInterestLevel = GetTargetBaseInterest(villagerLocation, currentBestTarget) * 2; } foreach (VillagerTarget m in VillagerTargets) { float score = GetTargetBaseInterest(villagerLocation, m); if (score > currentInterestLevel) { currentInterestLevel = score; currentBestTarget = m; } } return(currentBestTarget); }
public void RemoveVillagerTarget(VillagerTarget oldTarget) { VillagerTargets.Remove(oldTarget); }