Exemplo n.º 1
0
    void FDDianMaBi()
    {
        if (!IsDian)
        {
            return;
        }
        _DianMabiJishi += Time.deltaTime;
        //print("附带 麻痹 效果 _DianMabiJishi " + _DianMabiJishi+ " _CMaxDianMabiShijian    "+ _CMaxDianMabiShijian);

        _gameBody.GetDB().animation.timeScale = 0.1f;
        _gameBody.GetDB().animation.Stop();
        _gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;
        //GetPlayerRigidbody2D().gravityScale = 0;

        if (_DianMabiJishi >= _CMaxDianMabiShijian || _roledate.isDie)
        {
            IsDian = false;
            print(" 电效果结束!!!!!  ");
            _gameBody.GetDB().animation.Play();
            _gameBody.GetDB().animation.timeScale = 1;
            _DianMabiJishi       = 0;
            _CMaxDianMabiShijian = 0;
            //GetPlayerRigidbody2D().gravityScale = 4.5f;
        }
    }
Exemplo n.º 2
0
    //被攻击后 隐身后退
    public void BeHitHide()
    {
        //print("/////////////////////////////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@---------------------------------->   jl            " + BeHitHideJL);
        if (!IsOpenBeHitHide)
        {
            return;
        }

        if (IsBeHitingHide)
        {
            return;
        }
        if (_roledate.isDie)
        {
            return;
        }
        IsBeHitingHide = true;
        biHitJishi     = 0;
        //if (IsBeHitingHide &&!GetComponent<RoleDate>().isBeHiting)
        //{
        //    IsBeHitingHide = false;
        //}
        //计算几率
        int jl = GlobalTools.GetRandomNum();

        //print("/////////////////////////////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@---------------------------------->   jl    " + jl + "        " + BeHitHideJL);
        if (jl <= BeHitHideJL)
        {
            if (YinShenType == 2)
            {
                ShowYinShenTX();
            }


            IsInBeHitFJ = true;
            //重置 被攻击的判断
            _gameBody.FanJiBeHitReSet();
            //清0速度
            _gameBody.SpeedXStop();
            //后退速度  用后闪的 接口
            _gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;
            _gameBody.BackJumpVX(houshanValue);
            _roledate.isCanBeHit = false;
            ShowXuetiao();
            //隐身 接口
            print("------------------被攻击后 隐身");
            ReSetAll();

            //_aiAirBase.
            _aiAirBase.GetAtkFSByName("yinshen");
        }
    }
Exemplo n.º 3
0
    void startRunToTarget()
    {
        //被攻击 中断
        if (GetComponent <RoleDate>().isDie || GetComponent <RoleDate>().isBeHiting)
        {
            ReSetAll();
            return;
        }

        //判断 前面如果撞墙 就结束
        if (_gameBody.IsHitWall)
        {
            print("-------------------------------------------  冲刺撞墙 ");
            ReSetAll();
            return;
        }


        if (IsHasQSAC && !_isQiShiAcOver)
        {
            //print("进来没?????   " + QishiACName+"  shifouhanyouAC  "+);
            //起始动作做完
            if (_gameBody.GetDB().animation.lastAnimationName != QishiACName)
            {
                //_player.GetComponent<GameBody>().GetDB().animation.GotoAndPlayByFrame(QishiACName);
                //print("?????????????进来没??");
                _gameBody.GetAcMsg(QishiACName);
            }
            else
            {
                //print("------->> 1");
                if (_gameBody.GetDB().animation.isCompleted)
                {
                    _isQiShiAcOver = true;
                }
            }
            return;
        }



        //下压的力 放置 角色飞起来了
        //_gameBody.GetPlayerRigidbody2D().AddForce(new Vector2(0, -20));
        _gameBody.GetZongTuili(new Vector2(0, -20));

        if (runDirection == "right")
        {
            _gameBody.RunRight(3f);
        }
        else
        {
            _gameBody.RunLeft(-3f);
        }
        if (Mathf.Abs(this.transform.position.x - _positionX) >= Distances)
        {
            ReSetAll();
        }


        if (!IsShowTXAndHitKuai && _isStarting)
        {
            //print("  速度是多少: "+_gameBody.GetPlayerRigidbody2D().velocity.x);
            if (Mathf.Abs(_gameBody.GetPlayerRigidbody2D().velocity.x) < 3)
            {
                return;
            }
            IsShowTXAndHitKuai = true;
            //print("_gameBody.GetDB().animation.lastAnimationName   " + _gameBody.GetDB().animation.lastAnimationName);
            HitKuai.SetActive(true);
            //HitKuai.transform.position = this.transform.position;
            ShowTX();
        }
        if (HitKuai)
        {
            //hitkuai跟随 特效的位置  后面也可以加一个参照点 跟随参照点
            HitKuai.transform.position = Lizi.transform.position;
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (_roleDate.isDie || _roleDate.isBeHiting || (_player && _player.GetComponent <RoleDate>().isDie))
        {
            ReSetAll();
            _isGetOver = true;
            ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.CAMERA_SHOCK, "end"), this);
            return;
        }

        if (GetInStand)
        {
            if (IsOverInStand())
            {
                //print(" inStand!!!!!   ");
                ReSetAll();
                _isGetOver = true;
            }
            return;
        }
        //print(_gameBody.GetDB().animation.lastAnimationName + "   zhuangtai     " + _gameBody.GetDB().animation.lastAnimationState._fadeProgress);

        if (IsGetStartAC && !_gameBody.isAcing)
        {
            IsGetStartAC = false;
            //_gameBody.isAcing = false;
            print("  ---->???  qishou wancheng ");
            _gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;



            IsStartPenhuo = true;
            //播放 起始 的特效  这里是循环的

            //_gameBody.GetAcMsg(PenHuoACName);

            return;
        }

        if (IsStartPenhuo)
        {
            //GetInStand = true;

            if (!IsInPenhuoing)
            {
                IsInPenhuoing = true;
                penhuoJishi   = 0;
                _gameBody.GetDB().animation.FadeIn(PenHuoACName);
                TX_Huoyan.gameObject.SetActive(true);
                TX_Huoyan.Play();

                moveSpeedX = this.transform.localScale.x > 0 ? -Mathf.Abs(moveSpeedX) : Mathf.Abs(moveSpeedX);
                print(" ******************************* moveSpeedX  " + moveSpeedX + "     localScale    " + this.transform.localScale.x);
            }

            if (!IsShock)
            {
                IsShock = true;
                ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.CAMERA_SHOCK, "z2-" + (penhuoCXTimes - 0.4f)), this);
            }


            penhuoJishi += Time.deltaTime;


            this.transform.position = new Vector2(this.transform.position.x + moveSpeedX, this.transform.position.y);
            //print("  moveSpeedX  "+ moveSpeedX+ "     localScale    "+ this.transform.localScale.x);

            //print(" penhuoJishi  "+ penhuoJishi);
            if (penhuoJishi >= penhuoCXTimes)
            {
                penhuoJishi = 0;
                print(" penghuo OVER!!!!!!! ");
                TX_QS.Stop();
                TX_Huoyan.Stop();
                TX_Huoyan.gameObject.SetActive(false);
                IsStartPenhuo = false;
                GetInStand    = true;
            }
        }
    }
Exemplo n.º 5
0
    //有AC有动作事件的 技能释放
    protected void SkillStarting()
    {
        ChixuSkillStarting();

        if (IsSpeAISkill)
        {
            return;
        }

        if (!IsStopSelf)
        {
            IsStopSelf = true;
            _gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;
        }

        //print("  进来没  发动技能!!!! ");
        if (_isGetStart)
        {
            if (StartParticle != null && !IsStartParticle)
            {
                IsStartParticle = true;
                //print("zd qs 播放 起手特效");
                StartParticle.gameObject.SetActive(true);
                StartParticle.Play();
            }



            if (IsStartDelayOver())
            {
                if (!IsSkillShowOut)
                {
                    IsSkillShowOut = true;

                    //print("zd acName:    "+ACName);
                    if (ACName != "")
                    {
                        //print("zd*****************************************播放 技能动作!!!!" + ACName);
                        _gameBody.isAcing = true;
                        //_gameBody.GetDB().animation.GotoAndPlayByFrame(ACName, 0, 1);
                        _gameBody.GetDB().animation.FadeIn(ACName, 0.2f, 1);
                        //_gameBody.GetAcMsg(ACName);
                        //print(" zd    当前播放的技能动作  "+ _gameBody.GetDB().animation.lastAnimationName);

                        QishouTexiao();
                    }
                    else
                    {
                        ACSkillShowOut();
                    }
                }

                if (ACName != "")
                {
                    //print("zd   "+_gameBody.GetDB().animationName + "   ZD  ****** over   " + ACName + "    ??  " + _gameBody.GetDB().animation.lastAnimationState.totalTime + "    " + _gameBody.GetDB().animation.lastAnimationState._actionTimeline.currentTime+ " ACScaleStartTimes   "+ ACScaleStartTimes);
                    if (ACScaleStartTimes != 0 && _gameBody.GetDB().animation.lastAnimationState._actionTimeline.currentTime >= ACScaleStartTimes)
                    {
                        _gameBody.GetDB().animation.lastAnimationState.timeScale = ACScaleNums;
                    }



                    if (_gameBody.GetDB().animation.lastAnimationName == ACName && _gameBody.GetDB().animation.lastAnimationState.isCompleted)
                    {
                        _gameBody.GetDB().animation.lastAnimationState.timeScale = 1;
                        if (!IsOverDelayOver())
                        {
                            //print( OverDelayTimes+ " ----OVERTIMES----  "+OverTimes);
                            //print("  _gameBody.GetDB().animation.lastAnimationName "+ _gameBody.GetDB().animation.lastAnimationName);
                            //_gameBody.GetDB().animation.Stop();
                        }
                        else
                        {
                            _gameBody.isAcing = false;
                            TheSkillOver();
                        }
                    }
                    else
                    {
                        //print(ACName + "  zd 技能动作未播完  " + _gameBody.GetDB().animation.lastAnimationName + "    _gameBody.GetDB().animation.lastAnimationState._actionTimeline.currentTime   " + _gameBody.GetDB().animation.lastAnimationState._actionTimeline.currentTime+ " _gameBody.isAcing  "+ _gameBody.isAcing);
                        if (ACName != "" && _gameBody.GetDB().animation.lastAnimationName != ACName)
                        {
                            //_gameBody.GetDB().animation.GotoAndPlayByFrame(ACName);
                            print("zd >>>>>>>>>>>>>>>>>>>> 强行修正!!!!!   不知道哪里回复到站立的  ");
                            ReSetAll();
                            TheSkillOver();
                        }
                    }
                }
                else
                {
                    if (IsOverDelayOver())
                    {
                        TheSkillOver();
                    }
                }
            }
            else
            {
                if (ACName != "")
                {
                    if (!IsQishouYanchi)
                    {
                        IsQishouYanchi = true;
                        //_gameBody.isAcing = true;
                        //_gameBody.GetDB().animation.FadeIn(ACName, 1, 1);
                        //如果用了 这里 在动作进入后  进入攻击 又会再进一次  导致动画穿帮
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    void Starting()
    {
        if (_targetObj == null)
        {
            return;
        }

        if (IsDimian)
        {
            GetComponent <GameBody>().TurnDirection(_targetObj);
            GetFire();
            return;
        }

        if (IsGoToNewPoint)
        {
            //print("-------------------------------> 对点");
            GoToNewPoint();
            return;
        }


        //选点 1.在射程内 2.y距离在一定范围内  如果Y超了怎么办 上下移动 如果碰到墙 退出   太近 又要远离
        //判断是否进入射程
        if (IsFindRoading)
        {
            //print("-------------------------------> 一般寻路!!!!!!!!!");
            GoToNewPoint();
            return;
        }



        if (IsGetFireTest)
        {
            IsGetFireTest = false;
            //判断 和目标间 是否 有障碍物
            if (_pointDistration.IsTwoPointLineHitObj(_targetObj.transform.position, this.transform.position))
            {
                //找新点
                print("找新点!!!");
                GetToNewPoint();
                return;
            }
            IsStartFire = true;
            print("------------------------------进入粒子系统延迟-------------------------------------");
            if (QishiLizi && QishiLizi.isStopped && QishouYanchiTimes != 0)
            {
                QishiLizi.Play();
                QishouAudio.Play();
                _gameBody.GetPlayerRigidbody2D().velocity *= 0.1f;
            }
        }

        //这里 显示特效 并且 延迟
        if (QishouYanchiTimes != 0)
        {
            if (!StartQishouYanchi())
            {
                return;
            }
        }


        if (IsStartFire)
        {
            IsStartFire = false;
            //print("开火的时候 速度是多少   "+_gameBody.GetPlayerRigidbody2D().velocity);
            //_gameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;
            //这里做一个缓动减速
            _behavior.StartJS();
            //朝向攻击目标
            GetComponent <GameBody>().TurnDirection(_targetObj);
            GetFire();
        }
    }