Пример #1
0
    void Update()
    {
        float distance = Vector2.Distance(transform.position, target.transform.position);

        if (distance <= distanceToOpenShop)
        {
            if (!uiShop.isActiveAndEnabled)
            {
                uiShop.gameObject.SetActive(true);
            }
            if (!uiShop.IsOpen)
            {
                uiShop.Open();
            }
        }
        else if (distance >= distanceToOpenShop)
        {
            if (uiShop.IsOpen)
            {
                uiShop.Close();
            }
        }
    }
Пример #2
0
    private IEnumerator OnShop()
    {
        if (Room.Type.Shop == dungeon.data.current_room.type)
        {
            dungeon.data.current_room.npc_sprite_path = "Npc/npc_graverobber";
            dungeon.current_room.Init(dungeon.data.current_room);
            bool yes = false;
            GameManager.Instance.ui_textbox.on_submit += () => {
                yes = true;
                GameManager.Instance.ui_textbox.Close();
            };
            yield return(GameManager.Instance.ui_npc.Write("Npc/npc_graverobber_portrait", new string[] { "[전설의 상인]\n오! 이곳에서 사람은 오랜만이구만! 물건좀 보겠소?" }));

            if (true == yes)
            {
                yield return(shop.Open());
            }
            yield return(GameManager.Instance.ui_npc.Write("Npc/npc_graverobber_portrait", new string[] { "[전설의 상인]\n그럼 좋은 여행하게나..킬킬킬!" }));

            dungeon.data.current_room.npc_sprite_path = "";
            dungeon.data.current_room.type            = Room.Type.Normal;
            dungeon.current_room.npc.gameObject.SetActive(false);
        }
    }