Exemplo n.º 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);
 }
Exemplo n.º 2
0
    void UseTrap()
    {
        if (OnBuildTrapping)
        {
            return;
        }
        if (!useController)
        {
            if (Input.GetKeyDown(KeyCode.Q) && craftSystem.GetFunc())
            {
                Tool.enabled = true;
                if (!CanSet() || trapeNum >= 2)
                {//如果位置不能設陷阱,顯示不能挖
                    unTool      = true;
                    Tool.sprite = unToolImg;
                }
                else
                {
                    OnBuildTrapping = true;
                    Tool.sprite     = ToolImg;
                    this.GetComponent <Animator>().SetTrigger("usingTrape");
                    usingTool = true;
                    switchMove(false);
                    if (trapeNum < 2)
                    {
                        trapeNum++;
                    }

                    craftSystem.SetFuncBusy(true);
                }
            }
        }
        else
        {
            if (Input.GetButtonDown(whichPlayer + "ButtonX") && craftSystem.GetFunc())
            {
                Tool.enabled = true;
                if (!CanSet() || trapeNum >= 2)
                {//如果位置不能設陷阱,顯示不能挖
                    unTool      = true;
                    Tool.sprite = unToolImg;
                }
                else
                {
                    OnBuildTrapping = true;
                    Tool.sprite     = ToolImg;
                    this.GetComponent <Animator>().SetTrigger("usingTrape");
                    usingTool = true;
                    switchMove(false);
                    if (trapeNum < 2)
                    {
                        trapeNum++;
                    }
                    craftSystem.SetFuncBusy(true);
                }
            }
        }
    }
Exemplo n.º 3
0
    void UseTrap()
    {
        if (digging || !craftSystem.GetFunc())
        {
            return;
        }
        if (!useController)
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                Tool.enabled = true;
                if (!CanSet() || trapNum >= 2)  //如果位置不能設陷阱,顯示不能挖
                {
                    unShovel    = true;
                    Tool.sprite = unShovelImg;
                    return;
                }
                for (int i = 0; i < 2; i++)
                {
                    if (!trapUse[i])
                    {
                        Tool.sprite = shovelImg;
                        this.GetComponent <Animator>().SetTrigger("usingTrape");
                        digging = true;
                        switchMove(false);
                        if (test)
                        {
                            tutorialRequest.DoneTrap();
                        }
                        if (trapNum < 2)
                        {
                            trapNum++;
                        }
                        craftSystem.SetFuncBusy(true);
                        return;
                    }
                }
            }
        }
        else
        {
            if (Input.GetButtonDown(whichPlayer + "ButtonX"))
            {
                Tool.enabled = true;

                if (!CanSet() || trapNum >= 2) //如果位置不能設陷阱,顯示不能挖
                {
                    unShovel    = true;
                    Tool.sprite = unShovelImg;
                    return;
                }
                for (int i = 0; i < 2; i++)
                {
                    if (!trapUse[i])
                    {
                        Tool.sprite = shovelImg;
                        this.GetComponent <Animator>().SetTrigger("usingTrape");
                        digging = true;
                        switchMove(false);
                        if (test)
                        {
                            tutorialRequest.DoneTrap();
                        }
                        if (trapNum < 2)
                        {
                            trapNum++;
                        }
                        Debug.Log("shovel" + trapNum);
                        craftSystem.SetFuncBusy(true);
                        return;
                    }
                }
            }
        }
    }