Exemplo n.º 1
0
    public void ReSetAll()
    {
        IsHasFire       = false;
        _isBehaviorOver = false;
        IsFindRoading   = false;
        IsGetFireTest   = false;

        newPoint       = Vector2.zero;
        IsGoToNewPoint = false;

        _isStart = false;

        if (_behavior)
        {
            _behavior.StopJS();
        }


        QishouYanchiJishi = 0;
        IsStartFire       = false;
        if (QishiLizi)
        {
            QishiLizi.Stop();
        }
    }
Exemplo n.º 2
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();
        }
    }