Beispiel #1
0
    void Awake()
    {
        player             = GameObject.Find("FPSController");
        transform.rotation = Quaternion.LookRotation(player.transform.position - transform.position);
        b = GetComponent <AIDesigner.Brain>();
        b.SetConditionGroupMoveToObject("Chase enemies", player);

        StartCoroutine(FixRotation());
        StartCoroutine(StopCheckRot());
    }
Beispiel #2
0
        public void StartConversation()
        {
            if (!isInConversation)
            {
                dialogueController = targetNPC.gameObject.GetComponent <AIDesigner.DialogueController>();



                if (dialogueController != null)
                {
                    // this object we hit has a dialogue controller, let's first check if
                    // there is any available dialogue (maybe all speeches have been played)

                    // we can use GetFirstSpeech(playerObject) to test
                    // if a first initiation dialogue is available.
                    // It will return an int,  -1 if NOT AVAILABLE
                    // and 0 or greater if AVAILABLE. 0 OR GREATER is also the
                    // index of the first selected speech to play
                    if (dialogueController.GetFirstSpeech(gameObject) != -1)
                    {
                        // first, reset the paramters incase we had a previous convo:
                        firstTime             = true;
                        triggerSpeechUniqueID = 0;

                        // freeze the ai:
                        npcBrain = targetNPC.gameObject.GetComponent <AIDesigner.Brain>();
                        //npcBrain.Freeze();	// handy freeze function that freezes all AI functionality
                        npcBrain.FreezeAIOnly();                        // handy freeze function that freezes all AI functionality
                        // this is the same as Freeze() except it does not freeze
                        // the animator, so you can still play any animations

                        // show dialogue window:
                        dialogueWindow.SetActive(true);

                        // start talking:
                        DoSpeech();

                        isInConversation = true;                        // important, or this event will keep firing
                    }
                }
            }
        }