Наследование: MonoBehaviour
Пример #1
0
 private void Start()
 {
     move = GetComponent <NPCMove>();
     aim  = GetComponent <NPCAim>();
     talk = GetComponent <NPCTalk>();
     anim = GetComponentInChildren <Animator>();
 }
Пример #2
0
 public void Init()
 {
     m_currentTalkingNPC = (transform.parent.parent.GetComponent(typeof(TalkingNPC)) as TalkingNPC).CurrentTalkingNPC;
     m_cameraStateMachine.SetState(m_talkingCameraState);
     (m_talkingCameraState.gameObject.GetComponent(typeof(TalkingCamera)) as TalkingCamera).LookAtTarget(m_currentTalkingNPC.transform);
     NPCTalk.DialogueEnding += DialogueEnd;
 }
Пример #3
0
 private void FindClosestConversationalist()
 {
     myDist = Vector3.Distance(transform.position, conversationTarget.position);
     if (closestConversationalist == null || myDist < closestConversationalist.myDist)
     {
         closestConversationalist = this;
     }
 }
Пример #4
0
 private void Awake()
 {
     uiTalk    = this.GetComponent <Canvas>();
     npcTalk   = transform.Find("TalkBG/TalkContentTxt").GetComponent <Text>();
     acceptBtn = transform.Find("AcceptBtn").GetComponent <Button>();
     acceptBtn.onClick.AddListener(OnAccept);
     _instance = this;
     uiTalk.gameObject.SetActive(false);
 }
Пример #5
0
    private void Start()
    {
        targeting = GetComponent <ObjectTargeting>();
        aim       = GetComponent <NPCAim>();
        shoot     = GetComponent <NPCShoot>();
        move      = GetComponent <NPCMove>();
        hp        = GetComponent <Health>();
        talk      = GetComponent <NPCTalk>();

        hp.SetHealth(hp.GetMaxHealth());
        StartAI();
    }
Пример #6
0
    public void Converse()
    {
        // Remove this method as a listener
        if (this == null)
        {
            InteractAbility.interact.onInteractPressed -= Converse;
            return;
        }
        // If the NPC can't talk or conversation target is too far, then don't start conversation
        if (!canConverse || Vector3.Distance(transform.position, conversationTarget.position) > maxConversationDistance)
        {
            return;
        }

        // Another NPC is conversing, wait your turn!
        if (currConversationalist != null && currConversationalist != this && currConversationalist.inConversation)
        {
            if (debug)
            {
                Debug.Log(currConversationalist.gameObject.name + " is conversing. So " + gameObject.name + " can't converse.");
            }
            return;
        }

        // No one is conversing, but these is a closer conversationalist
        if ((currConversationalist == null || !currConversationalist.inConversation) && closestConversationalist != this)
        {
            if (debug)
            {
                Debug.Log(gameObject.name + " is not the closest conversationalist.");
            }
            return;
        }

        currConversationalist = this;

        // If this function is called while printing, then just display the text
        // For the impatient people
        if (isPrinting)
        {
            if (debug)
            {
                Debug.Log("Just saying it.");
            }
            justSayIt = true;
            return;
        }

        // Cycle conversation lines
        if (currConvLine < conversationLines[currentConversation].Length && !isPrinting)
        {
            if (debug)
            {
                Debug.Log(gameObject.name + " Converses: " + conversationLines[currentConversation][currConvLine]);
            }
            inConversation = true;
            //speechText.text = conversationLines[currentConversation][currConvLine];
            StartCoroutine(PrintSpeech(conversationLines[currentConversation][currConvLine]));
            currConvLine++;
        }
        // End conversation
        else if (currConvLine >= conversationLines[currentConversation].Length && !isPrinting)
        {
            if (debug)
            {
                Debug.Log("Ending Conversation");
            }
            //inConversation = false;
            currConvLine    = 0;
            speechText.text = "";
            StartCoroutine(BufferConversationEnd());

            // Determine which conversation to use next
            if (chooseRandomConversation) // Random conversation
            {
                currentConversation = Random.Range(0, conversations.Length);
            }
            else   // Cycle conversations
            {
                currentConversation++;
                currentConversation %= conversations.Length;
            }
        }
    }
Пример #7
0
 private void Awake()
 {
     m_npcTalk = GetComponent(typeof(NPCTalk)) as NPCTalk;
 }
Пример #8
0
 // Start is called before the first frame update
 void Awake()
 {
     roomNavigation    = GetComponent <RoomNavigation>();
     textInput         = GetComponent <TextInput>();
     interactableItems = GetComponent <InteractableItems>();
     registerObjects   = GetComponent <RegisterObjects>();
     registerRooms     = GetComponent <RegisterRooms>();
     map                  = GetComponent <MiniMap>();
     debugClass           = GetComponent <DebugMode>();
     additionalNarrations = GetComponent <AdditionalNarrations>();
     npcTalk              = GetComponent <NPCTalk>();
     npcInteraction       = GetComponent <NPCInteraction>();
     demoScript           = GetComponent <DemoScript>();
     achievements         = GetComponent <Achievements>();
     combat               = GetComponent <Combat>();
     teleType             = GetComponent <TeleType>();
     introScreen          = GetComponent <IntroScreen>();
     GameObject.Find("MainScrollRect").GetComponent <ScrollRect>().verticalNormalizedPosition = 0.5f;
     //enterToContinue = false;
     //escToContinue = false;
     //toResumeEscToContinue = false;
     //exitPopUp = false;
     debugMode              = false;
     secondQuestActive      = false;
     currentActiveInput     = "main";
     ego.equippedWeapon     = null;
     ego.equippedArmor      = null;
     ego.equippedShield     = null;
     ego.chosenAction       = "";
     ego.allStats[0].value  = 100;
     ego.allStats[1].value  = 100;
     ego.allStats[2].value  = 100;
     ego.allStats[3].value  = 0;
     ego.allStats[4].value  = 1;
     ego.allStats[5].value  = 0;
     ego.allStats[6].value  = 4;
     ego.allStats[7].value  = 0;
     ego.allStats[8].value  = 1.5f;
     ego.allStats[9].value  = 0;
     ego.allStats[10].value = 0;
     for (int i = 0; i < ego.allStats.Length; i++)
     {
         ego.allStats[i].effectValue = 0;
     }
     ego.activeEffects.Clear();
     ego.defeatedBadGuys.Clear();
     ego.blueCrystals   = 0;
     ego.bankedCrystals = 0;
     ego.fightClubRank  = 0;
     ego.fleeLocation   = "";
     ego.conversation   = 0;
     ego.currentInit    = 0;
     ego.displayAction  = "";
     ego.chosenAction   = "";
     ego.chosenItem     = null;
     ego.chosenItem2    = null;
     ego.chosenTarget   = null;
     ego.potionBelt.Clear();
     //enterToContinueDialogue = false;
     //timeDelay = 1;
     sentences = new Queue <string>();
     pauses    = new Queue <int>();
     //ego = Instantiate(ego);
 }