Example #1
0
 void OnPickWeapon()
 {
     if (canPick && Player.weapon.id == 0)
     {
         if (useControll)
         {
             if (Input.GetButtonDown(whichPlayer + "ButtonX"))
             {
                 if (!ButtonXFixed)
                 {
                     return;
                 }
                 ButtonXFixed  = false;
                 pickWeapon    = lastPick;
                 Player.weapon = CItemDataBase.items[pickWeapon.id];
                 pickWeapon.transform.parent = this.transform;
                 pickWeapon.gameObject.SetActive(false);
                 ishold  = true;
                 canPick = false;
                 playerWeaponImg.sprite = weaponSprite[Player.weapon.id];
                 if (test)
                 {
                     tutorialRequest.DonePickUp(false);
                 }
             }
         }
         else
         {
             if (Input.GetKeyDown(KeyCode.E))
             {
                 pickWeapon    = lastPick;
                 Player.weapon = CItemDataBase.items[pickWeapon.id];
                 pickWeapon.transform.parent = this.transform;
                 pickWeapon.gameObject.SetActive(false);
                 ishold  = true;
                 canPick = false;
                 playerWeaponImg.sprite = weaponSprite[Player.weapon.id];
                 if (test)
                 {
                     tutorialRequest.DonePickUp(false);
                 }
             }
         }
     }
 }
Example #2
0
    void PickItem()
    {
        if (!can_pick || picking_item == null)
        {
            return;
        }
        if (useController)
        {
            if (Input.GetButtonDown(whichPlayer + "LB"))
            {
                if (!LBFixed)
                {
                    return;
                }
                LBFixed = false;
                if (CItemDataBase.items[picking_item.id].elementID < -20)
                {
                    TeamHp.ChangeHp(true, 0.15f);
                    healEffect.SetHealEffectAni();
                    picking_item.GetComponent <COutLine>().SetOutLine(false);
                    picking_item.SetInFree();
                    ChangeSlot(true, -1);
                    if (test)
                    {
                        tutorialRequest.DonePickUp(true);
                    }
                }
                else
                {
                    handle.enabled = true;
                    if (!b_handling)
                    {
                        b_handling    = true;
                        craftA        = items[picking_item.id];
                        handling_item = picking_item.gameObject;
                        handling_item.transform.parent   = transform.GetChild(0);
                        handling_item.transform.position = this.transform.position;
                        handling_item.GetComponent <COutLine>().SetOutLine(false);
                        handling_item.SetActive(false);
                        handle.sprite = CItemDataBase.spriteList[craftA.id];
                        handling_item.GetComponent <CPickItem>().SetLifeTime(0.0f);
                        ChangeSlot(true, 0);
                        ArrowEnable(true);
                        if (test)
                        {
                            tutorialRequest.DonePickUp(true);
                        }
                    }
                    else
                    {
                        OnCrafting();
                    }
                }
                can_pick     = false;
                picking_item = null;

                //if (picking_item == null) return;
                //crafterAnimator.SetBool("is_gather", true);
                ////Debug.Log("設動畫");
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                //if (picking_item == null) return;
                //crafterAnimator.SetBool("is_gather", true);

                if (CItemDataBase.items[picking_item.id].elementID < -20)
                {
                    TeamHp.ChangeHp(true, 0.15f);
                    healEffect.SetHealEffectAni();
                    picking_item.GetComponent <COutLine>().SetOutLine(false);
                    picking_item.SetInFree();
                    ChangeSlot(true, -1);
                    if (test)
                    {
                        tutorialRequest.DonePickUp(true);
                    }
                }
                else
                {
                    handle.enabled = true;
                    if (!b_handling)
                    {
                        b_handling    = true;
                        craftA        = items[picking_item.id];
                        handling_item = picking_item.gameObject;
                        handling_item.transform.parent   = transform.GetChild(0);
                        handling_item.transform.position = this.transform.position;
                        handling_item.GetComponent <COutLine>().SetOutLine(false);
                        handling_item.SetActive(false);
                        handle.sprite = CItemDataBase.spriteList[craftA.id];
                        handling_item.GetComponent <CPickItem>().SetLifeTime(0.0f);
                        ChangeSlot(true, 0);
                        ArrowEnable(true);
                        if (test)
                        {
                            tutorialRequest.DonePickUp(true);
                        }
                    }
                    else
                    {
                        OnCrafting();
                    }
                }
                can_pick     = false;
                picking_item = null;
            }
        }
    }