Exemplo n.º 1
0
 public void ArgumentFeature(StallObject stallObjectArgumented, CharacterHandler targetCharacter, Object.Feature argumentedFeature)
 {
     currentCharacterTalkingTo             = targetCharacter;
     currentCharacterTalkingTo.isListening = true;
     argumentedStallObject = stallObjectArgumented;
     featureArgumented     = argumentedFeature;
     currentCharacterTalkingTo.Interrupt();
     isWaitingForResponse = true;
     Speak(argumentedFeature.argumentSpokenText, argumentedFeature.argumentSpeakTime);
 }
Exemplo n.º 2
0
        public KnownFeature GetKnownFeatureFromFeature(Object.Feature searchedFeature)
        {
            KnownFeature potentialknownFeature = null;

            for (int i = 0; i < knownFeatures.Count; i++)
            {
                if (searchedFeature == knownFeatures[i].feature)
                {
                    potentialknownFeature = knownFeatures[i];
                }
            }
            return(potentialknownFeature);
        }
Exemplo n.º 3
0
    public void UpdateCurrentAction()
    {
        if (isTalking)
        {
            if (isWaitingForResponse)
            {
                currentCharacterTalkingTo.RefreshEnthousiasm();
            }

            currentSpokenText.text = currentSpeech.GetCurrentSpeechProgression(Time.deltaTime);

            if (currentSpeech.isFinished)
            {
                isTalking = false;
                StartCoroutine(speakBoxAnim.anim.Play(speakBoxAnim));
                if (isWaitingForResponse)
                {
                    isWaitingForResponse = false;
                    if (presentedStallObject != null)
                    {
                        currentCharacterTalkingTo.PresentObject(presentedStallObject);
                        currentCharacterTalkingTo.isListening = false;
                        presentedStallObject = null;
                    }
                    else if (argumentedStallObject != null)
                    {
                        currentCharacterTalkingTo.ArgumentFeature(featureArgumented, argumentedStallObject);
                        currentCharacterTalkingTo.isListening = false;
                        currentCharacterTalkingTo             = null;
                        argumentedStallObject = null;
                        featureArgumented     = null;
                    }
                    else if (askedCharaObject != null)
                    {
                        currentCharacterTalkingTo.AskAbout(askedCharaObject);
                        currentCharacterTalkingTo.isListening = false;
                        askedCharaObject = null;
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
 public void ArgumentFeature(Object.Feature featureArgumented, StallObject argumentedObject)
 {
     argumentedObjectToThink  = GetPotentialFromStallObject(argumentedObject);
     argumentedFeatureToThink = featureArgumented;
     Think(reactTimeArgument, argumentedObjectToThink);
 }
Exemplo n.º 5
0
    public void ReactToArgumentFeature(Object.Feature featureArgumented, StallObject argumentedObject)
    {
        PotentialObject argumentedPotentialObject = GetPotentialFromStallObject(argumentedObject);

        PotentialObject.KnownFeature knownFeatureArgumented = argumentedPotentialObject.GetKnownFeatureFromFeature(featureArgumented);

        if (featureArgumented.isCategoryFeature)
        {
            bool categoryIsInitialInterest = false;
            for (int i = 0; i < character.initialInterests.Count; i++)
            {
                if (character.initialInterests[i] == featureArgumented.categoryProperties.category)
                {
                    categoryIsInitialInterest = true;
                }
            }

            if (categoryIsInitialInterest)
            {
                knownFeatureArgumented.LearnFeature(featureArgumented.rememberTime, interestLevelMultiplierWithCorrectCategoryArgument * featureArgumented.categoryProperties.argumentInterestLevelIncrease);
                Instantiate(happyFxPrefab, rectTransform.position + new Vector3(0, gazeHeadOffset, 0), happyFxPrefab.transform.rotation, characterCanvasRectTransform);
                Speak(featureArgumented.categoryProperties.argumentSpeechGoodReaction, 5);
            }
            else
            {
                currentEnthousiasm -= enthousiasmDecreaseWithIncorrectArgument;
                Instantiate(annoyedFxPrefab, rectTransform.position + new Vector3(0, gazeHeadOffset, 0), annoyedFxPrefab.transform.rotation, characterCanvasRectTransform);
                Speak(featureArgumented.categoryProperties.argumentSpeechBadReaction, 5);
                ForgetAllKnownFeatures();
            }
        }
        else
        {
            Character.Need correspondingNeed = null;
            for (int i = 0; i < character.needs.Count; i++)
            {
                for (int y = 0; y < featureArgumented.traits.Count; y++)
                {
                    if (character.needs[i].trait == featureArgumented.traits[y])
                    {
                        correspondingNeed = character.needs[i];
                    }
                }
            }

            if (correspondingNeed != null)
            {
                knownFeatureArgumented.LearnFeature(featureArgumented.rememberTime, interestLevelMultiplierWithCorrectFeatureArgument * featureArgumented.interestLevelIncrease);
                Instantiate(happyFxPrefab, rectTransform.position + new Vector3(0, gazeHeadOffset, 0), happyFxPrefab.transform.rotation, characterCanvasRectTransform);
                Speak(correspondingNeed.reactionSpokenWhenArgumented);
            }
            else
            {
                Instantiate(annoyedFxPrefab, rectTransform.position + new Vector3(0, gazeHeadOffset, 0), happyFxPrefab.transform.rotation, characterCanvasRectTransform);
                currentEnthousiasm -= enthousiasmDecreaseWithIncorrectArgument;
                Speak(character.defaultSpeachWhenWrongArgument);
                ForgetAllKnownFeatures();
            }
        }

        currentEnthousiasm = Mathf.Clamp(currentEnthousiasm, 0f, 1f);
    }