Exemple #1
0
    private void RegisterLowNeed(ENeedType needType)
    {
        int newNeedPriority = NeedsToolkit.GetNeedPriority(needType);
        int newIndex        = GetNewIndexInListBasedOnPriority(newNeedPriority);

        m_lowNeedsSortedLowToHigh.Insert(newIndex, needType);
    }
    public void InitializeWithNeedType(ENeedType needType)
    {
        m_associatedNeed = needType;
        FetchDataForNeedType(needType);

        InitIcon();
        InitName();
    }
Exemple #3
0
    public void UpdateNeeds()
    {
        foreach (KeyValuePair <ENeedType, Need> need in m_needs)
        {
            ENeedType needType = need.Key;

            DecayNeed(needType);

            if (ShouldRegisterNeedAsLow(needType))
            {
                m_lowNeedsSortedLowToHigh.Add(needType);
            }
        }
    }
Exemple #4
0
    private ENeedType GetLeastSatisfiedNeed()
    {
        ENeedType lowestNeedType     = ENeedType.NONE;
        float     lowestSatisfaction = (float)ENeedState.SATISFIED;

        foreach (KeyValuePair <ENeedType, Need> need in m_needs)
        {
            ENeedType currentNeedType = need.Key;

            float currentNeedSatisfaction = m_needs[currentNeedType].Satisfaction;

            if (currentNeedSatisfaction < lowestSatisfaction)
            {
                lowestNeedType     = currentNeedType;
                lowestSatisfaction = currentNeedSatisfaction;
            }
        }

        return(lowestNeedType);
    }
Exemple #5
0
    private void InitializeNeedsDisplayItems()
    {
        ENeedType[] allNeeds = Toolkit.GetEnumValues <ENeedType>();

        for (int i = 0; i < allNeeds.Length; ++i)
        {
            ENeedType needType = allNeeds[i];

            if (needType == ENeedType.NONE)
            {
                continue;
            }

            if (m_needsDisplayItems.Count <= i)
            {
                CreateNewNeedDisplayItem();
            }

            m_needsDisplayItems[i].InitializeWithNeedType(needType);
        }
    }
Exemple #6
0
    private void CheckForNeedsReaction()
    {
        ENeedType needType = m_needsUpdater.GetHighestPriorityNeed();

        DebugTools.Log("[Character] - Highest priority need = {0}", needType);
    }
Exemple #7
0
 public NeedStateInfo GetNeedStateInfo(ENeedType needType)
 {
     return(m_needs[needType].GetStateInfo());
 }
Exemple #8
0
    private void DecayNeed(ENeedType needType)
    {
        float decayThisFrame = NEEDS_DECAY_IN_POINTS_PER_SECOND * Time.deltaTime;

        m_needs[needType].Decay(decayThisFrame);
    }
Exemple #9
0
    private bool IsNeedLowerInPriority(ENeedType needType, int priorityToCheckAgainst)
    {
        int currentNeedPriority = NeedsToolkit.GetNeedPriority(needType);

        return(currentNeedPriority < priorityToCheckAgainst);
    }
Exemple #10
0
    private bool ShouldRegisterNeedAsLow(ENeedType needType)
    {
        bool isNeedLow = m_needs[needType].State != ENeedState.SATISFIED;

        return(isNeedLow && !m_lowNeedsSortedLowToHigh.Contains(needType));
    }
 private void FetchDataForNeedType(ENeedType needType)
 {
     m_needTypeDisplayData  = m_displayDataSet.GetDataForNeed(needType);
     m_needStateDisplayData = m_needTypeDisplayData.m_stateDisplayData;
 }
Exemple #12
0
 public Need(ENeedType needType)
 {
     m_needType   = needType;
     Satisfaction = (float)ENeedState.SATISFIED;
 }
Exemple #13
0
 static public int GetNeedPriority(ENeedType need)
 {
     return((int)need);
 }
Exemple #14
0
    private NeedStateInfo GetNeedStateInfoFromDisplayItem(NeedDisplayItem item)
    {
        ENeedType associatedNeed = item.GetAssociatedNeed();

        return(m_currentCharacter.GetNeedsUpdater().GetNeedStateInfo(associatedNeed));
    }
 public NeedTypesDisplayData GetDataForNeed(ENeedType needType)
 {
     return(m_dataSet[needType]);
 }