Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit2D hit = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0);
            if (hit)
            {
                if (hit.collider.tag == "NPC")
                {
                    Debug.Log(hit.collider.name + " has been clicked by mouse");
                    this.gameObject.transform.GetChild(0).gameObject.SetActive(true);

                    isTalking       = true;
                    dialogueManager = hit.collider.gameObject.GetComponent <NPCDialogueManager>();
                    InspectNPC(hit, dialogueManager.Aine_Introduction_AtPortal());
                }
            }
            else if (isTalking)
            {
                //Do nothing; clicking does something later on in the code.
            }
            else
            {
                this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
            }
        }
    }
Beispiel #2
0
    void CreatureConfirmationDialogue(CreatureStatsManager creatureStats)
    {
        GameObject[]   npcs = GameObject.FindGameObjectsWithTag("NPC");
        RaycastHit2D[] hits = Physics2D.RaycastAll(new Vector2(npcs[0].transform.position.x, npcs[0].transform.position.y), Vector2.zero, 0);

        foreach (GameObject npc in npcs)
        {
            if (npc.name == "Aine")
            {
                hits = Physics2D.RaycastAll(new Vector2(npc.transform.position.x, npc.transform.position.y), Vector2.zero, 0);
            }
        }

        foreach (var hit in hits)
        {
            Debug.Log(hit.collider.name + " hit");
            if (hit.collider.name == "Aine")
            {
                NPCDialogueManager dialogueManager = hit.collider.gameObject.GetComponent <NPCDialogueManager>();
                List <string>      dialogue        = dialogueManager.Aine_CreatureConfirmation_Default();
                List <string>      dialogueYes     = dialogueManager.Aine_CreatureConfirmation_Default_Yes();
                List <string>      dialogueNo      = dialogueManager.Aine_CreatureConfirmation_Default_No();

                dialogueBox.isTalking       = true;
                dialogueBox.dialogueManager = dialogueManager;
                dialogueBox.gameObject.transform.GetChild(0).gameObject.SetActive(true);
                dialogueBox.InspectNPC(hit, dialogue, dialogueYes, dialogueNo);
            }
        }
    }
 protected override void Initialise()
 {
     base.Initialise();
     _playerInputController = GameObject.FindObjectOfType <PlayerInputController>();
     currentPlayerString    = dialogueContainer.PlayerTextSequence[currentPlayerArrayIndex];
     _nPCDialogueManager    = GetComponent <NPCDialogueManager>();
     _sendButton            = GameObject.FindGameObjectWithTag("Send");
     _sendButton.GetComponent <Button>().interactable = false;
     playerMessageList = new List <GameObject>();
     _playerInputController.SetCurrentMessage(currentPlayerString);
 }
    // Start is called before the first frame update
    void Start()
    {
        myRigidbody = GetComponent <Rigidbody2D>();
        theDM       = FindObjectOfType <NPCDialogueManager>();
        waitCounter = waitTime;
        walkCounter = walkTime;

        ChooseDirection();
        if (walkZone != null)
        {
            minWalkPoint = walkZone.bounds.min;
            maxWalkPoint = walkZone.bounds.max;
            hasWalkZone  = true;
        }
        canMove = true;
    }
Beispiel #5
0
 // Start is called before the first frame update
 void Start()
 {
     dMan = FindObjectOfType <NPCDialogueManager>();
 }