Exemplo n.º 1
0
 private void Start()
 {
     anim = GetComponent <Animator>();
     sign = this.transform.parent.GetComponent <signControl>();
     EventTrigger.Entry entry = new EventTrigger.Entry();
     entry.eventID = EventTriggerType.PointerDown;
     entry.callback.AddListener((eventData) => {
         sign.ShowInformation();
     });
     btnSign.GetComponent <EventTrigger>().triggers.Add(entry);
 }
    private void Start()
    {
        anim = GetComponent <Animator>();
        if (!signInformation)
        {
            npcStatus = this.transform.parent.GetComponent <NPCStatus>();
            npcShop   = this.transform.parent.GetComponent <NPCShop>();

            if (npcStatus)
            {
                // add on click to place
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => {
                    Debug.Log("Start Talk");
                    npcStatus.StartTalk();
                });
                btnTalk.GetComponent <EventTrigger>().triggers.Add(entry);
            }

            if (npcShop)
            {
                // add on click to place
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => {
                    Debug.Log("Start Shop");
                    npcShop.StartShop();
                });
                btnShop.GetComponent <EventTrigger>().triggers.Add(entry);
            }
        }
        else
        {
            sign = this.transform.parent.GetComponent <signControl>();
            EventTrigger.Entry entry = new EventTrigger.Entry();
            entry.eventID = EventTriggerType.PointerDown;
            entry.callback.AddListener((eventData) => {
                sign.ShowInformation();
            });
            btnShop.GetComponent <EventTrigger>().triggers.Add(entry);
        }
    }