Пример #1
0
        public void Update()
        {
            ProcessChanges();
            ClampValues();
            ProcessMood();

            _urge    = (Urge)Utils.MaxIndex(_urgeValues);
            _emotion = (Emotion)Utils.MaxIndex(_emotionValues);
        }
Пример #2
0
 public void ResetUrge(Urge currentUrge)
 {
     urgeCurveDict[currentUrge].urgeValue = 0;
 }
Пример #3
0
 public void AffectUrge(Urge urge, int delta)
 {
     // todo expand
     _urgeValues[(int)urge] += delta;
 }
Пример #4
0
        public void Action(Urge action)
        {
            int iaction = (int)action;

            int[] indexes = EdgeIndexes(_urgeValues);
            int   maxA    = indexes[0];
            int   maxB    = indexes[1];
            int   minA    = indexes[2];
            int   minB    = indexes[3];

            Emotion[] emotions;
            int       type = 0;

            switch (action)
            {
            case Urge.Eat:
            case Urge.Drink:
                if (iaction == maxA)
                {
                    // highest
                    emotions = new[] { Emotion.Joy, Emotion.Surprise, Emotion.Trust };
                    type     = 2;
                }
                else if (iaction == maxB)
                {
                    // second highest
                    emotions = new[] { Emotion.Joy, Emotion.Anticipation };
                    type     = 1;
                }
                else if (iaction == minA)
                {
                    // lowest
                    emotions = new[] { Emotion.Disgust, Emotion.Sadness, Emotion.Anger };
                    type     = 2;
                }
                else if (iaction == minB)
                {
                    // second lowest
                    emotions = new[] { Emotion.Disgust, Emotion.Sadness };
                    type     = 1;
                }
                else
                {
                    emotions = new[] { Emotion.Anticipation, Emotion.Sadness, Emotion.Trust };
                }
                break;

            case Urge.Excrete:
            case Urge.Reproduce:
                if (iaction == maxA)
                {
                    // highest
                    emotions = new[] { Emotion.Joy, Emotion.Trust, Emotion.Surprise };
                    type     = 2;
                }
                else if (iaction == maxB)
                {
                    // second highest
                    emotions = new[] { Emotion.Joy, Emotion.Anticipation };
                    type     = 1;
                }
                else if (iaction == minA)
                {
                    // lowest
                    emotions = new[] { Emotion.Disgust, Emotion.Anger, Emotion.Fear };
                    type     = 2;
                }
                else if (iaction == minB)
                {
                    // second lowest
                    emotions = new[] { Emotion.Disgust, Emotion.Anger };
                    type     = 1;
                }
                else
                {
                    emotions = new[] { Emotion.Anticipation, Emotion.Sadness, Emotion.Trust };
                }
                break;

            case Urge.Sleep:
                if (iaction == maxA)
                {
                    // highest
                    emotions = new[] { Emotion.Joy, Emotion.Fear };
                    type     = 2;
                }
                else if (iaction == maxB)
                {
                    // second highest
                    emotions = new[] { Emotion.Joy, Emotion.Fear };
                    type     = 1;
                }
                else if (iaction == minA)
                {
                    // lowest
                    emotions = new[] { Emotion.Anger, Emotion.Joy };
                    type     = 2;
                }
                else if (iaction == minB)
                {
                    // second lowest
                    emotions = new[] { Emotion.Anger, Emotion.Joy };
                    type     = 1;
                }
                else
                {
                    emotions = new[] { Emotion.Joy, Emotion.Fear, Emotion.Trust };
                }
                break;

            case Urge.Heal:
                if (iaction == maxA)
                {
                    // highest
                    emotions = new[] { Emotion.Joy, Emotion.Fear, Emotion.Anticipation };
                    type     = 2;
                }
                else if (iaction == maxB)
                {
                    // second highest
                    emotions = new[] { Emotion.Fear, Emotion.Joy };
                    type     = 1;
                }
                else if (iaction == minA)
                {
                    // lowest
                    emotions = new[] { Emotion.Fear, Emotion.Anticipation, Emotion.Anger };
                    type     = 2;
                }
                else if (iaction == minB)
                {
                    // second lowest
                    emotions = new[] { Emotion.Fear, Emotion.Anticipation };
                    type     = 1;
                }
                else
                {
                    emotions = new[] { Emotion.Fear, Emotion.Anticipation, Emotion.Trust };
                }
                break;

            default:
                Console.WriteLine($"Unimplemented action. a:{action}");
                return;
            }

            for (int i = 0; i < emotions.Length; ++i)
            {
                _emotionValues[(int)emotions[i]] += TYPE_VALUES[type, i];
            }

            _urgeValues[iaction] -= 5;
        }
Пример #5
0
 public bool SatisfiesUrge(Urge urge)
 {
     return(urge == choreType.urge);
 }
 public bool HasUrge(Urge urge)
 {
     return(urges.Contains(urge));
 }
 public void RemoveUrge(Urge urge)
 {
     urges.Remove(urge);
     Trigger(231622047, urge);
 }
 public void AddUrge(Urge urge)
 {
     DebugUtil.Assert(urge != null);
     urges.Add(urge);
     Trigger(-736698276, urge);
 }