示例#1
0
 public void GetHurt()
 {
     if (test)
     {
         return;
     }
     if (PlayerScript.p2_die || !craftSystem.GetFunc())
     {
         return;
     }
     K_JoyX = 0;
     K_JoyY = 0;
     animator.SetTrigger("is_hurt");
     if (Player.p2charaType)
     {
         Player.p2moveAble = false;
     }
     else
     {
         Player.p1moveAble = false;
     }
     TeamHp.ChangeHp(false, 0.05f);
     GameObject.Find("MonsterAudio").GetComponent <MonsterVoice>().SetAudio(2, 1f);
     GameObject.Find("CharacterAudio").GetComponent <CharacterVoice>().SetAudio(1);
     craftSystem.SetFuncBusy(true);
 }
示例#2
0
    public void GetHurt()
    {
        if (test || invincible)
        {
            return;
        }
        if (p1_die)
        {
            return;
        }
        //Debug.Log("getHurt");

        if (animation_type == 2)//如果被打到時正在攻擊,被斷招
        {
            animation_type = 0;
            inFuntionTime  = 0;
            animator.SetBool("is_attack", false);
        }

        beingHurt_time = Time.time;
        animator.SetTrigger("is_hurt");
        //if (!p1charaType) p1moveAble = false;
        //else p2moveAble = false;
        invincible = true;
        if (inFuntionTime == 0)
        {
            L_JoyX = 0.0f;
            L_JoyY = 0.0f;
            K_JoyX = 0.0f;
            K_JoyY = 0.0f;
            TeamHp.ChangeHp(false, 0.05f);
            inFuntionTime++;
            EffectAudio.SetAudio(1);
        }
    }
示例#3
0
 void OnRestoreHealthing()
 {
     if (restoreTime < 0.0f)
     {
         restoreTime += Time.deltaTime;
     }
     else if (restoreTime < 1.0f)
     {
         restoreTime += Time.deltaTime * 2.5f;
         healthyItemsImage[whichItem].color        = Color.Lerp(Color.white, new Color(1, 1, 1, 0), restoreTime);
         healthyItems[whichItem].anchoredPosition += new Vector2(0, -80) * Time.deltaTime;
     }
     else
     {
         healthyItems[whichItem].gameObject.SetActive(false);
         TeamHp.ChangeHp(true, 0.15f);
         restoreTime = 0.0f;
         storeState  = -1;
         ResetItem();
     }
 }
示例#4
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;
            }
        }
    }