Ejemplo n.º 1
0
    public override void GetStart(GameObject targetObj)
    {
        if (_targetObj == null)
        {
            _targetObj = targetObj.transform;
        }


        ChongJiStartPos = this.transform.position;

        if (GlobalTools.GetDistanceByTowPoint(this.transform.position, _targetObj.transform.position) < 2)
        {
            ReSetAll();
            print("cj  start 起始距离 在 小于2 直接  Over!! ");
            //ChongjiOver();
            return;
        }

        isGetOver = false;

        isStarting     = true;
        IsGetTargetPos = false;

        _gameBody = GetComponent <GameBody>();
        //print("this.transform.position:   " + this.transform.position);
    }
Ejemplo n.º 2
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();
        }
    }
Ejemplo n.º 3
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;
            }
        }
    }