コード例 #1
0
ファイル: Perceptions.cs プロジェクト: zachary-kaelan/CSharp
        internal Reaction ObserveVerb(ushort verbID, VerbTargetInfo target, TraitsVector reactorTraits, float verbIntensity)
        {
            IVerb verbTraits = null;

            if (ObservedActions.TryGetValue(verbID, out ObservedVerb verb))
            {
                verbTraits = verb.GetTraits();
                ObservedActions[verbID] = verb;
            }
            else
            {
                verb       = new ObservedVerb(verbID);
                verbTraits = verb.GetTraits();
                ObservedActions.Add(verbID, verb);
            }

            if (!verb.HitLimit)
            {
                ++TotalPerceptions;
                // could also be used to represent desensitization to violence
                float magnitude = (1.0f / verb.NumberOfTimes) * (1 - verbIntensity);
                //TraitsVector thisTraits = this;
                AddVector(verbTraits.ApplyMagnitude(magnitude));


                if (verbTraits.VerbType == VerbType.None)
                {
                    AddVector(verbTraits.ApplyMagnitude(magnitude));
                }
                else if (verb)
                {
                }

                return(new Reaction(
                           (reactorTraits - verbTraits).SumToBounded().Suppress(1 - magnitude),
                           ((TraitsVector)this - verbTraits).SumToBounded().Suppress(1 - magnitude),
                           verbTraits,
                           magnitude,
                           verbIntensity
                           ));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: Reaction.cs プロジェクト: zachary-kaelan/CSharp
 public Reaction(UBoundedNumber agreement, UBoundedNumber surprise, UBoundedNumber significance, TraitsVector totalDissonance, TraitsVector characterDissonance, TraitsVector expressiveDissonance) :
     this(agreement, surprise, significance, totalDissonance, characterDissonance)
 {
     ExpressiveDissonance = expressiveDissonance;
 }
コード例 #3
0
ファイル: Reaction.cs プロジェクト: zachary-kaelan/CSharp
 public Reaction(UBoundedNumber agreement, UBoundedNumber surprise, UBoundedNumber significance, TraitsVector totalDissonance)
 {
     Agreement            = agreement;
     Surprise             = surprise;
     Significance         = significance;
     TotalDissonance      = totalDissonance;
     ExpressiveDissonance = null;
     CharacterDissonance  = null;
 }
コード例 #4
0
ファイル: Perceptions.cs プロジェクト: zachary-kaelan/CSharp
        internal static (Perception, Reaction) FromFirstImpression(PersonalityTraits other, Perception globalPerceptions, ushort verbID, ushort targetID, bool notTarget, float verbIntensity, TraitsVector reactorTraits)
        {
            // personaliy vs circumstance
            var perceptions = new Perception(other, 1 - verbIntensity);

            perceptions.Blend(globalPerceptions, 0.75f);
            perceptions.CircumferentialValues = globalPerceptions.CircumferentialValues;
            ++perceptions.TotalPerceptions;
            ++globalPerceptions.TotalPerceptions;
            //perceptions._personalFirstImpression = !notTarget;
            //perceptions._firstImpressionIntensity = verbIntensity;

            ObservedVerb verb         = new ObservedVerb(verbID);
            var          actionTraits = verb.GetTraits().ApplyMagnitude(verbIntensity);

            perceptions.AddVector(actionTraits);

            return(
                perceptions,
                new Reaction(
                    (reactorTraits - actionTraits).SumToBounded(),
                    (perceptions - actionTraits).SumToBounded(),
                    actionTraits,
                    1f,
                    verbIntensity
                    )
                );
        }