示例#1
0
 protected virtual void ChongjiOver()
 {
     IsTongYing = false;
     deltaNums  = 0;
     if (CJYanmu)
     {
         CJYanmu.Stop();
     }
     if (ChongjiYingZhi != 0)
     {
         GetComponent <RoleDate>().hfYZ(ChongjiYingZhi);
     }
     //CJYanmu.loop = false;
     isStarting     = false;
     isGetOver      = true;
     isTanSheing    = false;
     IsStartChongji = false;
     CJYanchiNums   = 0;
     GetComponent <AIAirRunNear>().ResetAll();
     GetComponent <AirGameBody>().SetACingfalse();
     if (GetComponent <JN_Date>())
     {
         GetComponent <JN_Date>().HitInSpecialEffectsType = 5;
     }
     _IsHitGroundUp = false;
     _airGameBody.GetPlayerRigidbody2D().velocity *= 0.2f;
     //print("*************************************************************冲击 结束!!!!!");
 }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     GetInit();
     runNear      = GetComponent <AIAirRunNear>();
     runAway      = GetComponent <AIAirRunAway>();
     _roleDate    = GetComponent <RoleDate>();
     _airGameBody = GetComponent <AirGameBody>();
     if (CJYanmu)
     {
         CJYanmu.Stop();
     }
 }
示例#3
0
 public virtual void ReSetAll()
 {
     IsTongYing = false;
     isStarting = false;
     //isGetOver = false;
     isTanSheing = false;
     isGetOver   = true;
     deltaNums   = 0;
     if (CJYanmu)
     {
         CJYanmu.Stop();
     }
     GetComponent <AirGameBody>().GetDB().animation.timeScale = 1f;
     if (GetComponent <JN_Date>())
     {
         GetComponent <JN_Date>().HitInSpecialEffectsType = 5;
     }
     _IsHitGroundUp       = false;
     _airGameBody.isAcing = false;
 }
示例#4
0
    public override void ReSetAll()
    {
        print("横向冲击 结束!!!!!!");
        ChongjiOver();
        IsHasChosePos = false;
        if (CJhitKuai)
        {
            CJhitKuai.SetActive(false);
        }
        if (!ZiShenhitKuai.activeSelf)
        {
            ZiShenhitKuai.SetActive(true);
        }
        _jnDate.atkPower = _ysAtkPower;
        IsTongYing       = false;
        deltaNums        = 0;
        if (CJYanmu)
        {
            CJYanmu.Stop();
        }
        if (ChongjiYingZhi != 0)
        {
            _roleDate.hfYZ(ChongjiYingZhi);
        }
        isStarting     = false;
        isGetOver      = true;
        isTanSheing    = false;
        IsStartChongji = false;
        CJYanchiNums   = 0;
        runNear.ResetAll();
        _airGameBody.SetACingfalse();
        IsGetTargetPos = false;

        _airGameBody.GetDB().animation.timeScale = 1f;
        _airGameBody.GetStand();
        startTanShe = false;
        if (GetComponent <JN_Date>())
        {
            GetComponent <JN_Date>().HitInSpecialEffectsType = 5;
        }
    }
示例#5
0
    protected virtual void Tanshe()
    {
        //这里GlobalSetDate.instance.IsChangeScreening 判断是否切换 场景 是构架失误  应该统一update
        if (GetComponent <RoleDate>().isBeHiting || GetComponent <RoleDate>().isDie || GetComponent <GameBody>().IsHitWall || GlobalSetDate.instance.IsChangeScreening)
        {
            //print("  IsHitWall "+ GetComponent<GameBody>().IsHitWall+ "  ------IsGround  "+ GetComponent<GameBody>().IsGround);
            ReSetAll();
            //ChongjiOver();
            return;
        }


        //做起始动作
        //起始动作完成 弹射 做第二个动作
        //完成后 还原动作
        if (GetComponent <AirGameBody>().GetDB().animation.HasAnimation(ACName_ChongjiBegin) && GetComponent <AirGameBody>().GetDB().animation.HasAnimation(ACName_ChongjiStart))
        {
            if (GetComponent <AirGameBody>().GetDB().animation.lastAnimationName != ACName_ChongjiBegin && GetComponent <AirGameBody>().GetDB().animation.lastAnimationName != ACName_ChongjiStart)
            {
                //转向 朝向玩家
                GetComponent <AirGameBody>().GetAcMsg(ACName_ChongjiBegin);
                //开始冲击时候的 怪物叫声
                //print("  卡住了????????????????????    "+GlobalSetDate.instance.IsChangeScreening);
                if (StartSound)
                {
                    StartSound.Play();
                }
                GetComponent <AirGameBody>().GetDB().animation.Stop();
                GetComponent <AirGameBody>().GetStop();
                deltaNums = 0;
                return;
            }


            if (GetComponent <AirGameBody>().GetDB().animation.lastAnimationName == ACName_ChongjiBegin)
            {
                CJYanchiNums += Time.deltaTime;
                //print("  CJYanchiNums   " + CJYanchiNums + "   GetComponent<AirGameBody>().GetDB().animation  " + GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);
                if (CJYanchiNums >= CJYanchiTime)
                {
                    GetComponent <AirGameBody>().GetAcMsg(ACName_ChongjiStart);
                    if (!GetComponent <AirGameBody>().GetDB().animation.isPlaying)
                    {
                        GetComponent <AirGameBody>().GetDB().animation.Play();
                    }
                }
                return;
            }
        }

        //print("ac   "+ GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);


        if (!IsStartChongji && !IsGenZongType)
        {
            IsStartChongji = true;
            targetPos      = _targetObj.position;
            //冲击身后距离
            if (ChongJiShenHouDis != 0)
            {
                //这个点 要在靠后一点
                float dis  = GlobalTools.GetDistanceByTowPoint(targetPos, transform.position);
                float _d   = ChongJiShenHouDis;
                float __x1 = targetPos.x - _d * (this.transform.position.x - targetPos.x) / dis;
                float __y1 = targetPos.y - _d * (this.transform.position.y - targetPos.y) / dis;
                targetPos = new Vector2(__x1, __y1);
            }



            //转向
            //朝向
            if (this.transform.position.x < targetPos.x)
            {
                _airGameBody.TurnRight();
            }
            else
            {
                _airGameBody.TurnLeft();
            }
        }

        if (IsGenZongType)
        {
            targetPos = _targetObj.position;
        }


        //print(" 5  "+ this.transform.position);
        deltaNums += Time.deltaTime;

        if (deltaNums >= _tsTimes || GetComponent <AIAirRunNear>().ZhijieMoveToPoint(targetPos, 0.1f, chongjiSpeed, false, false, 0))
        {
            //print("自身的位置   "+this.transform.position+ "  冲击到了位置 停止targetPos  " + targetPos);
            ChongjiOver();
        }

        if (CJYanmu)
        {
            CJYanmu.Play();
        }
    }
示例#6
0
    //protected override void ChongjiOver()
    //{
    //    if (CJhitKuai.activeSelf) CJhitKuai.SetActive(false);
    //    if (!ZiShenhitKuai.activeSelf) ZiShenhitKuai.SetActive(true);
    //    _jnDate.atkPower = _ysAtkPower;
    //    IsTongYing = false;
    //    deltaNums = 0;
    //    CJYanmu.Stop();
    //    if (ChongjiYingZhi != 0) _roleDate.hfYZ(ChongjiYingZhi);
    //    //CJYanmu.loop = false;
    //    isStarting = false;
    //    isGetOver = true;
    //    isTanSheing = false;


    //    IsStartChongji = false;
    //    CJYanchiNums = 0;
    //    runNear.ResetAll();



    //    startTanShe = false;
    //    //print("*************************************************************冲击 结束!!!!!");
    //}



    protected override void Tanshe()
    {
        //print("   IsHitWall:     "+ GetComponent<GameBody>().IsHitWall+ "       @@@@@ IsGround        "+ GetComponent<GameBody>().IsGround);

        //print("@@@@@@@@@@@@@@@@@@@@@弹射中!!!!!!!");
        if (_roleDate.isBeHiting || _roleDate.isDie || _airGameBody.IsHitWall)
        {
            print("撞墙了!!!!");
            ReSetAll();
            //ChongjiOver();
            return;
        }


        //做起始动作
        //起始动作完成 弹射 做第二个动作
        //完成后 还原动作
        if (_airGameBody.GetDB().animation.HasAnimation(ACName_ChongjiBegin) && _airGameBody.GetDB().animation.HasAnimation(ACName_ChongjiStart))
        {
            if (_airGameBody.GetDB().animation.lastAnimationName != ACName_ChongjiBegin && _airGameBody.GetDB().animation.lastAnimationName != ACName_ChongjiStart)
            {
                //转向 朝向玩家
                _airGameBody.GetAcMsg(ACName_ChongjiBegin, 0, 1);
                _airGameBody.GetDB().animation.Stop();
                _airGameBody.GetStop();
                deltaNums = 0;
                return;
            }


            if (_airGameBody.GetDB().animation.lastAnimationName == ACName_ChongjiBegin)
            {
                CJYanchiNums += Time.deltaTime;
                //print("  CJYanchiNums   " + CJYanchiNums + "   GetComponent<AirGameBody>().GetDB().animation  " + GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);
                if (CJYanchiNums >= CJYanchiTime)
                {
                    _airGameBody.GetAcMsg(ACName_ChongjiStart);
                    if (!_airGameBody.GetDB().animation.isPlaying)
                    {
                        _airGameBody.GetDB().animation.Play();
                    }
                }
                return;
            }
        }

        //print("ac   "+ GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);


        if (!IsStartChongji && !IsGenZongType)
        {
            IsStartChongji  = true;
            targetPos       = _targetObj.position;
            ChongJiStartPos = this.transform.position;
            //这个点 要在靠后一点
            float dis = GlobalTools.GetDistanceByTowPoint(targetPos, transform.position);
            //float _d = 4;
            //float __x1 = targetPos.x - _d * (this.transform.position.x - targetPos.x) / dis;
            //float __y1 = targetPos.y - _d * (this.transform.position.y - targetPos.y) / dis;

            float moveDistance = 0;
            if (_atkDistance + 3 > dis)
            {
                moveDistance = dis + 5;
            }
            else
            {
                moveDistance = _atkDistance + 5;
            }

            float __x1 = this.transform.position.x > targetPos.x? this.transform.position.x - moveDistance - 5 : this.transform.position.x + moveDistance + 5;
            float __y1 = this.transform.position.y;

            targetPos = new Vector2(__x1, __y1);

            //朝向
            if (this.transform.position.x < targetPos.x)
            {
                _airGameBody.TurnRight();
            }
            else
            {
                _airGameBody.TurnLeft();
            }



            if (ZiShenhitKuai.activeSelf)
            {
                ZiShenhitKuai.SetActive(false);
            }

            //print("wo kao!!!!!!!!!");
            if (GetComponent <JN_Date>())
            {
                GetComponent <JN_Date>().HitInSpecialEffectsType = 1;
            }
        }

        if (IsGenZongType)
        {
            targetPos = _targetObj.position;
        }


        //print(" 5  "+ this.transform.position);
        deltaNums += Time.deltaTime;



        if (deltaNums >= _tsTimes || IsOutChongjiDistance() || GetComponent <AIAirRunNear>().ZhijieMoveToPoint(targetPos, 0.1f, chongjiSpeed, false, false) || _airGameBody.IsHitWall)
        {
            //print(">>>>????????  冲击over  " + "  @@@@@@  deltaNums   " + deltaNums + "  _tsTimes  " + _tsTimes);
            if (CJhitKuai)
            {
                CJhitKuai.SetActive(false);
            }
            ChongjiOver();
            if (!ZiShenhitKuai.activeSelf)
            {
                ZiShenhitKuai.SetActive(true);
            }
            //ReSetAll();
        }

        if (CJYanmu)
        {
            CJYanmu.Play();
        }

        if (deltaNums != 0)
        {
            if (!CJhitKuai.activeSelf)
            {
                CJhitKuai.SetActive(true);
                _jnDate.atkPower = SkillPower;
            }
        }
    }
示例#7
0
    protected virtual void HXTanShe2()
    {
        //print(" 为什么一直进来 HXTanShe2********************************************************** ");
        if (GetComponent <RoleDate>().isBeHiting || GetComponent <RoleDate>().isDie || GetComponent <GameBody>().IsHitWall)
        {
            //print("  IsHitWall " + GetComponent<GameBody>().IsHitWall + "  ------IsGround  " + GetComponent<GameBody>().IsGround);
            //ChongjiOver();

            //print("cj  被攻击 或者die ---或者 撞墙   Over!! ");

            ReSetAll();
            return;
        }


        if (!IsStartChongji && GetComponent <AirGameBody>().GetDB().animation.HasAnimation(ACName_ChongjiBegin) && GetComponent <AirGameBody>().GetDB().animation.HasAnimation(ACName_ChongjiStart))
        {
            //if (!IsStartChongji && !IsGenZongType)
            //{
            //    IsStartChongji = true;
            //}

            //print(" 准备阶段 横向冲击 acName: "+_airGameBody.GetDB().animation.lastAnimationName);

            float __x = 0;
            if (GetComponent <AirGameBody>().GetDB().animation.lastAnimationName != ACName_ChongjiBegin && GetComponent <AirGameBody>().GetDB().animation.lastAnimationName != ACName_ChongjiStart)
            {
                __x = this.transform.position.x > _targetObj.position.x ? this.transform.position.x - HXChongjiDis : this.transform.position.x + HXChongjiDis;

                targetPos = new Vector2(__x, this.transform.position.y);
                //转向
                //朝向

                _airGameBody.GetPlayerRigidbody2D().velocity = Vector2.zero;
                if (this.transform.position.x < targetPos.x)
                {
                    _airGameBody.TurnRight();
                }
                else
                {
                    _airGameBody.TurnLeft();
                }

                if (!CJhitKuai.activeSelf)
                {
                    CJhitKuai.SetActive(true);
                    _jnDate.atkPower = SkillPower;
                }

                if (ZiShenhitKuai.activeSelf)
                {
                    ZiShenhitKuai.SetActive(false);
                }

                //print("wo kao!!!!!!!!!");
                if (GetComponent <JN_Date>())
                {
                    GetComponent <JN_Date>().HitInSpecialEffectsType = 1;
                }
                //print("start!!!   ACName_ChongjiBegin " + ACName_ChongjiBegin+ " lastAnimationName:   " + GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);

                if (StartSound)
                {
                    StartSound.Play();
                }
                _airGameBody.isAcing = true;
                _airGameBody.GetDB().animation.Stop();
                //_airGameBody.GetDB().animation.GotoAndStopByFrame(ACName_ChongjiBegin);
                //****************不要用 FadeIn  有bug 会卡主 游戏****************
                _airGameBody.GetDB().animation.FadeIn(ACName_ChongjiBegin, 0.1f);

                deltaNums = 0;
                return;
            }


            if (GetComponent <AirGameBody>().GetDB().animation.lastAnimationName == ACName_ChongjiBegin)
            {
                CJYanchiNums += Time.deltaTime;


                //print("  播放进度 "+ GetComponent<AirGameBody>().GetDB().animation.GetState(ACName_ChongjiBegin));
                //if (GetComponent<AirGameBody>().GetDB().animation.isCompleted) GetComponent<AirGameBody>().GetDB().animation.Stop();


                //print("  冲击准备阶段  CJYanchiNums   " + CJYanchiNums + "   GetComponent<AirGameBody>().GetDB().animation  " + GetComponent<AirGameBody>().GetDB().animation.lastAnimationName);
                if (CJYanchiNums >= CJYanchiTime)
                {
                    _airGameBody.isAcing = true;
                    _airGameBody.GetDB().animation.FadeIn(ACName_ChongjiStart);
                    IsStartChongji = true;

                    print("  KAISHI CHONGJI!!!!!!!!   ");

                    //判断 是否 碰到地板

                    if (_gameBody.IsHitWall)
                    {
                        targetPos = new Vector2(targetPos.x, this.transform.position.y + 2);
                    }
                    else
                    {
                        if (ChoseYPosType == 1)
                        {
                            //有一定的 Y偏移
                            if (_targetObj.position.y > this.transform.position.y)
                            {
                                targetPos = new Vector2(targetPos.x, this.transform.position.y + YPianyi);
                            }
                            else if (_targetObj.position.y < this.transform.position.y)
                            {
                                targetPos = new Vector2(targetPos.x, this.transform.position.y - YPianyi);
                            }
                        }
                        else if (ChoseYPosType == 2)
                        {
                            //直线
                            targetPos = new Vector2(targetPos.x, this.transform.position.y);
                        }
                    }
                }
                return;
            }
        }


        if (!IsStartChongji)
        {
            return;
        }

        //print("lastAnimationName   " + _airGameBody.GetDB().animation.lastAnimationName+ "   isAcing    "+ _airGameBody.isAcing);
        //print("  是否撞墙   "+ _airGameBody.IsHitWall+"  持续时间      "+ deltaNums+ "  _tsTimes   "+ _tsTimes);
        deltaNums += Time.deltaTime;
        //print("冲击的时候 自己的 速度是多少  " + _gameBody.GetPlayerRigidbody2D().velocity.x+ "     ---- deltaNums   " + deltaNums+"  ???  "+ _tsTimes * 0.6f);

        if (GetComponent <AIAirRunNear>().MoveToPoint(targetPos, 0.1f, chongjiSpeed, false, false, MaxChongjiSpeed))
        {
            print(" cj 靠近点了 ");
        }

        if (_airGameBody.IsHitWall)
        {
            print(" cj 撞墙了!!! ");
        }

        if (deltaNums >= _tsTimes * 0.6f && MinStopSpeed != 0 && Mathf.Abs(_gameBody.GetPlayerRigidbody2D().velocity.x) <= MinStopSpeed)
        {
            print("cj 3333333333   " + deltaNums + "     " + _tsTimes * 0.6f);
            print(" MinStopSpeed   " + MinStopSpeed);
        }

        if (IsOutChongjiDistance())
        {
            print(" cj  IsOutChongjiDistance ");
        }


        if (deltaNums >= _tsTimes || IsOutChongjiDistance() || GetComponent <AIAirRunNear>().MoveToPoint(targetPos, 0.1f, chongjiSpeed, false, false, MaxChongjiSpeed) || _airGameBody.IsHitWall || (deltaNums >= _tsTimes * 0.6f && MinStopSpeed != 0 && Mathf.Abs(_gameBody.GetPlayerRigidbody2D().velocity.x) <= MinStopSpeed))
        {
            if (deltaNums >= _tsTimes)
            {
                print("  超出 冲击 时间   ");
            }
            //if (IsOutChongjiDistance()) print("超出 冲击 距离结束");
            if (_airGameBody.IsHitWall)
            {
                print("撞墙 结束!!!");
            }
            //print("**************************************************到达目标Ian附近 结束!!!");
            //print(">>>>????????  冲击over  " + "  @@@@@@  deltaNums   " + deltaNums + "  _tsTimes  " + _tsTimes);

            print("cj  速度  " + Mathf.Abs(_gameBody.GetPlayerRigidbody2D().velocity.x) + "   MinStopSpeed " + MinStopSpeed);


            if (CJhitKuai)
            {
                CJhitKuai.SetActive(false);
            }
            ChongjiOver();
            if (!ZiShenhitKuai.activeSelf)
            {
                ZiShenhitKuai.SetActive(true);
            }
            ReSetAll();
        }

        if (CJYanmu)
        {
            CJYanmu.Play();
        }
    }