Пример #1
0
    private float CalculateBitesize(Hex Habitat)
    {
        float required = (Habitat.GetTotalLocalPopulation() * .12f * baseFoodValue);

        return required;
    }
Пример #2
0
    //Ranks Prey based on local creatures stats and population to find the best targets
    public void RankPrey(Hex hex)
    {
        float deviation;
        float huntScore = 0;
        float popCut;
        float popScore;
        float tastiness = 0;
        float availPop = hex.GetTotalLocalPopulation() - GetLocalPopulation(hex);
        float totalCritters = hex.localCritters.Count;
        float critterCut = 100 / (totalCritters - 1);

        Critter spot;

        if(HuntScoreList.Capacity != totalCritters){
            HuntScoreList.Clear();
        }

        HuntScoreList.TrimExcess();

        for(int n = 0; n < totalCritters; n++){
            spot = hex.localCritters[n];

            if(spot != this){
                popScore = 0;
                huntScore = HuntScore(spot);

                float sneakiness = 100f - spot.SneakScore(this);
                popCut = (100 * spot.GetLocalPopulation(hex) / availPop);

                tastiness = (huntScore - sneakiness);

                deviation = popCut - critterCut;

                if(deviation >= 0){
                    popScore = 100 * (Mathf.Pow(deviation, 1.5f));
                    popScore = (Mathf.Round(popScore)) / 100;
                }
                else if(deviation < 0){
                    popScore = 0;
                }

                tastiness = (Mathf.Pow(tastiness / 10, 2f) + popScore);

                if(isPlayer){
                    //print(spot.name + "'s huntscore = " + huntScore + " vs tastiness = " + tastiness + "\r\n");
                }

                huntScore = ((tastiness) / 2) * 10 * AptitudeCheck(spot);

                dietType[] diet = spot.GetDiet();

                for(int i = 0; i < diet.Length; i++){
                    if(diet[i] == dietType.CARNO || diet[i] == dietType.SCAV){
                    huntScore = huntScore * .5f;
                        break;
                    }
                }

                huntScore = (Mathf.Round(10 * huntScore));

                HuntScoreList.Add(huntScore);
            } else{
                huntScore = 0;
                HuntScoreList.Add(0);
            }
        }

        HuntScoreList.TrimExcess();
        HuntChanceList.TrimExcess();
    }