Exemplo n.º 1
0
    void UpdateReproductiveMultiplier()
    {
        ReproductiveClock += Time.deltaTime;

        if (ReproductiveClock <= AgentsSharedParameters.ReproductiveRecoveryTime)
        {
            ReproductiveMultiplier = AgentUtils.Remap(ReproductiveClock, 0f, AgentsSharedParameters.ReproductiveRecoveryTime, 0f, 1f);
        }
    }
Exemplo n.º 2
0
    public int FindMostUrgentNeed(Agent agent)
    {
        int index = NULLNEED;


        // Remap Values
        float rmpFood   = AgentUtils.Remap(agent.Food, 0f, agent.AgentsSharedParameters.MaxFood, 0f, 1f);
        float rmpEnergy = AgentUtils.Remap(agent.Energy, 0f, agent.AgentsSharedParameters.MaxEnergy, 0f, 1f);
        float rmpAge    = AgentUtils.Remap(agent.CurrentAge, 0f, agent.MaxAge, 0f, 1f);

        //FoodNeedOverride = ValidateOverride(foodToHunger, rmpFood);

        // Evaluate Need Curves
        NeedsValues[HUNGRY] = foodToHunger.Evaluate(rmpFood) * OverrideNeed(FoodNeedOverride);
        NeedsValues[TIRED]  = energyToTiredness.Evaluate(rmpEnergy);
        NeedsValues[WORK]   = energyToReadyness.Evaluate(rmpEnergy) * OverrideNeed(WorkNeedOverride);
        NeedsValues[HORNY]  = agent.ReproductiveMultiplier * ageToHorney.Evaluate(rmpAge);


        //find Biggest Value
        float mostUrgent = 0f;
        int   i          = 0;

        foreach (float need in NeedsValues)
        {
            if (need > mostUrgent)
            {
                mostUrgent = need;
                index      = i;
            }

            i++;
        }

        return(index);
    }
Exemplo n.º 3
0
    void UpdateFoodBar()
    {
        float mapedBar = AgentUtils.Remap(FoodValue, 0f, MaxFood, 0f, 1f);

        _foodBar.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, mapedBar);
    }
Exemplo n.º 4
0
    public void UpdateBar()
    {
        float mapedBar = AgentUtils.Remap(BarValue.Value, MinValue, MaxValue, 0f, 120f);

        this._rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, mapedBar);
    }