コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        Ray        ray;
        RaycastHit hit;

        for (int i = 0; i < Input.touchCount; ++i)
        {
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);


                if (Physics.Raycast(ray, out hit))
                {
                    //on RaycastHit handle output
                    if (hit.transform.gameObject.tag == "ClickableObject")
                    {
                        ObjectData = hit.transform.gameObject.GetComponent <NPC_Controller>();
                        SetElements(ObjectData);
                        print(ObjectData.name);
                    }
                }
            }
        }
    }
コード例 #2
0
 private void SetElements(NPC_Controller hitData)
 {
     UI_Name.text       = hitData.ObjectName;
     UI_FlavorText.text = hitData.ObjectFlavortext;
     UI_Image_L.sprite  = hitData.ObjectImageLeft;
     UI_Image_R.sprite  = hitData.ObjectImageRight;
     ShowUI(true);
 }
コード例 #3
0
    public void OpenPanel(NPCData data, NPC_Controller controller)
    {
        currentNPC_Controller = controller;
        currentNPC            = data;
        gameObject.SetActive(true);

        NpcPortraitCam.LookTarget(currentNPC_Controller.PortraitCenter);
        RefreshPanel();
    }
コード例 #4
0
    //Elindítja a megadott karakter dialógusát
    public void StartDialogue(NPC_Controller character)
    {
        prev = gameState.GetGameState();
        gameState.ChangeGameState(GameState.Dialogue);

        speaker = character;
        dialogues.Clear();
        foreach (string sentence in speaker.dialogues.GetActiveDialogues())
        {
            dialogues.Enqueue(sentence);
        }
        DisplayNextSentence();
    }
コード例 #5
0
    private void DropdownValueChanged(Dropdown dropdown)
    {
        foreach (GameObject n in npc)
        {
            NPC_Controller controller = n.GetComponent <NPC_Controller>();

            if (dropdown.value != 0)
            {
                controller.normalSituation = false;
            }
            else
            {
                controller.normalSituation = true;
            }
        }
    }
コード例 #6
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "NPC")
        {
            npc = collision.gameObject.GetComponent <NPC_Controller>();

            if (Input.GetKey(KeyCode.E))
            {
                collision.gameObject.GetComponent <NPC_Controller>().ActivateDialogue();
            }
        }

        if (collision.gameObject.tag == "Next")
        {
            fadetrigger.FadeIn();
        }
    }
コード例 #7
0
ファイル: Movement.cs プロジェクト: BeytullahKalay/MobileGame
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "NPC")
     {
         npc = collision.gameObject.GetComponent <NPC_Controller>();
         if (Input.GetMouseButtonDown(0) && canTalkWithNPC)
         {
             npc.ActivateDialogue();
             canTalkWithNPC = false;
         }
     }
     else if (collision.gameObject.tag == "FinalNPC")
     {
         _finalNPC = collision.gameObject.GetComponent <Final_NPC_Controller>();
         if (Input.GetMouseButtonDown(0) && canTalkWithNPC)
         {
             _finalNPC.ActivateDialogue();
             canTalkWithNPC = false;
         }
     }
 }
コード例 #8
0
    void CreateNPC(NPC npc)
    {
        if (npc.type == "Worker")
        {
            NPC_Controller npcCont = myPrefab[0].GetComponent <NPC_Controller>();

            npcCont.target = new Transform[npc.Schedule.Length];

            for (int i = 0; i < npc.Schedule.Length; i++)
            {
                npcCont.target[i] = GameObject.Find(npc.Schedule[i]).transform;
            }

            npcCont.worker_id = npc.id;

            npcCont.gameObject.name = "Worker: " + npc.id;

            Instantiate(myPrefab[0], new Vector3(0, 0, 0), Quaternion.identity);
        }
        else
        {
            NPC_Controller npcCont = myPrefab[1].GetComponent <NPC_Controller>();

            npcCont.isBoss = true;

            npcCont.target = new Transform[npc.Schedule.Length];

            for (int i = 0; i < npc.Schedule.Length; i++)
            {
                npcCont.target[i] = GameObject.Find(npc.Schedule[i]).transform;
            }

            npcCont.worker_id = npc.id;

            Instantiate(myPrefab[1], new Vector3(0, 0, 0), Quaternion.identity);
        }
    }
コード例 #9
0
 public void AddNPC(NPC_Controller npc)
 {
     interactableObject    = null;
     interactableCharacter = npc;
 }
コード例 #10
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     npc = null;
 }
コード例 #11
0
 public void Open_NPCDialogPanel(NPCData talkingNPC, NPC_Controller controller)
 {
     dialog_Panel.OpenPanel(talkingNPC, controller);
     StartCoroutine(IE_WaitPanelClose(dialog_Panel.gameObject));
 }
コード例 #12
0
 private void Start()
 {
     npc = GetComponent <NPC_Controller>();
 }
コード例 #13
0
 // walk in octagonal pattern
 void Start()
 {
     npc = this.GetComponentInParent <NPC_Controller>();
     messageController = GameObject.Find("Message Overlay").GetComponent <MessageOverlayController>();
     ExecuteTestWalk();
 }
コード例 #14
0
 //    public abstract NPC_BehaviorState NextState();
 protected virtual void Start()
 {
     npcController = GetComponent<NPC_Controller>();
     npcAI = GetComponent<NPC_AI>();
     npcStats = GetComponent<NPCStats>();
 }
コード例 #15
0
 public void RemoveNPC()
 {
     interactableCharacter = null;
 }
コード例 #16
0
 public void AddObject(InteractableObject objectInRange)
 {
     interactableCharacter = null;
     interactableObject    = objectInRange;
 }
コード例 #17
0
ファイル: Movement.cs プロジェクト: BeytullahKalay/MobileGame
 private void OnTriggerExit2D(Collider2D collision)
 {
     npc            = null;
     _finalNPC      = null;
     canTalkWithNPC = true;
 }
コード例 #18
0
 //Visszatérés a játékba és a box eltüntetése
 public void EndDialogue()
 {
     speaker = null;
     gameState.ChangeGameState(prev);
     BoxDisplay(false);
 }