Beispiel #1
0
        //是否怪物全部死亡
        public bool IsMonsterAllDeath()
        {
            List <ActorObj> actorList = CoreEntry.gActorMgr.GetAllMonsterActors();

            for (int i = 0; i < actorList.Count; ++i)
            {
                ActorObj actorBase = actorList[i];
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actorBase.gameObject) == false)
                {
                    continue;
                }

                //敌方阵营才算
                if (actorBase.m_TeamType == 3)
                {
                    if (actorBase.mActorType == ActorType.AT_MONSTER ||
                        actorBase.mActorType == ActorType.AT_BOSS ||
                        actorBase.mActorType == ActorType.AT_MECHANICS)
                    {
                        if (!actorBase.IsDeath())
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #2
0
 void Awake()
 {
     m_transform   = this.transform;
     m_gameManager = CoreEntry.gGameMgr;
     m_skillMgr    = CoreEntry.gSkillMgr;
     m_gameDBMgr   = CoreEntry.gGameDBMgr;
 }
Beispiel #3
0
        //class objectMoveInfo
        //{
        //    public GameObject obj;
        //    public Vector3 srcPos;
        //};
        //private List<objectMoveInfo> m_aimObjectList = new List<objectMoveInfo>();

        //private static GameObject mCenterObj;

        void DoFocusAction()
        {
            //计算位移距离
            FunDamageNode fun = m_oneDamageInfo.damageNode.funDamage;

            //聚怪中心点
            Vector3 centerPos = m_transform.position + m_transform.forward.normalized * fun.offDistance;


            //中间是否有空气墙
            Vector3 wallPos = CoreEntry.gBaseTool.GetWallHitPoint(m_transform.position, centerPos);

            if (!wallPos.Equals(centerPos))
            {
                //存在空气墙
                Vector3 dist = wallPos - m_transform.position;
                dist = dist * 0.9f;
                //Vector3 wallGroundPos = CoreEntry.gBaseTool.GetGroundPoint(m_transform.position + dist);
                centerPos = CoreEntry.gBaseTool.GetGroundPoint(centerPos);
            }

            if (centerPos.Equals(Vector3.zero))
            {
                centerPos = m_transform.position;
            }

            //需要聚集的怪物
            List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors();

            foreach (ActorObj actor in actors)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actor.gameObject) == false)
                {
                    continue;
                }

                ActorObj actorBase = actor;
                if (!m_skillBase.m_actor.IsAimActorType(actorBase))
                {
                    continue;
                }

                //伤害对象
                if (CoreEntry.gBaseTool.IsPointInCircleXZ(centerPos, actor.transform.position, fun.radius, 1f))
                {
                    //isSkillSuccess = true;

                    Vector3 distance = m_transform.position - actor.transform.position;
                    float   len      = distance.magnitude;
                    distance = m_transform.position + distance;

                    distance = CoreEntry.gBaseTool.GetGroundPoint(distance);
                    TweenPositionY.Begin(actor.gameObject, 0.6f, distance, len);
                }
            }

            StartCoroutine(destroyBox());
        }
Beispiel #4
0
        /// <summary>
        /// 获取最近的角色。
        /// </summary>
        /// <param name="objList">角色列表。</param>
        /// <param name="dis">距离限制。</param>
        /// <returns>最近的角色。</returns>
        public ActorObj GetNearestActor(List <ActorObj> objList, ref float dis, int mid = 0)
        {
            ActorObj selectActor = null;

            for (int i = 0; i < objList.Count; i++)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理 隐身或死亡状态
                ActorObj actor = objList[i];
                if (null == actor)
                {
                    continue;
                }
                if (!GameLogicMgr.checkValid(actor.gameObject) || actor.IsInStealthState(this) || actor.IsDeath())
                {
                    continue;
                }

                //PK模式的玩家对象筛选
                if (actor.mActorType == ActorType.AT_REMOTE_PLAYER || actor.mActorType == ActorType.AT_LOCAL_PLAYER || actor.mActorType == ActorType.AT_MECHANICS)
                {
                    //排除玩家自身、宠物和不可攻击的玩家
                    if (actor.mActorType != ActorType.AT_REMOTE_PLAYER || !PlayerData.Instance.IsCanAttack(actor as OtherPlayer))
                    {
                        continue;
                    }
                }

                //距离最近
                float distance = Vector3.Distance(transform.position, actor.transform.position);
                if (distance > dis)
                {
                    continue;
                }

                if ((actor is MonsterObj) && actor.IsSameCamp())
                {
                    continue;
                }

                if (mid != 0)
                {
                    if (actor.mActorType == ActorType.AT_MONSTER || actor.mActorType == ActorType.AT_BOSS)
                    {
                        MonsterObj monsterobj = actor as MonsterObj;
                        if (monsterobj.ConfigID == mid)
                        {
                            dis         = distance;
                            selectActor = actor;
                        }
                    }
                    continue;
                }

                dis         = distance;
                selectActor = actor;
            }

            return(selectActor);
        }
Beispiel #5
0
        public GameObject GetBossActorObject()
        {
            List <ActorObj> actorList = CoreEntry.gActorMgr.GetAllActors();

            for (int i = 0; i < actorList.Count; ++i)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actorList[i].gameObject) == false)
                {
                    continue;
                }
                ActorObj actorBase = actorList[i];

                if (actorBase.mActorType == ActorType.AT_BOSS)
                {
                    return(actorBase.gameObject);
                }
            }

            return(null);
        }
Beispiel #6
0
        public void PlayAllMonsterDeathAction()
        {
            List <ActorObj> actorList = CoreEntry.gActorMgr.GetAllMonsterActors();

            for (int i = 0; i < actorList.Count; ++i)
            {
                ActorObj actorBase = actorList[i];
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actorBase.gameObject) == false)
                {
                    continue;
                }
                if (actorBase.mActorType == ActorType.AT_MONSTER ||
                    actorBase.mActorType == ActorType.AT_BOSS ||
                    actorBase.mActorType == ActorType.AT_MECHANICS)
                {
                    if (!actorBase.IsDeath())
                    {
                        actorBase.ChangeState(ACTOR_STATE.AS_DEATH);
                    }
                }
            }
        }
Beispiel #7
0
 void Awake()
 {
     m_transform   = this.transform;
     m_eventMgr    = CoreEntry.gEventMgr;
     m_gameManager = CoreEntry.gGameMgr;
 }
Beispiel #8
0
        protected virtual void CalculateDamage()
        {
            // System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            //  sw.Start();
            CancelInvoke("CalculateDamage");

            bool isDamageSuccess = false;

            LuaTable skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(m_skillBase.m_skillID);

            if (skillDesc == null)
            {
                return;
            }

            if (m_skillMgr.m_bShowSkillScope)
            {
                Vector3 pos = m_skillBase.m_actor.transform.position;
                if (null == m_SkillScope)
                {
                    if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
                    {
                        if (DamageTypeID.DTID_FUN == m_oneDamageInfo.type)
                        {
                            if (m_oneDamageInfo.damageNode.funDamage.angle >= 360)
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_yuan", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }
                            else
                            {
                                m_SkillScope = WarningDecel.CreateSectorDecal("Effect/skill/remain/fx_yujing_shanxing", pos,
                                                                              m_oneDamageInfo.damageNode.funDamage.radius * 2, m_oneDamageInfo.damageNode.funDamage.angle);
                            }


                            if (m_oneDamageInfo.damageNode.funDamage.angle < 360)
                            {
                                float   ActorAngle = 0.0f;
                                Vector3 ActorAxis  = Vector3.zero;
                                m_skillBase.m_actor.transform.rotation.ToAngleAxis(out ActorAngle, out ActorAxis);
                                if (m_SkillScope != null)
                                {
                                    float angle = Mathf.Acos(Vector3.Dot(m_skillBase.m_actor.transform.forward.normalized, new Vector3(1.0f, 0f, 0f))) * Mathf.Rad2Deg;
                                    if (ActorAngle >= 90 && ActorAngle <= 270)
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, angle);
                                    }
                                    else
                                    {
                                        m_SkillScope.transform.RotateAround(pos, Vector3.up, -angle);
                                    }
                                }

                                //LogMgr.UnityLog("angle="+angle.ToString());


                                // m_SkillScope.transform.position += m_SkillScope.transform.up * 0.1f;
                            }
                        }
                        else if (DamageTypeID.DTID_RECT == m_oneDamageInfo.type)
                        {
                            m_SkillScope = WarningDecel.CreateRectangleDecal("Effect/skill/remain/fx_yujing_changfang", pos,
                                                                             m_oneDamageInfo.damageNode.rectDamage.width, m_oneDamageInfo.damageNode.rectDamage.length);
                            if (m_SkillScope != null)
                            {
                                m_SkillScope.transform.rotation  = m_skillBase.m_actor.transform.rotation;
                                m_SkillScope.transform.position += m_oneDamageInfo.damageNode.rectDamage.length / 2 * m_skillBase.m_actor.transform.forward;
                            }
                        }
                    }
                    //Invoke("HideSkillScope", m_oneDamageInfo.hitTime);
                }
            }

            //单体伤害
            if (!m_bIsAoe)
            {
                ActorObj targetObj = m_skillBase.m_actor.GetSelTarget();

                if (targetObj != null && m_skillBase.m_actor.IsSkillAim((sbyte)m_skillBase.m_skillDesc.Get <int>("faction_limit"), targetObj))
                {
                    ActorObj actorBase = targetObj;

                    //按伤害范围算出受伤害对象,具体有没有伤害,还要看对应的属性(免疫等)
                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform,
                                                                        targetObj.transform, actorBase.GetColliderRadius());

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        //damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;

                        //damageParam.behitObj = attackObj.gameObject;
                        damageParam.behitActor = actorBase;
                        damageParam.IsClient   = true;

                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actorBase.OnEnterDizzy(param);
                        }
                    }
                }
            }
            else
            {
                //计算伤害  群体
                if (m_skillBase.m_actor == null)
                {
                    return;
                }

                ActorObj actor = null;

                for (int k = 0; k < m_skillBase.m_actor.m_TargetList.Count; ++k)
                {
                    actor = CoreEntry.gActorMgr.GetActorByServerID(m_skillBase.m_actor.m_TargetList[k]);

                    if (ArenaMgr.Instance.IsArenaFight)
                    {
                        actor = CoreEntry.gActorMgr.GetPlayerActorByServerID(m_skillBase.m_actor.m_TargetList[k]);
                    }

                    if (actor == null)
                    {
                        continue;
                    }

                    //对IOS出现怪物不动 报错的异常  进行错误处理
                    if (GameLogicMgr.checkValid(actor.gameObject) == false)
                    {
                        continue;
                    }

                    {
                        isDamageSuccess = true;

                        //纠正被击表现
                        DamageParam damageParam = new DamageParam();
                        damageParam.skillID = m_skillBase.m_skillID;
                        // damageParam.attackObj = m_skillBase.m_castOwnObj;
                        damageParam.attackActor = m_skillBase.m_actor;
                        // damageParam.behitObj = obj.gameObject;
                        damageParam.behitActor        = actor;
                        damageParam.weight            = m_oneDamageInfo.resetSkillWeight;
                        damageParam.isNotUseCurveMove = m_oneDamageInfo.isNotUseCurveMove;

                        damageParam.IsClient = true;

                        CoreEntry.gSkillMgr.OnSkillDamage(damageParam);

                        //是否有眩晕效果
                        if (m_oneDamageInfo.dizzyParamDesc != null)
                        {
                            DizzyParam param = new DizzyParam();
                            param.keepTime = m_oneDamageInfo.dizzyParamDesc.keepTime;

                            actor.OnEnterDizzy(param);
                        }

                        if (isDamageSuccess && actor.mActorType == ActorType.AT_BOSS && m_skillBase.m_actor.IsMainPlayer())
                        {
                            m_isHadLoadFrameStop = true;

                            //顿帧
                            if (m_oneDamageInfo.frameStopDesc != null)
                            {
                                //GameObject frameStopObj = Instantiate(
                                //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;
                                GameObject frameStopObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.frameStopDesc.prefabPath);

                                ISkillCell skillCell = frameStopObj.GetComponent <ISkillCell>();
                                if (skillCell)
                                {
                                    skillCell.Init(m_oneDamageInfo.frameStopDesc, m_skillBase, actor);
                                    m_skillBase.AddSkillCell(frameStopObj);
                                }
                                else
                                {
                                    //没有skillcell说明,坏掉了马上清理掉
                                    Destroy(frameStopObj);
                                }
                            }
                        }
                    }
                }
            }


            LuaTable skill_action = CoreEntry.gSkillMgr.GetSkillActon(m_skillBase.m_skillID);


            string remanEfx = null;

            if (skill_action != null)
            {
                remanEfx = skill_action.Get <string>("remain");
            }


            //地表残留
            if (remanEfx.Length > 0 && m_oneDamageInfo.m_bUseRemain)
            {
                //GameObject efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);


                if (efxObj == null)
                {
                    //efxObj = (GameObject)Object.Instantiate(CoreEntry.gResLoader.LoadResource(remanEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                    efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(remanEfx);
                }


                //yy 特效和模型按等比例缩放
                //if (m_skillBase.m_actor.actorCreatureDisplayDesc.sacle > 1.0f)
                //{
                //    ParticleScaler ScaleComponet = efxObj.GetComponent<ParticleScaler>();
                //    if (ScaleComponet == null)
                //        ScaleComponet = efxObj.AddComponent<ParticleScaler>();

                //    ScaleComponet.particleScale = m_skillBase.m_actor.actorCreatureDisplayDesc.sacle;

                //}


                float maxEfxTime = 0;

                if (efxObj)
                {
                    NcCurveAnimation[] efxAnimations = efxObj.GetComponentsInChildren <NcCurveAnimation>();
                    for (int i = 0; i < efxAnimations.Length; ++i)
                    {
                        // efxAnimations[i].m_fDelayTime /= m_speed;
                        // efxAnimations[i].m_fDurationTime /= m_speed;

                        float efxTime = efxAnimations[i].m_fDelayTime + efxAnimations[i].m_fDurationTime;
                        if (efxTime > maxEfxTime)
                        {
                            maxEfxTime = efxTime;
                        }
                    }
                }

                if (skill_action != null)
                {
                    if (skill_action.Get <float>("skillEfxLength") > 0)
                    {
                        maxEfxTime = skill_action.Get <float>("skillEfxLength");
                    }

                    //特效存在时间
                    if (maxEfxTime <= 0.001)
                    {
                        maxEfxTime = m_skillBase.m_actor.GetActionLength(skill_action.Get <string>("animation"));
                    }
                }


                EfxAttachActionPool efx = efxObj.GetComponent <EfxAttachActionPool>();
                if (efx == null)
                {
                    efx = efxObj.AddComponent <EfxAttachActionPool>();
                }

                //yy test

                efx.InitRemain(m_skillBase.m_actor.transform, maxEfxTime, false);


                m_RemainEfx = efx;
            }



            //场景物件,主角破坏
            if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                for (int i = 0; i < brokedObjs.Length; ++i)
                {
                    if (brokedObjs[i] == null)
                    {
                        continue;
                    }

                    bool isSkillSuccess = m_skillMgr.IsSkillDamageRange(skillDesc.Get <int>("effect_1"), m_transform, brokedObjs[i].transform, 0.5f);

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 3;//m_skillBase.m_skillDesc.weight;
                        if (m_oneDamageInfo.resetSkillWeight > 0)
                        {
                            weight = m_oneDamageInfo.resetSkillWeight;
                        }

                        broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight);
                    }
                }
            }

            //if (isDamageSuccess && !m_isHadLoadFrameStop)
            //{
            //    m_isHadLoadFrameStop = true;

            //    //顿帧
            //    if (m_oneDamageInfo.frameStopDesc != null)
            //    {
            //        GameObject frameStopObj = Instantiate(
            //            CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.frameStopDesc.prefabPath)) as GameObject;

            //        ISkillCell skillCell = frameStopObj.GetComponent<ISkillCell>();

            //        skillCell.Init(m_oneDamageInfo.frameStopDesc,m_skillBase.m_actor);

            //        m_skillBase.AddSkillCell(frameStopObj);
            //    }

            //}

            //屏震    不是主玩家 , 就不震屏幕
            if (m_skillBase.m_actor.IsMainPlayer() || m_skillBase.m_actor.mActorType == ActorType.AT_BOSS)
            {
                if (m_oneDamageInfo.cameraShakeDesc != null)
                {
                    if (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == false ||
                        (m_oneDamageInfo.cameraShakeDesc.activeWhenHit == true && isDamageSuccess == true)
                        )
                    {
                        //GameObject cellObj = Instantiate(
                        //    CoreEntry.gResLoader.LoadResource(m_oneDamageInfo.cameraShakeDesc.prefabPath)) as GameObject;

                        GameObject cellObj = CoreEntry.gGameObjPoolMgr.InstantiateSkillCell(m_oneDamageInfo.cameraShakeDesc.prefabPath);
                        cellObj.transform.parent = transform;

                        // m_oneDamageInfo.cameraShakeDesc.playTime = m_oneDamageInfo.hitTime;

                        ISkillCell skillCell = cellObj.GetComponent <ISkillCell>();
                        skillCell.Init(m_oneDamageInfo.cameraShakeDesc, m_skillBase);

                        m_skillBase.AddSkillCell(cellObj);
                    }
                }
            }



            //是否持续伤害
            if (m_oneDamageInfo.isRepeatedly && m_repeateKeep > 0)
            {
                Invoke("CalculateDamage", m_oneDamageInfo.damageDiff / m_skillBase.m_speed);
                --m_repeateKeep;
            }

            // sw.Stop();
            if (m_skillBase.m_actor.IsLocalPlayer())
            {
                // Debug.LogError("3....." + sw.ElapsedMilliseconds + "毫秒.....");
            }
        }
Beispiel #9
0
        void CalculateDamage()
        {
            CancelInvoke("CalculateDamage");

            OneCurveDamageInfo curveInfo = m_curveDamageCellDesc.curveDamageInfoList[m_curIndex];

            //旋转偏移
            m_transform.Rotate(Vector3.up, curveInfo.offsetAngle * Mathf.Deg2Rad);

            //debug
#if UNITY_EDITOR
            GameObject efxObj = Instantiate(
                CoreEntry.gResLoader.LoadResource("Skill/Cube")) as GameObject;
            efxObj.transform.position = m_transform.position;
            efxObj.transform.rotation = m_transform.rotation;
            efxObj.name = m_curIndex.ToString();

            SceneEfx efx = efxObj.AddComponent <SceneEfx>();
            efx.Init(m_transform.position, 5);
#endif

            //计算伤害monster
            System.Collections.Generic.List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors();
            foreach (ActorObj obj in actors)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(obj.gameObject) == false)
                {
                    continue;
                }
                ActorObj actorBase = obj;

                //临时判断
                if (actorBase.mActorType == m_skillBase.m_actor.mActorType)
                {
                    continue;
                }


                if (!CoreEntry.gGameMgr.IsPvpState() && !m_skillBase.m_actor.IsAimActorType(actorBase))
                {
                    continue;
                }

                bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position,
                                                                             m_transform.rotation.eulerAngles, curveInfo.damageLength,
                                                                             curveInfo.damageWidth, obj.transform.position);

                //伤害对象
                if (isSkillSuccess)
                {
                    //纠正被击表现
                    DamageParam damageParam = new DamageParam();
                    damageParam.skillID     = m_skillBase.m_skillID;
                    damageParam.attackActor = m_skillBase.m_actor;
                    damageParam.behitActor  = actorBase;

                    CoreEntry.gSkillMgr.OnSkillDamage(damageParam);
                }
            }

            //场景物件,主角破坏
            if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
            {
                GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray;
                for (int i = 0; i < brokedObjs.Length; ++i)
                {
                    bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position,
                                                                                 m_transform.rotation.eulerAngles, curveInfo.damageLength,
                                                                                 curveInfo.damageWidth, brokedObjs[i].transform.position);

                    //伤害对象
                    if (isSkillSuccess)
                    {
                        Broked broked = brokedObjs[i].GetComponent <Broked>();
                        int    weight = 3;//m_skillBase.m_skillDesc.weight;

                        broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight);
                    }
                }
            }

            if (m_curIndex < m_curveDamageCellDesc.curveDamageInfoList.Count - 1)
            {
                m_curIndex++;

                //设置位置
                m_transform.position += m_transform.forward.normalized * curveInfo.length;

                Invoke("CalculateDamage", m_curveDamageCellDesc.curveDamageInfoList[m_curIndex].hitTime);
            }
        }
Beispiel #10
0
        //class objectMoveInfo
        //{
        //    public GameObject obj;
        //    public Vector3 srcPos;
        //};

        void DoFocusAction()
        {
            //计算位移距离
            FunDamageNode fun = m_oneDamageInfo.damageNode.funDamage;

            //聚怪中心点
            Vector3 centerPos = m_transform.position + m_transform.forward.normalized * fun.offDistance;

            //中间是否有空气墙
            Vector3 wallPos = CoreEntry.gBaseTool.GetWallHitPoint(m_transform.position, centerPos);

            if (!wallPos.Equals(centerPos))
            {
                //存在空气墙
                Vector3 dist = wallPos - m_transform.position;
                dist = dist * 0.9f;
                //Vector3 wallGroundPos = CoreEntry.gBaseTool.GetGroundPoint(m_transform.position + dist);
                centerPos = CoreEntry.gBaseTool.GetGroundPoint(centerPos);
            }

            if (centerPos.Equals(Vector3.zero))
            {
                centerPos = m_transform.position;
            }

            //需要聚集的怪物
            List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors();

            for (int i = 0; i < actors.Count; i++)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actors[i].gameObject) == false)
                {
                    continue;
                }
                GameObject obj       = actors[i].gameObject;
                ActorObj   actorBase = actors[i];


                //塔不没有受击
                MonsterObj monsterObj = obj.GetComponent <MonsterObj>();
                if (monsterObj && monsterObj.m_bIsTower)
                {
                    continue;
                }

                //bool isSkillSuccess = false;

                if (!m_skillBase.m_actor.IsAimActorType(actorBase))
                {
                    continue;
                }

                // 有霸体的不能被拉动
                if (actorBase.IsActorEndure())
                {
                    continue;
                }

                //伤害对象
                if (CoreEntry.gBaseTool.IsPointInCircleXZ(centerPos, obj.transform.position, fun.radius, 1f))
                {
                    //isSkillSuccess = true;
                    Go.to(obj.transform, 0.4f, new GoTweenConfig().position(centerPos));
                }
            }

            StartCoroutine(destroyBox());
        }
Beispiel #11
0
        public static void CoreInit()
        {
            //设置横屏显示
            Screen.orientation = ScreenOrientation.AutoRotation;
            Screen.autorotateToLandscapeLeft      = true;
            Screen.autorotateToLandscapeRight     = true;
            Screen.autorotateToPortrait           = false;
            Screen.autorotateToPortraitUpsideDown = false;

            //所有全局组件挂在CoreRoot对象下,CoreRoot对象被设为加载场景时不被删除,保证它的全局存在
            //GameObject go = new GameObject("CoreRoot");



            if (m_baseTool == null)
            {
                m_baseTool = CoreRootObj.AddComponent <BaseTool>();
            }

            //    if (    m_teamMgr   ==null )
            //m_teamMgr = CoreRootObj.AddComponent<TeamMgr>();

            //         if (m_challengeTeamManager == null)
            //         m_challengeTeamManager = CoreRootObj.AddComponent<ChallengeTeamManager>();

            if (m_skillMgr == null)
            {
                m_skillMgr = CoreRootObj.AddComponent <SkillMgr>();
            }

            //if (m_skillComboMgr == null)
            //    m_skillComboMgr = CoreRootObj.AddComponent<SkillComboMgr>();

            if (m_gameDBMgr == null)
            {
                m_gameDBMgr = CoreRootObj.AddComponent <GameDBMgr>();
            }


            if (m_objPoolMgr == null)
            {
                m_objPoolMgr = CoreRootObj.AddComponent <ObjectPoolManager>();
            }

            if (m_GameObjPoolMgr == null)
            {
                m_GameObjPoolMgr = CoreRootObj.AddComponent <GameObjPoolMgr>();
            }

            if (m_behaviacSys == null)
            {
                m_behaviacSys = CoreRootObj.AddComponent <BehaviacSystem>();
            }

            if (m_gameMgr == null)
            {
                m_gameMgr = CoreRootObj.AddComponent <GameLogicMgr>();
            }

            if (eventTouchMono == null)
            {
                eventTouchMono = CoreRootObj.AddComponent <EventTouchMono>();
            }

            //        TaskMgr task = TaskMgr.Instance;
            //        NpcMgr npc = NpcMgr.Instance;
            //        DungeonMgr dungeon = DungeonMgr.Instance;
            if (null == m_sceneObjMgr)
            {
                m_sceneObjMgr = CoreRootObj.AddComponent <SceneObjMgr>();
            }
            MoveDispatcher.Instance.Init();

            if (null == m_morphMgr)
            {
                m_morphMgr = CoreRootObj.AddComponent <MorphMgr>();
            }
        }
Beispiel #12
0
        protected void NextAim()
        {
            hitCount--;
            if (hitCount <= 0)
            {
                AutoEnd();
                return;
            }

            ActorObj aimActorBase = null;

            List <ActorObj> AIMList     = new List <ActorObj>();
            List <ActorObj> noDIZZYList = new List <ActorObj>();

            // 下一个目标
            //计算伤害  群体
            List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors();

            for (int i = 0; i < actors.Count; i++)
            {
                //对IOS出现怪物不动 报错的异常  进行错误处理
                if (GameLogicMgr.checkValid(actors[i].gameObject) == false)
                {
                    continue;
                }
                GameObject obj       = actors[i].gameObject;
                ActorObj   actorBase = actors[i];

                //临时判断
                ActorObj castBase = m_param.castObj.GetComponent <ActorObj>();
                if (actorBase.mActorType == castBase.mActorType)
                {
                    continue;
                }

                if (actorBase.IsDeath())
                {
                    continue;
                }

                if (!CoreEntry.gGameMgr.IsPvpState() && !castBase.IsAimActorType(actorBase))//IsAimActorType(actorBase.mActorType))
                {
                    continue;
                }

                if (obj.transform == m_aimTransform) // 跳过自己
                {
                    continue;
                }

                // 栅栏怪等建筑物不可以被击退,击飞,聚集,眩晕
                //if (actorBase.actorCreatureInfo.behitMoveBase == 0 && actorBase.actorCreatureInfo.behitBackBase == 0 && actorBase.actorCreatureInfo.behitFlyBase == 0)
                //{
                //    continue;
                //}

                // 距离
                if (m_aimTransform == null)
                {
                    if (!CoreEntry.gBaseTool.IsPointInCircleXZ(m_param.castObj.transform.position, actorBase.transform.position,
                                                               m_param.TanTanLeDis, actorBase.GetColliderRadius()))
                    {
                        continue;
                    }
                }
                else
                if (!CoreEntry.gBaseTool.IsPointInCircleXZ(m_aimTransform.transform.position, actorBase.transform.position,
                                                           m_param.TanTanLeDis, actorBase.GetColliderRadius()))
                {
                    continue;
                }

                AIMList.Add(actorBase);

                if (actorBase.curActorState != ACTOR_STATE.AS_DIZZY)
                {
                    noDIZZYList.Add(actorBase);
                }

                if (aimActorBase == null)
                {
                    aimActorBase = actorBase;
                    continue;
                }
            }

            // 在没有眩晕的怪之间随机
            if (noDIZZYList.Count > 0)
            {
                aimActorBase = noDIZZYList[Random.Range(0, noDIZZYList.Count)];
            }
            else
            // 在眩晕的怪之间随机
            if (AIMList.Count > 0)
            {
                aimActorBase = AIMList[Random.Range(0, AIMList.Count)];
            }

            if (aimActorBase != null)
            {
                m_aimTransform = aimActorBase.transform;

                if (objEfx != null)
                {
                    objEfx.SetActive(true);
                }

                if (GetComponent <Collider>() != null)
                {
                    GetComponent <Collider>().enabled = false;
                    GetComponent <Collider>().enabled = true;
                }
            }
            else
            {
                AutoEnd(); // 没有目标就消失了
            }
        }