コード例 #1
0
 void LateUpdate()
 {
     if (flag)
     {
         if (Input.GetMouseButtonDown(1))
         {
             item_dis.instance.gameObject.SetActive(false);  
             EquipAndBag_Grid now = transform.parent.gameObject.GetComponent <EquipAndBag_Grid> ();
             if (now.id >= 1001 && now.id <= 1003)
             {
                 if (id == 0)
                 {
                     return;
                 }
                 objectInfo info = ObjectsInfo.instance.FindObjecInfoById(now.id);
                 int        hp   = info.hp;
                 int        mp   = info.mp;
                 ps.GetDrug(hp, mp);
                 transform.parent.GetComponent <EquipAndBag_Grid> ().MinsNumber();
             }
             else if (now.id >= 2001 && now.id <= 2023)
             {
                 bool success = Equip.instance.Dress(now.id);
                 if (success)
                 {
                     transform.parent.GetComponent <EquipAndBag_Grid> ().MinsNumber();
                 }
             }
         }
     }
 }
コード例 #2
0
    void Start()
    {
        nowParent = transform.parent;
        EquipAndBag_Grid now = nowParent.gameObject.GetComponent <EquipAndBag_Grid> ();

        this.id    = now.id;
        this.count = now.num;
        ps         = GameObject.FindGameObjectWithTag("Player").GetComponent <playerstatus> ();
    }
コード例 #3
0
    private void ChangeIdandCount(Transform nowparent, Transform nextparent)
    {
        EquipAndBag_Grid now  = nowParent.gameObject.GetComponent <EquipAndBag_Grid> ();
        EquipAndBag_Grid next = nextparent.gameObject.GetComponent <EquipAndBag_Grid> ();
        int id  = now.id;
        int num = now.num;

        now.setId(next.id, next.num);
        next.setId(id, num);
    }
コード例 #4
0
    public void ChangeCount(Transform nowparent, Transform nextparent)
    {
        EquipAndBag_Grid now  = nowParent.gameObject.GetComponent <EquipAndBag_Grid> ();
        EquipAndBag_Grid next = nextparent.gameObject.GetComponent <EquipAndBag_Grid> ();

        now.setCount();
        next.setCount();
        now.getItemCount().SetActive(false);
        next.getItemCount().SetActive(true);
    }
コード例 #5
0
    private void ChangeParentId(Transform nowparent, Transform nextparent)
    {
        EquipAndBag_Grid now  = nowParent.gameObject.GetComponent <EquipAndBag_Grid> ();
        EquipAndBag_Grid next = nextparent.gameObject.GetComponent <EquipAndBag_Grid> ();

        int temp = now.id;

        now.id  = next.id;
        next.id = temp;

        int count1 = now.num;

        now.num  = next.num;
        next.num = count1;
    }
コード例 #6
0
    public void getId(Item it)
    {
        EquipAndBag_Grid grid = null;

        foreach (EquipAndBag_Grid temp in gridList)
        {
            if (temp.id == it.id)
            {
                grid = temp;
                break;
            }
        }
        if (grid != null)
        {
            grid.PlusNum(it.count);
        }
        else
        {
            foreach (EquipAndBag_Grid temp in gridList)
            {
                if (temp.id == 0)
                {
                    grid = temp;
                    break;
                }
            }
            if (grid != null)
            {
                GameObject bag_item = Instantiate(bag_item_temp);
                bag_item.transform.SetParent(grid.transform);
                bag_item.transform.position = grid.transform.position;
                grid.setId(it.id, it.count);
            }
            else
            {
                isfalse = false;
            }
        }
    }