Example #1
0
 public void SetEmotion(SpeechEmotion emotion)
 {
     /*
      * Animator.SetInteger("Emotion", (int)emotion);
      * Animator.SetTrigger("EmotionChanged");
      */
 }
Example #2
0
    public void Say(Sprite icon1, Sprite icon2, SpeechEmotion emotion = SpeechEmotion.Loopy)
    {
        Icon_Big.gameObject.SetActive(false);
        Icon_Left.gameObject.SetActive(true);
        Icon_Right.gameObject.SetActive(true);

        Icon_Left.SetIcon(icon1);
        Icon_Right.SetIcon(icon2);

        Icon_Left.SetEmotion(emotion);
        Icon_Right.SetEmotion(emotion);
    }
Example #3
0
    private void InitSpeech()
    {
        speechIcon1 = SpeechHelper.UnknownSprite;
        speechIcon2 = SpeechHelper.UnknownSprite;

        bool isCulprit    = ID == NPCTracker.Culprit;
        bool sameTraincar = NPCTracker.FindCulprit().GetTraincar() == GetTraincar();

        #region Special Case: Cat & Twins
        if (ID == NPCTracker.ID.Cat)
        {
            if (NPCTracker.IsTwin(NPCTracker.Culprit))
            {
                Accused            = NPCTracker.FindCulprit();
                speechIcon1        = SpeechHelper.GetIcon_Person(NPCTracker.ID.Cat);
                speech2IsDirection = true;
                speechEmotion      = SpeechEmotion.Scared;
                return;
            }
            else
            {
                Accused       = this;
                speechIcon1   = SpeechHelper.GetIcon_Person(NPCTracker.ID.Cat);
                speechIcon2   = SpeechHelper.MiscIcons.Meow;
                speechEmotion = SpeechEmotion.Loopy;
                return;
            }
        }

        if (NPCTracker.IsTwin(ID) && NPCTracker.IsTwin(NPCTracker.Culprit))
        {
            Accused = NPCTracker.FindNPC(
                ID == NPCTracker.ID.TwinRed
                                ? NPCTracker.ID.TwinBlue
                                : NPCTracker.ID.TwinRed
                );
            speechIcon1        = SpeechHelper.GetIcon_Person(Accused.ID);
            speech2IsDirection = true;
            speechEmotion      = SpeechEmotion.Emphatic;
            return;
        }
        #endregion

        //base certainty
        float certainty = sameTraincar ? 1.0f : 0.9f;

        //accuse somebody
        float rng_wrongAccusation =
            isCulprit ? 1.0f :
            sameTraincar ? 0.0f :
            Random.Range(0.0f, 1.0f)
        ;

        if (rng_wrongAccusation < 0.4f)
        {
            Accused = NPCTracker.FindCulprit();
        }
        else if (rng_wrongAccusation < 0.7f)
        {
            Accused    = NPCTracker.FindNPC(NPCTracker.GetRandomNPCID());
            certainty -= 0.5f;
        }
        else
        {
            Accused    = NPCTracker.FindNPC(NPCTracker.RedHerring);
            certainty -= 0.3f;
        }

        //should never happen; just for safety
        if (Accused == null)
        {
            Accused = NPCTracker.FindNPC(NPCTracker.RedHerring);
        }
        while (Accused == this)
        {
            Accused = NPCTracker.FindNPC(NPCTracker.GetRandomNPCID());
        }

        //first icon represents accusation
        float rng_vagueness =
            sameTraincar ? Random.Range(0.0f, 0.6f) :
            Random.Range(0.0f, 1.0f)
        ;
        if (rng_vagueness < 0.3f)
        {
            speechIcon1 = SpeechHelper.GetIcon_Person(Accused.ID);
            certainty  -= 0.2f;
        }
        else if (rng_vagueness < 0.7f)
        {
            var traits = SpeechHelper.GetTraitList(Accused.ID).Icons;
            speechIcon1 = traits[Random.Range(0, traits.Length)];
        }
        else
        {
            speechIcon1 = SpeechHelper.GetIcon_Car(Accused.GetTraincar());
        }

        //second icon and animation represent certainty
        float rng_certainty = Random.Range(0.0f, certainty);

        if (rng_certainty < 0.2f)
        {
            speechIcon2   = SpeechHelper.GetIcon_Certainty(false);
            speechEmotion = SpeechEmotion.Loopy;
        }
        else if (rng_certainty < 0.5f)
        {
            speech2IsDirection = true;
            speechEmotion      = SpeechEmotion.Loopy;
        }
        else if (rng_certainty < 0.7f)
        {
            speech2IsDirection = true;
            speechEmotion      = SpeechEmotion.Scared;
        }
        else
        {
            speechIcon2   = SpeechHelper.GetIcon_Certainty(true);
            speechEmotion = SpeechEmotion.Emphatic;
        }
    }