Beispiel #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        GameObject  icon = other.gameObject;
        IconManager im   = icon.GetComponent <IconManager>();

        if (im != null)
        {
            for (int i = 0; i < tagName.Length; i++)
            {
                if (other.tag != tagName[i])
                {
                    continue;
                }
                im.selectNo = selectNum;
                im.putOn    = true;
                break;
            }
        }
        else
        {
            NPCIcon npcIcon = other.gameObject.GetComponent <NPCIcon>();
            if (npcIcon == null)
            {
                return;
            }
            npcIcon.selectNo = selectNum;
            npcIcon.putOn    = true;
        }
    }
Beispiel #2
0
    void OnTriggerExit2D(Collider2D other)
    {
        GameObject  obj = other.gameObject;
        IconManager im  = obj.GetComponent <IconManager>();

        if (im != null)
        {
            for (int i = 0; i < tagName.Length; i++)
            {
                if (other.tag != tagName[i])
                {
                    continue;
                }
                im.putOn = false;
                break;
            }
        }
        else
        {
            NPCIcon npcIcon = other.gameObject.GetComponent <NPCIcon>();
            if (npcIcon == null)
            {
                return;
            }
            npcIcon.putOn = false;
        }
    }
Beispiel #3
0
    void Open()
    {
        timer += 0.1f;
        float t = timer;

        t                     = Mathf.Pow(t, 3);
        transSize.x           = t;
        transSize.y           = t;
        childTrans.localScale = transSize;
        if (timer < 1.0f)
        {
            return;
        }
        timer = 1.0f;
        childTrans.localScale = Vector3.one;
        trans.sizeDelta       = Vector2.zero;
        state = STATUS.NORMAL;

        GameObject obj = Instantiate(prefabObj);

        obj.transform.parent   = NPCwm.ManagerObj.transform;
        obj.transform.position = NPCwm.ManagerObj.transform.position;
        NPCIcon npcIcon = obj.GetComponent <NPCIcon>();

        npcIcon.No       = No;
        npcIcon.windowNo = transform.GetChild(0).gameObject.GetComponent <NPCWindow>();
    }