Esempio n. 1
0
    void GetAtk()
    {
        print("  getAtk!!!   isAtking " + isAtking);
        if (GetComponent <RoleDate>().isBeHiting)
        {
            print("------------------------------------------------->被击中打断!");
            AcOver();
            return;
        }

        if (gameBody.GetDB().animation.lastAnimationName == AtkName && gameBody.GetDB().animation.isCompleted)
        {
            AcOver();
            return;
        }

        if (!isAtking)
        {
            isAtking = true;
            if (AtkMsgName != Ac2Name && IsAC2 && Ac2Name != "")
            {
                if (GetComponent <RoleDate>().live < GetComponent <RoleDate>().maxLive *Live_bili)
                {
                    AtkMsgName = Ac2Name;
                }
            }
            gameBody.GetAtk(AtkMsgName);
        }


        if (isAtking && gameBody.GetDB().animation.lastAnimationName != AtkName)
        {
            AcOver();
        }
    }
Esempio n. 2
0
    //4.攻击
    void GetAtk()
    {
        string zs = GetZS(true);

        //print("zs   "+zs);
        if (zs == "")
        {
            isAtk = false;
            return;
        }
        gameBody.GetAtk(zs);
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        //print("----------------------------------------------------------------->     "+GlobalTools.GetRandomNum(2));


        JiShuQi();

        if (GetComponent <RoleDate>().isDie)
        {
            init();
            return;
        }

        if (GetComponent <RoleDate>().isBeHiting)
        {
            init();
            return;
        }

        if (!isFanjiing)
        {
            return;
        }

        if (isGongjiing && _gameBody.IsAtkOver())
        {
            init();
            return;
        }


        if (isQhuaing)
        {
            if (_gameBody.GetQianhuaOver())
            {
                isQhuaing = false;
            }
            return;
        }



        if (_gameBody && _gameBody.GetBackUpOver())
        {
            if (isQianHua && !isQianh)
            {
                isQianh   = true;
                isQhuaing = true;
                //qianhua
                _gameBody.Qianhua();
                return;
            }


            if (!isGongji)
            {
                isGongji = true;
                //判断是否包含该攻击动作 没有的话 返回
                //if (!_gameBody.IsHanAC(FANJI))
                //{
                //    isGongji = false;
                //    isFanjiing = false;
                //    return;
                //}

                //判断是否是技能攻击
                if (skillAtkName != "")
                {
                    string[] strArr    = skillAtkName.Split('|');
                    int      length    = strArr.Length;
                    string   _skilName = skillAtkName;
                    if (length > 1)
                    {
                        int i = GlobalTools.GetRandomNum(length);
                        print("  fanjinums  i =     " + i);
                        _skilName = strArr[i];
                    }
                    print(" ******************************************反击的 技能名字   " + _skilName);


                    if (GetComponent <AIAirBase>())
                    {
                        GetComponent <AIAirBase>().GetAtkFSByName(_skilName);
                    }
                    else
                    {
                        GetComponent <AIBase>().GetAtkFSByName(_skilName);
                    }

                    init();
                    return;
                }
                else
                {
                    _gameBody.GetAtk(FANJI);
                }

                if (atkDelayTimes != 0)
                {
                    _gameBody.GetPause(atkDelayTimes);
                }
                isGongjiing = true;
                //print("-------------------------------------------------------反击");
                //是否提高硬直
                if (isAddYZ)
                {
                    GetComponent <RoleDate>().addYZ(addYZNum);
                    isHasHFYZ = false;
                }
            }
        }
    }
Esempio n. 4
0
 void GetAtk()
 {
     playerObj.GetAtk();
 }
Esempio n. 5
0
    void ShouBing()
    {
        //var values = Enum.GetValues(typeof(KeyCode));//存储所有的按键
        //for (int x = 0; x < values.Length; x++)
        //{
        //    if (Input.GetKeyDown((KeyCode)values.GetValue(x)))
        //    {
        //        currentButton = values.GetValue(x).ToString();//遍历并获取当前按下的按键
        //        print("手柄按键  " + currentButton);
        //    }
        //}
        //detectPressedKeyOrButton();

        //float hl = Input.GetAxis("Horizontal_L");
        //float vl = Input.GetAxis("Vertical_L");

        //print("  hl "+hl);
        //print("  vl " + vl);



        horizontalDirection = Input.GetAxis(HORIZONTAL);

        verticalDirection = Input.GetAxis(VERTICAL);

        if (horizontalDirection > 0.8 || horizontalDirection < -0.8)
        {
            IsInShoubing = true;
        }

        if (verticalDirection > 0.6)
        {
            IsInShoubing      = true;
            Globals.isKeyUp   = true;
            Globals.isKeyDown = false;
        }
        else if (verticalDirection < -0.6)
        {
            IsInShoubing      = true;
            Globals.isKeyUp   = false;
            Globals.isKeyDown = true;
        }
        else
        {
            if (IsInShoubing)
            {
                Globals.isKeyUp   = false;
                Globals.isKeyDown = false;
            }
        }



        //if (Input.GetKeyDown(KeyCode.Joystick1Button3) && Globals.isKeyUp)
        //{
        //    //if (IsCanControl()) _body.GetSkill1();
        //    //print("技能释放---------   right ");

        //    ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RELEASE_SKILL, "center"), this);
        //    return;
        //}
        if (Input.GetKeyDown(KeyCode.Joystick1Button3) && Globals.isKeyUp)
        {
            //if (IsCanControl()) _body.GetSkill1();
            //print("技能释放---------  up");
            ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RELEASE_SKILL, "up"), this);
            return;
        }

        if (Input.GetKeyDown(KeyCode.Joystick1Button3) && Globals.isKeyDown)
        {
            //if (IsCanControl()) _body.GetSkill1();
            //print("技能释放---------  down");
            ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RELEASE_SKILL, "down"), this);
            return;
        }

        if (Input.GetKeyDown(KeyCode.Joystick1Button3))
        {
            //if (IsCanControl()) _body.GetSkill1();
            //print("技能释放---------   center");
            ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RELEASE_SKILL, "center"), this);
            return;
        }



        if (IsInShoubing)
        {
            if (horizontalDirection > 0)
            {
                if (IsCanControl())
                {
                    _body.RunRight(horizontalDirection);
                }
            }
            else if (horizontalDirection < 0)
            {
                if (IsCanControl())
                {
                    _body.RunLeft(horizontalDirection);
                }
            }
            else
            {
                if (IsCanControl() && !Globals.isXNBtn)
                {
                    _body.ReSetLR();
                }
            }
        }

        //print("verticalDirection    " + verticalDirection);


        if (Input.GetKeyDown(KeyCode.Joystick1Button5))
        {
            //if (IsCanControl()) _body.GetSkill1();
            //print("技能释放---------   center");
            //ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RELEASE_SKILL, "center"), this);

            if (IsCanControl())
            {
                _body.Gedang();
            }
            return;
        }


        if (Input.GetKeyDown(KeyCode.Joystick1Button0))
        {
            if (Globals.IsHitPlotKuai)
            {
                return;
            }
            //print(">>>>>>>>>>>???????  JJJJJJJ  Globals.isKeyUp    "+ Globals.isKeyUp);
            if (IsCanControl())
            {
                _body.GetAtk();
            }
        }
        if (Input.GetKeyDown(KeyCode.Joystick1Button1))
        {
            if (IsCanControl())
            {
                _body.GetJump();
            }
        }

        if (Input.GetKeyDown(KeyCode.Joystick1Button2) || Input.GetKeyDown(KeyCode.Joystick1Button7))
        {
            if (IsCanControl())
            {
                _body.GetDodge1();
            }
        }
    }
Esempio n. 6
0
    void ShouBing()
    {
        var values = Enum.GetValues(typeof(KeyCode));//存储所有的按键

        for (int x = 0; x < values.Length; x++)
        {
            if (Input.GetKeyDown((KeyCode)values.GetValue(x)))
            {
                currentButton = values.GetValue(x).ToString();//遍历并获取当前按下的按键
                //print("手柄按键  " + currentButton);
            }
        }
        //detectPressedKeyOrButton();

        //float hl = Input.GetAxis("Horizontal_L");
        //float vl = Input.GetAxis("Vertical_L");

        //print("  hl "+hl);
        //print("  vl " + vl);



        horizontalDirection = Input.GetAxis(HORIZONTAL);

        verticalDirection = Input.GetAxis(VERTICAL);



        if (horizontalDirection > 0)
        {
            if (IsCanControl())
            {
                _body.RunRight(horizontalDirection);
            }
        }
        else if (horizontalDirection < 0)
        {
            if (IsCanControl())
            {
                _body.RunLeft(horizontalDirection);
            }
        }
        else
        {
            if (IsCanControl() && !Globals.isXNBtn)
            {
                _body.ReSetLR();
            }
        }

        //print("verticalDirection    " + verticalDirection);

        if (verticalDirection > 0.6)
        {
            Globals.isKeyUp   = true;
            Globals.isKeyDown = false;
        }
        else if (verticalDirection < -0.6)
        {
            Globals.isKeyUp   = false;
            Globals.isKeyDown = true;
        }
        else
        {
            Globals.isKeyUp   = false;
            Globals.isKeyDown = false;
        }



        //if (Input.GetKeyDown("Joystick1Button0"))
        //{
        //    if (Globals.IsHitPlotKuai) return;
        //    //print(">>>>>>>>>>>???????  JJJJJJJ  Globals.isKeyUp    "+ Globals.isKeyUp);
        //    if (IsCanControl()) _body.GetAtk();
        //}
        //if (Input.GetKeyDown("Joystick1Button1"))
        //{
        //    if (IsCanControl()) _body.GetJump();
        //}

        //if (Input.GetKeyDown(KeyCode.U))
        //{
        //    //if (IsCanControl()) _body.GetSkill1();
        //}

        //if (Input.GetKeyDown("Joystick1Button3"))
        //{
        //    if (IsCanControl()) _body.GetSkill2();
        //}

        //if (Input.GetKeyDown("Joystick1Button2"))
        //{
        //    if (IsCanControl()) _body.GetDodge1();
        //}



        //Debug.Log("手柄按钮控制!!");

        if (currentButton == "Joystick1Button0" || currentButton == "JoystickButton0")
        {
            //Debug.Log("Joystick1Button0 !!!!! ");
            if (Globals.IsHitPlotKuai)
            {
                return;
            }
            if (IsCanControl())
            {
                _body.GetAtk();
            }
            currentButton = "";
        }

        if (currentButton == "Joystick1Button1")
        {
            if (IsCanControl())
            {
                _body.GetJump();
            }
            currentButton = "";
        }

        if (currentButton == "Joystick1Button2")
        {
            if (IsCanControl())
            {
                _body.GetDodge1();
            }
            currentButton = "";
        }

        if (currentButton == "Joystick1Button3")
        {
            currentButton = "";
        }
    }