コード例 #1
0
    public void AddVillagerTarget(VillagerTarget newTarget)
    {
        if (VillagerTargets == null)
        {
            VillagerTargets = new List <VillagerTarget>();
        }

        VillagerTargets.Add(newTarget);
    }
コード例 #2
0
    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);
    }
コード例 #3
0
 public void RemoveVillagerTarget(VillagerTarget oldTarget)
 {
     VillagerTargets.Remove(oldTarget);
 }