Class Motivator

  • All Implemented Interfaces:
    java.io.Serializable

    public class Motivator
    extends java.lang.Object
    implements java.io.Serializable
    Represents a motivator based on the PSI model, which is an instance of MotivatorType
    Author:
    Meiyii Lim
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static float MotivatorDecayFactor
      Constant value that defines how fast should a drive decay over time.
    • Constructor Summary

      Constructors 
      Constructor Description
      Motivator​(short type, float decayFactor, float weight, float intensity)
      Creates a new Motivator
      Motivator​(Motivator mot)
      Creates a new Motivator that consists in a copy of a given motivator
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void DecayMotivator()
      Decays the motivator intensity according to the system's timer
      float GetDecayFactor()  
      float GetIntensity()
      Gets the motivator's intensity
      float GetNeed()
      Deprecated.
      use GetNeedUrgency() instead.
      float GetNeedUrgency()
      Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
      short GetType()
      Gets the motivator's type
      float GetWeight()
      Gets the motivator's weight
      void SetDecayFactor​(float newAffiliationDecayFactor)  
      void SetIntensity​(float intensity)
      Set the motivator's intensity
      void SetWeight​(float weight)  
      java.lang.String toXml()
      Converts the Motivator to XMl
      float UpdateIntensity​(float effect)
      Update the motivator's intensity
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MotivatorDecayFactor

        public static final float MotivatorDecayFactor
        Constant value that defines how fast should a drive decay over time.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Motivator

        public Motivator​(short type,
                         float decayFactor,
                         float weight,
                         float intensity)
        Creates a new Motivator
        Parameters:
        type - - the type of built-in motivator // * @param threshold - the min value for the motivator that the character wants to maintain
        decayFactor - - the decay factor for the intensity of the motivator over time
        weight - - the weight of the motivator
        intensity - - intensity of the built-in motivator, the higher the intensity the lower the need due to a smaller deviation from the threshold, this value will be pre-defined based on scenario
      • Motivator

        public Motivator​(Motivator mot)
        Creates a new Motivator that consists in a copy of a given motivator
        Parameters:
        mot - - the motivator that will be copied into the new motivator
    • Method Detail

      • GetType

        public short GetType()
        Gets the motivator's type
        Returns:
        a short representing the motivator type (enumerable)
        See Also:
        MotivatorType
      • GetWeight

        public float GetWeight()
        Gets the motivator's weight
        Returns:
        a float value corresponding to the motivator's weight
      • SetWeight

        public void SetWeight​(float weight)
      • GetIntensity

        public float GetIntensity()
        Gets the motivator's intensity
        Returns:
        a float value corresponding to the motivator's intensity
      • GetNeed

        public float GetNeed()
        Deprecated.
        use GetNeedUrgency() instead.
        Gets the motivator's need
        Returns:
        a float value corresponding to the motivator's intensity
      • GetNeedUrgency

        public float GetNeedUrgency()
        Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
        Returns:
        a multiplier corresponding to the motivator's urgency
      • UpdateIntensity

        public float UpdateIntensity​(float effect)
        Update the motivator's intensity
        Returns:
        a float value corresponding to the difference between the current and the old value
      • SetIntensity

        public void SetIntensity​(float intensity)
        Set the motivator's intensity
      • DecayMotivator

        public void DecayMotivator()
        Decays the motivator intensity according to the system's timer
      • toXml

        public java.lang.String toXml()
        Converts the Motivator to XMl
        Returns:
        a XML String that contains all information about the Motivator
      • GetDecayFactor

        public float GetDecayFactor()
      • SetDecayFactor

        public void SetDecayFactor​(float newAffiliationDecayFactor)