示例#1
0
 void OnTriggerExit2D(Collider2D _col)
 {
     if (enterShop != null && _col.CompareTag("Shop"))
     {
         enterShop = null;
     }
 }
示例#2
0
 void OnTriggerEnter2D(Collider2D _col)
 {
     if ((state == NpcState.Find || state == NpcState.Buy) && enterShop == null && _col.CompareTag("Shop"))
     {
         enterShop = _col.GetComponent <ShopBehaviour>();
     }
 }
示例#3
0
    public void View(ShopBehaviour _shop, bool _isView, bool _isExit, bool _isEdit)
    {
        isEdit = _isEdit;

        SetShop(_shop);
        base.View(_isView, _isExit);
        isSaleAction = true;
        UpdateSlotList();
    }
示例#4
0
 public void View(ShopBehaviour _shop)
 {
     UIInGame.instance.shopMenu.HideAnimate(null);
     gameObject.SetActive(true);
     shop = _shop;
     targetTracker.SetTarget(_shop.transform, Camera.main.WorldToScreenPoint(_shop.transform.position), Vector3.zero);
     colorPicker.Color = _shop.info.tentColor;
     colorPicker.SetOnValueChangeCallback(OnChangeColor);
     signListView.ViewList(true, false, UpdateSign);
 }
示例#5
0
    public void SetShop(ShopBehaviour _shop)
    {
        shop = _shop;

        SetAllSlot(false);

        itemList = shop.info.itemList;

        gridSize = shop.info.salePannelSize;
    }
示例#6
0
    // Start is called before the first frame update
    void Start()
    {
        if (!!shopParentUIGO)
        {
            shop = shopParentUIGO.GetComponentInChildren <ShopBehaviour>();
        }
        if (!!shop)
        {
            shop.gameObject.SetActive(false);
        }

        playerInShop = false;
    }
示例#7
0
    public static void SaveLifeShop(ShopBehaviour shop)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/lifeShop.save";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        //Debug.Log(Application.persistentDataPath);

        ShopData data = new ShopData(shop);

        formatter.Serialize(stream, data);
        stream.Close();
    }
示例#8
0
    public void CheckSaleGold(ShopBehaviour _shop, int _gold)
    {
        if (_gold < lowGold)
        {
            lowShop = _shop;
            lowGold = _gold;
        }

        if (_gold > highGold)
        {
            highShop = _shop;
            highGold = _gold;
        }
    }
示例#9
0
 public void UpdateSaleGold(ShopBehaviour _enterShop, List <Item> _itemList)
 {
     _itemList.Sort(delegate(Item a, Item b)
     {
         if (a.saleGold > b.saleGold)
         {
             return(1);
         }
         else if (a.saleGold < b.saleGold)
         {
             return(-1);
         }
         return(0);
     });
     for (int i = 0; i < _itemList.Count; ++i)
     {
         CheckSaleGold(_enterShop, _itemList[i].saleGold);
     }
 }
示例#10
0
    /// <summary>
    /// NPC의 행동을 제어합니다.
    /// </summary>
    /// <param name="_state">행동 값</param>
    public void ChangeState(NpcState _state)
    {
        agent.ClearDestinationEvent();

        state = _state;

        switch (state)
        {
        case NpcState.Move:
            if (moveCoroutine != null)
            {
                StopCoroutine(moveCoroutine);
            }
            moveCoroutine = StartCoroutine(Move());
            break;

        case NpcState.Talk:

            break;

        case NpcState.Find:
            if (moveCoroutine != null)
            {
                StopCoroutine(moveCoroutine);
            }
            targetShop    = ShopManager.instance.GetRandomShop();
            moveCoroutine = StartCoroutine(MoveTargetAndAction(targetShop.salePannelBottom.position, Find));
            break;

        case NpcState.Buy:
            Buy();
            break;

        default: break;
        }
    }
示例#11
0
 public void View(ShopBehaviour _shop, bool _isView)
 {
     View(_isView);
     shop = _shop;
 }
示例#12
0
 public void ViewShopDesign(ShopBehaviour _shop)
 {
     shopDesign.View(_shop);
 }
示例#13
0
 public void ViewShopMenu(ShopBehaviour _shop, bool _isView)
 {
     shopMenu.View(_shop, _isView);
 }
示例#14
0
 public void ViewSalePannel(ShopBehaviour _shop, bool _isView, bool _isExit, bool _isEdit)
 {
     salePannel.View(_shop, _isView, _isExit, _isEdit);
 }
示例#15
0
 public ShopData(ShopBehaviour shop)
 {
     price          = shop.price;
     upIncrement    = shop.upIncrement;
     priceIncrement = shop.priceIncrement;
 }