コード例 #1
0
ファイル: GuideStructure_Leaf.cs プロジェクト: zwong91/Titan
        protected override int onExecute(TBTWorkingData wData)
        {
            int runningState = TBTRunningStatus.USER_EXECUTING;

            if (EntityFactory.MainHeroView == null || !EntityFactory.MainHeroView.IsValid)
            {
                return(runningState);
            }

            GuideWorkingData gData = wData as GuideWorkingData;

            List <EntityView> AroundEntitiesList = MapFinderManager.Nearest(EntityFactory.MainHeroView.StateMachine.transform.position, m_nSearchNearRadius, m_eCampFlag).ToList();

            if (AroundEntitiesList != null)
            {
                for (int i = AroundEntitiesList.Count - 1; i >= 0; i--)
                {
                    if (AroundEntitiesList[i].Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID) != m_nPropertyID)
                    {
                        AroundEntitiesList.RemoveAt(i);
                    }
                }

                //检测附近范围内有没有敌人
                runningState = AroundEntitiesList.Count == 0 ? TBTRunningStatus.USER_EXECUTING : TBTRunningStatus.USER_FINISHED;
            }


            return(runningState);
        }
コード例 #2
0
        void EnterTower(EntityView ev)
        {
            if (m_nearTowerID != ev.ID)
            {
                m_TowerEV      = ev;
                m_nearTowerID  = ev.ID;
                m_nearTowerPos = ev.gameObject.transform.position;

                m_soldierCount = 0;
                IList <U3D_Render.EntityView> enemyList = MapFinderManager.Nearest(m_nearTowerPos, TowerStrikingDistance, SPELL.CampFlag.CampFlag_Friend);
                foreach (EntityView entity in enemyList)
                {
                    if (entity.Property != null && entity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SEX) == (int)MONSTER_TYPE.MONSTER_TYPE_COMMON)
                    {
                        if (entity.StateMachine != null && entity.StateMachine.GetState() != GameLogic.EntityState.Dead)
                        {
                            float dis = Vector3.SqrMagnitude(entity.gameObject.transform.position - m_TowerEV.gameObject.transform.position);
                            if (dis <= TowerStrikingDistance * TowerStrikingDistance)
                            {
                                m_soldierCount++;
                            }
                        }
                    }
                }

                UWarTowerSoldierMsgData data = new UWarTowerSoldierMsgData(true, m_soldierCount);
                UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WARTOWER_UPDATE, data);
            }
        }
コード例 #3
0
ファイル: GuideStructure_Leaf.cs プロジェクト: zwong91/Titan
        protected override int onExecute(TBTWorkingData wData)
        {
            int runningState = TBTRunningStatus.USER_EXECUTING;

            if (EntityFactory.MainHeroView == null || !EntityFactory.MainHeroView.IsValid)
            {
                return(runningState);
            }

            GuideWorkingData gData = wData as GuideWorkingData;

            IList <EntityView> AroundEntitiesList = MapFinderManager.Nearest(EntityFactory.MainHeroView.StateMachine.transform.position, m_nSearchNearRadius, SPELL.CampFlag.CampFlag_Enemy);

            //检测附近范围内有没有敌人
            runningState = AroundEntitiesList.Count == 0 ? TBTRunningStatus.USER_EXECUTING : TBTRunningStatus.USER_FINISHED;

            if (runningState == TBTRunningStatus.USER_FINISHED && !m_bDoOnce)
            {//有敌人则记录并显示UI
                m_bDoOnce = true;
                USpeedUI.UGuideMsgData msg = new USpeedUI.UGuideMsgData(m_strTextParam, gData.GuideCurrentNode, m_nSpriteParam);
                USpeedUI.UISystem.Instance.SendWndMessage(USpeedUI.WndMsgID.WND_MSG_GAMEGUIDE_ADDNODEMESSAGE, msg);
            }

            return(runningState);
        }
コード例 #4
0
ファイル: GuideStructure_Con.cs プロジェクト: zwong91/Titan
        protected override bool CustomPrecondition(TBTWorkingData wData)
        {
            bool result = false;

            if (EntityFactory.MainHeroView == null || !EntityFactory.MainHeroView.IsValid)
            {
                return(result);
            }

            GuideWorkingData gData = wData as GuideWorkingData;

            List <EntityView> AroundEntitiesList = MapFinderManager.Nearest(EntityFactory.MainHeroView.StateMachine.transform.position, m_nSearchNearRadius, m_eCampFlag).ToList();

            if (AroundEntitiesList != null)
            {
                for (int i = AroundEntitiesList.Count - 1; i >= 0; i--)
                {
                    if (AroundEntitiesList[i].Property == null || AroundEntitiesList[i].Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID) != m_nPropertyID)
                    {
                        AroundEntitiesList.RemoveAt(i);
                    }
                }

                //检测附近范围内有没有实体
                result = AroundEntitiesList.Count != 0;
            }

            return(result);
        }
コード例 #5
0
        protected void SearchNearestEntity(EntityView _ev, out List <EntityView> _entityList)
        {
            switch (m_eChooseTargetType)
            {
            case SHOW_CHOOSE_TARGET_TYPE.SHOW_CHOOSE_TARGET_TYPE_HERO_ENEMY:
            {
                _entityList = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Enemy) as List <EntityView>;
            }
            break;

            case SHOW_CHOOSE_TARGET_TYPE.SHOW_CHOOSE_TARGET_TYPE_HERO_SELF:
            {
                _entityList = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Friend) as List <EntityView>;
            }
            break;

            case SHOW_CHOOSE_TARGET_TYPE.SHOW_CHOOSE_TARGET_TYPE_HERO:
            {
                List <EntityView> tmpList = null;

                tmpList     = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Enemy) as List <EntityView>;
                _entityList = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Friend) as List <EntityView>;

                _entityList.AddRange(tmpList);
            }
            break;

            case SHOW_CHOOSE_TARGET_TYPE.SHOW_CHOOSE_TARGET_TYPE_HERO_SELF_EXCLUDE_SELF:
            {
                _entityList = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Friend) as List <EntityView>;

                if (_entityList.Contains(EntityFactory.MainHeroView))
                {
                    _entityList.Remove(EntityFactory.MainHeroView);
                }
            }
            break;

            case SHOW_CHOOSE_TARGET_TYPE.SHOW_CHOOSE_TARGET_TYPE_HERO_EXCLUDE_SELF:
            {
                List <EntityView> tmpList = null;

                tmpList     = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Enemy) as List <EntityView>;
                _entityList = MapFinderManager.Nearest(_ev.StateMachine.transform.position, SearchNearPlayerRadius, SPELL.CampFlag.CampFlag_Friend) as List <EntityView>;

                _entityList.AddRange(tmpList);

                if (_entityList.Contains(EntityFactory.MainHeroView))
                {
                    _entityList.Remove(EntityFactory.MainHeroView);
                }
            }
            break;

            default:
                _entityList = null;
                break;
            }
        }
コード例 #6
0
ファイル: WarOBDataManager.cs プロジェクト: zwong91/Titan
        private void Entity_LeaveView(EntityView ev)
        {
            if (ev == null || ev.StateMachine == null)
            {
                return;
            }

            ev.StateMachine.OnLeaveView();
            MapFinderManager.RemoveObject(ref ev);
            LogicDataCenter.warMinimapDataManager.UpdateObjectVisiblity(ev);
        }
コード例 #7
0
ファイル: WarOBDataManager.cs プロジェクト: zwong91/Titan
        private void Entity_EnterView(EntityView ev)
        {
            if (ev == null || ev.StateMachine == null)
            {
                return;
            }

            ev.StateMachine.OnEnterView();
            MapFinderManager.InsertObject(ref ev, ev.gameObject.transform.position);
            if (ev.StateMachine.GetState() != EntityState.Dead)
            {
                LogicDataCenter.warMinimapDataManager.UpdateObjectVisiblity(ev);
            }
        }
コード例 #8
0
    protected void checkFlyEncounter()
    {
        U3D_Render.EntityView mainHero = EntityFactory.MainHeroView;
        if (mainHero == null)
        {
            return;
        }

        if (mainHero.StateMachine == null)
        {
            return;
        }

        IList <U3D_Render.EntityView> enemyList = MapFinderManager.Nearest(mainHero.StateMachine.transform.position, nFlyEncounterDistance, SPELL.CampFlag.CampFlag_Enemy);

        if (enemyList == null)
        {
            return;
        }

        foreach (U3D_Render.EntityView ev in enemyList)
        {
            if (ev == null || ev.StateMachine == null)
            {
                continue;
            }

            if (ev.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE && ev.StateMachine.GetState() != GameLogic.EntityState.Dead)
            {
                // 请求降落
                cmd_creature_set_wing_state data;
                data.nType          = WING_STATE_TYPE.WING_STATE_FLOOR;
                data.nEncounterFlag = 1;

                IntPtrHelper helper = new IntPtrHelper();
                IntPtr       ptr    = helper.toPtr <cmd_creature_set_wing_state>(ref data);
                int          len    = Marshal.SizeOf(data);
                GameLogicAPI.onEntityEvent(EntityFactory.MainHeroID, (int)EntityLogicDef.ENTITY_CMD_SET_WING_STATE, len, "", ptr, len);

                // 关闭定时器
                // onFlyStateChange(false, nFlyEncounterDistance);

                return;
            }
        }
    }
コード例 #9
0
        public void SaveAroundPlayer()
        {
            EntityView ev = EntityFactory.getMainPlayer();

            if (ev == null)
            {
                return;
            }
            List <Int32>       TmpEntityIDList    = new List <int>(RangeActivityEntity.Keys);
            IList <EntityView> AroundEntitiesList = MapFinderManager.Nearest(ev.StateMachine.transform.position, ev.Sight, m_showAround);

            if (AroundEntitiesList == null)
            {
                return;
            }

            Int32 nTmpEntityID = 0;

            foreach (EntityView Entity_Ev in AroundEntitiesList)
            {
                if (Entity_Ev == null ||
                    Entity_Ev.StateMachine == null ||
                    EntityFactory.MainHeroView == null ||
                    EntityFactory.MainHeroView.ID == Entity_Ev.ID ||
                    Entity_Ev.StateMachine.GetState() == GameLogic.EntityState.Dead ||
                    Entity_Ev.Type != ENTITY_TYPE.TYPE_PLAYER_ROLE)
                {
                    continue;
                }
                nTmpEntityID = Entity_Ev.ID;
                if (!RangeActivityEntity.ContainsKey(nTmpEntityID))
                {
                    RangeActivityEntity.Add(nTmpEntityID, Entity_Ev);
                }
                else
                {
                    TmpEntityIDList.Remove(nTmpEntityID);
                }
            }
            while (TmpEntityIDList.Count > 0)
            {
                nTmpEntityID = TmpEntityIDList[0];
                RangeActivityEntity.Remove(nTmpEntityID);
                TmpEntityIDList.RemoveAt(0);
            }
        }
コード例 #10
0
        void UpdateNearTowerSoldier()
        {
            m_towerSoldierCheckTimer += Time.deltaTime;
            if (m_towerSoldierCheckTimer >= TowerSoldierCheckTime)
            {
                m_towerSoldierCheckTimer = 0f;

                if (m_nearTowerID > 0)
                {
                    if (m_TowerEV == null || m_TowerEV.gameObject == null)
                    {
                        m_nearTowerID  = -1;
                        m_nearTowerPos = Vector3.one;
                        m_soldierCount = 0;
                        UWarTowerSoldierMsgData msgData = new UWarTowerSoldierMsgData(false, m_soldierCount);
                        UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WARTOWER_UPDATE, msgData);
                        return;
                    }

                    m_nearTowerPos = m_TowerEV.gameObject.transform.position;
                    m_soldierCount = 0;
                    IList <U3D_Render.EntityView> enemyList = MapFinderManager.Nearest(m_nearTowerPos, TowerStrikingDistance, SPELL.CampFlag.CampFlag_Friend);
                    foreach (EntityView entity in enemyList)
                    {
                        if (entity.Property != null && entity.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SEX) == (int)MONSTER_TYPE.MONSTER_TYPE_COMMON)
                        {
                            if (entity.StateMachine != null && entity.StateMachine.GetState() != GameLogic.EntityState.Dead)
                            {
                                float dis = Vector3.SqrMagnitude(entity.gameObject.transform.position - m_TowerEV.gameObject.transform.position);
                                if (dis <= TowerStrikingDistance * TowerStrikingDistance)
                                {
                                    m_soldierCount++;
                                }
                            }
                        }
                    }

                    UWarTowerSoldierMsgData data = new UWarTowerSoldierMsgData(true, m_soldierCount);
                    UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WARTOWER_UPDATE, data);
                }
            }
        }
コード例 #11
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 发送一次位置同步
    public void Send_Sync_Position(MoveSyncFlag reportToSever)
    {
        if (m_pFSM == null)
        {
            Trace.LogError("CreatureState_Standing.cs Send_Sync_Position m_pFSM == null");
            return;
        }

        //如果上报位置范围不对,则输出至LOG,退出
        if (float.IsNaN(m_pFSM.syncPosition.x) || float.IsNaN(m_pFSM.syncPosition.y) || float.IsNaN(m_pFSM.syncPosition.z) || Math.Abs(m_pFSM.syncPosition.x) > SceneManager.MAX_SCENE_SIZE || Math.Abs(m_pFSM.syncPosition.y) > SceneManager.MAX_SCENE_SIZE || Math.Abs(m_pFSM.syncPosition.z) > SceneManager.MAX_SCENE_SIZE)
        {
            Debug.LogError(m_pFSM.name + " standing Send_Sync_Position Position Error " + m_pFSM.syncPosition);
            return;
        }


        cmd_creature_rigidbody_sync data = new cmd_creature_rigidbody_sync();

        data.nCreatureState = (int)EntityState.WallWalking;
        data.fPosition_x    = m_pFSM.syncPosition.x;
        data.fPosition_y    = m_pFSM.syncPosition.y;
        data.fPosition_z    = m_pFSM.syncPosition.z;

        // 直接用欧拉角
        data.fRotation_x = m_pFSM.syncAngle.x;
        data.fRotation_y = m_pFSM.syncAngle.y;
        data.fRotation_z = m_pFSM.syncAngle.z;

        data.fVelocity_x = m_pFSM.syncVelocity.x;
        data.fVelocity_y = m_pFSM.syncVelocity.y;
        data.fVelocity_z = m_pFSM.syncVelocity.z;
        data.nSyn2Server = (int)reportToSever;

        EntityEventHelper.Instance.SendCommand <cmd_creature_rigidbody_sync>(m_pFSM.entityID, EntityLogicDef.ENTITY_CMD_SET_POS, ref data);

        if (tr == null)
        {
            Trace.LogError("CreatureState_Standing.cs Send_Sync_Position tr == null");
            return;
        }

        if (tr.position == null)
        {
            Trace.LogError("CreatureState_WallWalking.cs Send_Sync_Position tr.SetPosition== null");
            return;
        }

        if (tr.rotation == null)
        {
            Trace.LogError("CreatureState_WallWalking.cs Send_Sync_Position tr.rotation == null");
            return;
        }

        if (tr.rotation.eulerAngles == null)
        {
            Trace.LogError("CreatureState_WallWalking.cs Send_Sync_Position tr.rotation.eulerAngles == null");
            return;
        }

        EntityBatchCommunicator.SendEntityPro(m_pFSM.entityID, tr.position, tr.rotation.eulerAngles);

        if (m_pFSM.isHero)
        {
            U3D_Render.EntityView ev = EntityFactory.getPlayerViewByID(m_pFSM.entityID);
            MapFinderManager.MoveObject(ref ev, tr.position);
        }
    }
コード例 #12
0
    Dictionary <U3D_Render.EntityView, bool> dicMonsterBlood = new Dictionary <U3D_Render.EntityView, bool>();  // true代表已经变色
    // 判断小怪血条颜色是否需要改变,此功能目前关闭
    public void monsterBloodIsChange()
    {
        if (GameLogicAPI.isMainMap(SceneManager.Instance.getCurrentMapId()))
        {
            return;
        }

        U3D_Render.EntityView mainHero = EntityFactory.MainHeroView;
        if (mainHero == null)
        {
            return;
        }

        int nDistance       = GameLogicConfigApi.MonsterDistance;
        int nTowerDisatance = GameLogicConfigApi.TowerDistance;

        IList <U3D_Render.EntityView> monster_Entities = MapFinderManager.Nearest(mainHero.StateMachine.transform.position, nDistance, SPELL.CampFlag.CampFlag_Enemy);

        if (monster_Entities == null)
        {
            return;
        }

        // 恢复那些变色
        recoverBloodColor(monster_Entities, mainHero);
        foreach (U3D_Render.EntityView ev in monster_Entities)
        {
            if (ev.Flag != (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_SOLDIER || !ev.IsValid || ev.gameObject == null)
            {
                continue;
            }

            if (CheckDistance(ev, mainHero, nDistance) == false)
            {
                continue;
            }

            //IList<U3D_Render.EntityView> tower_Entities = MapFinderManager.Nearest(ev.StateMachine.transform.position, nTowerDisatance, SPELL.CampFlag.CampFlag_Self);
            //if (tower_Entities == null )
            //{
            //    Trace.LogWarning("tower_Entities = " + tower_Entities);
            //    continue;
            //}

            //if (tower_Entities.Count == 0)
            //{
            //    Trace.LogWarning("tower_Entities.Count = " + tower_Entities.Count);
            //    continue;
            //}


            //bool bIsHaveTower = false;
            //foreach (U3D_Render.EntityView tower_ev in tower_Entities)
            //{
            //    if (tower_ev.Flag != (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER)
            //    {
            //        Trace.LogWarning("tower_ev.Flag = " + tower_ev.Flag);
            //        continue;
            //    }
            //    if (CheckDistance(ev, tower_ev, nTowerDisatance) == false)
            //    {
            //        Trace.LogWarning("tower_ev = " + tower_ev + ", nTowerDisatance = " + nTowerDisatance );
            //        continue;
            //    }

            //    bIsHaveTower = true;
            //    break;
            //}

            // 设置怪物的颜色   临时注释之后要找原因
            bool bIsHaveTower = false;
            setShowBloodColor(bIsHaveTower, ev);
        }
    }
コード例 #13
0
ファイル: MonsterState_Dead.cs プロジェクト: zwong91/Titan
    public void addMonsterEffect(U3D_Render.EntityView dieEv, ulong uMurderID)
    {
        if (dieEv == null || dieEv.CampFlag != SPELL.CampFlag.CampFlag_Enemy || !CheckMonsterType(dieEv))
        {
            return;
        }

        U3D_Render.EntityView mainEv = EntityFactory.getMainPlayer();

        if (mainEv == null || mainEv.StateMachine.GetState() == GameLogic.EntityState.Dead)
        {
            return;
        }

        Vector3 monsterLoc = dieEv.gameObject.transform.position;
        Vector3 heroLoc    = mainEv.gameObject.transform.position;

        int  effectCount         = 0;
        bool needPlayMoneyEffect = false;
        //根据死亡对象类型控制光效数量
        int    vocationID   = dieEv.createinfo.nHeroID;
        string dieEffectMsg = "";
        IntPtr strPtr       = GameLogicAPI.toCoinLighting(vocationID, (int)ENTITY_TYPE.TYPE_MONSTER);

        if (strPtr != null)
        {
            dieEffectMsg = IntPtrHelper.Ptr2Str(strPtr);
        }
        if (dieEffectMsg.Contains(GameLogicConfigApi.MoneyEffect.ToString()))
        {
            needPlayMoneyEffect = true;
        }

        if ((ulong)mainEv.ID == uMurderID && GameLogicAPI.isInWarScene() != 0)
        {
            //如果是怪物类型
            if (dieEv.Type == ENTITY_TYPE.TYPE_MONSTER)
            {
                //中立野怪
                //if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_WILD_MONSTER == dieEv.Flag)
                effectCount = 3;    //小兵和野怪都是3个
            }
            else if (dieEv.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE)
            {
                effectCount = 6;    //英雄6个
            }

            if (effectCount > 0 && needPlayMoneyEffect)
            {
                LightingEffectBehavior moneyEff = EffectHelper.PlayAndReturnEffect(ref mainEv, GameLogicConfigApi.MoneyEffect, mainEv.ID, mainEv.ID, monsterLoc, 0, 2);
                if (moneyEff != null)
                {
                    LightingEffectBehavior_Area effect = (LightingEffectBehavior_Area)moneyEff;
                    effect.SetEffectCount(effectCount);
                }
            }
            LightingEffectBehavior deadEff = EffectHelper.PlayAndReturnEffect(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, dieEv.ID, monsterLoc, 0, 2);
            return;
        }

        int nMonsterDistance = GameLogicConfigApi.MonsterDistance;
        int nTowerDistance   = GameLogicConfigApi.TowerDistance;

        if ((monsterLoc - heroLoc).sqrMagnitude > (nMonsterDistance * nMonsterDistance))
        {
            return;
        }

        IList <U3D_Render.EntityView> monster_Entities = MapFinderManager.Nearest(monsterLoc, /*nTowerDistance*/ nMonsterDistance, SPELL.CampFlag.CampFlag_Self);

        if (monster_Entities == null)
        {
            return;
        }

        int   nMainID = 0;
        float fMinDis = 0.0f;

        foreach (U3D_Render.EntityView monsterEv in monster_Entities)
        {
            if (HeroDistanceMgr.CheckDistance(dieEv, monsterEv, nMonsterDistance) == false || monsterEv == null)
            {
                continue;
            }

            if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER == monsterEv.Flag)
            {
                //return;
            }
            else if (ENTITY_TYPE.TYPE_PLAYER_ROLE == monsterEv.Type)
            {
                float fEntityDistance = (monsterLoc - monsterEv.gameObject.transform.position).sqrMagnitude;
                if (fMinDis == 0 || fEntityDistance < fMinDis)
                {
                    fMinDis = fEntityDistance;
                    nMainID = monsterEv.ID;
                }
            }
        }

        U3D_Render.EntityView view = EntityFactory.getEntityViewByID((int)uMurderID);

        if (nMainID == mainEv.ID && (ulong)nMainID != uMurderID && (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER != view.Flag)
        {
            if ((view.InitMaskFlag & (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) != (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT)
            {
                EffectHelper.Play(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, mainEv.ID, monsterLoc);
            }
        }
    }
コード例 #14
0
ファイル: MonsterState_Dead.cs プロジェクト: zwong91/Titan
    // 进入状态
    public bool OnEnter(IntPtr lParam)
    {
        //if (m_pFSM.animator)
        //{
        //    m_pFSM.animator.SetTrigger("BreakAttack");
        //    m_pFSM.animator.SetBool("isDead", true);
        //   m_pFSM.animator.Play("Dead");

        //}

        cmd_creature_die cmdDie    = IntPtrHelper.toData <cmd_creature_die>(lParam);
        ulong            uMurderID = cmdDie.uMurderID;

        m_pFSM.SetAnimatorTrigger("BreakAttack");
        m_pFSM.SetAnimatorBool("isDead", true);
        m_pFSM.AnimatorPlay("Dead");
        m_pFSM.outLineCount = m_pFSM.outLineCount - 1;
        m_pFSM.setHightLight(false);

        //关闭死亡时要求关闭的光效
        LightingEffectManager light = m_pFSM.GetComponent <LightingEffectManager>();

        if (light)
        {
            light.CloseLightingWhenDead();
        }

        ////暂时让角色死亡不让射线检测该层
        //nOldLayer = m_pFSM.gameObject.layer;
        //GameUtil.SetLayer(LayerMask.NameToLayer(Config.LayerNeutrality), m_pFSM.gameObject, true);

        //if (m_pFSM.SkinConfig)
        //{
        //    if (m_pFSM.SkinConfig.ScreenCastObject)
        //    {
        //        m_pFSM.SkinConfig.ScreenCastObject.layer = LayerMask.NameToLayer(Config.LayerPlayerFriend);
        //    }

        //}
        //else
        //{
        //    Debug.Log(m_pFSM.entityID.ToString());
        //}

        if (m_pFSM.SkinConfig != null && m_pFSM.SkinConfig.ColliderShape != null)
        {
            m_pFSM.SkinConfig.ColliderShape.enabled = false;
        }
        m_pFSM.pickableCount--;

        //GfxBloodManager.OnEntityDead(m_pFSM.entityID,ENTITY_TYPE.TYPE_MONSTER);
        USpeedUI.Blood.UBloodManager.Instance.OnEntityDead(m_pFSM.entityID, ENTITY_TYPE.TYPE_MONSTER);
        //TopNameManager.OnEntityDead(m_pFSM.entityID, ENTITY_TYPE.TYPE_MONSTER);
        isOnThisState      = true;
        MaxDeadTimeCounter = 0.0f;

        int nEntityID = m_pFSM.entityID;

        U3D_Render.EntityView ev = EntityFactory.getMonsterViewByID(nEntityID);
        addMonsterEffect(ev, uMurderID);

        //死亡通知引导,死亡时间不确定,目前只想到在这硬编码了
        if (ev.CampFlag == SPELL.CampFlag.CampFlag_Enemy && ev.Type == ENTITY_TYPE.TYPE_MONSTER && ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SEX) == (int)MONSTER_TYPE.MONSTER_TYPE_TOWER)
        {
            GUIDE.GuideManager.Instance.SetBBValue(GUIDE.EGuideBBKey.DeadEntityID, ev.ID);
        }

        if (ev != null)
        {
            MapFinderManager.RemoveObject(ref ev);
        }

        return(true);
    }
コード例 #15
0
ファイル: MouseCtrl.cs プロジェクト: zwong91/Titan
    //插旗
    public void DoMouseAttachFunc(float xPos, float yPos, float zPos)
    {
        int targetID = 0;

        if (isAttackSign(m_currentAttachType) || m_currentAttachType == MouseAttachFuncType.RetreatSign)
        {
            if (raycast.targetID > 0)
            {
                EntityView evTarget = EntityFactory.getEntityViewByID(raycast.targetID);
                if (evTarget != null && IsValidMapSignalTarget(evTarget))
                {
                    targetID = raycast.targetID;
                }
            }

            if (targetID == 0)
            {
                Vector3            hitPoint = new Vector3(xPos, yPos, zPos);
                IList <EntityView> list     = MapFinderManager.Nearest(hitPoint, 24, SPELL.CampFlag.CampFlag_Unknow);
                if (list != null)
                {
                    float      curDistance = float.MaxValue;
                    EntityView curObj      = null;
                    foreach (EntityView view in list)
                    {
                        if (IsValidMapSignalTarget(view))
                        {
                            float mag = (view.gameObject.transform.position - hitPoint).sqrMagnitude;
                            if (curDistance > mag)
                            {
                                curDistance = mag;
                                curObj      = view;
                            }
                        }
                    }

                    if (curDistance < 16f)
                    {
                        targetID = curObj.ID;
                    }
                }
            }
        }

        cmd_war_mini_map_info data = new cmd_war_mini_map_info();

        switch (m_currentAttachType)
        {
        case MouseAttachFuncType.CtrlAttackSign:
            data.nType = (int)EMinimapClickType.EMCT_AttackSignal;
            break;

        case MouseAttachFuncType.AltAttackSign:
            data.nType = (int)EMinimapClickType.EMCT_AttackSignal;
            break;

        case MouseAttachFuncType.RetreatSign:
            data.nType = (int)EMinimapClickType.EMCT_RetreatSignal;
            break;

        case MouseAttachFuncType.DangerSign:
            data.nType = (int)EMinimapClickType.EMCT_DangerSignal;
            break;

        case MouseAttachFuncType.OnWaySign:
            data.nType = (int)EMinimapClickType.EMCT_OnWaySignal;
            break;

        case MouseAttachFuncType.HelpMeSign:
            data.nType = (int)EMinimapClickType.EMCT_HelpMeSignal;
            break;

        case MouseAttachFuncType.LostEyeSign:
            data.nType = (int)EMinimapClickType.EMCT_LostEyeSignal;
            break;

        default:
            return;
        }

        // 给逻辑层发命令 主角ID 目标位置 信号类型
        data.x         = xPos;
        data.y         = yPos;
        data.z         = zPos;
        data.nEntityID = targetID;
        EntityEventHelper.Instance.SendCommand <cmd_war_mini_map_info>(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_MINIMAP_INFO, ref data);

        if (isAttackSign(m_currentAttachType) && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.AttackSign) || InputManager.GetKey(KeyCode.LeftAlt) || InputManager.GetKey(KeyCode.LeftControl)) ||
            m_currentAttachType == MouseAttachFuncType.RetreatSign && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.DangerSign)))
        {
            // 功能继续
            m_multiAttachFunc = true;
        }
        else if ((InputManager.GetKey(KeyCode.LeftAlt)) &&
                 (m_currentAttachType == MouseAttachFuncType.OnWaySign || m_currentAttachType == MouseAttachFuncType.DangerSign ||
                  m_currentAttachType == MouseAttachFuncType.HelpMeSign || m_currentAttachType == MouseAttachFuncType.LostEyeSign))
        {
            // 战术标记发完后还按着alt的话保持附个空标记占位,以免出普攻
            SetAttachType(MouseAttachFuncType.EmptySign);
        }
        else
        {
            SetAttachType(MouseAttachFuncType.None);
        }
    }
コード例 #16
0
    public override void OnTimer(int nTimerID)
    {
        switch (nTimerID)
        {
        case (int)EN_TimeId.EN_ENTITYSEARCH:
        {
            IList <U3D_Render.EntityView> WatchOutTowerAroundEntity = MapFinderManager.Nearest(entityViewInfo.StateMachine.transform.position, entityViewInfo.Sight, SPELL.CampFlag.CampFlag_Unknow);

            if (WatchOutTowerAroundEntity.Count <= 0)
            {
                m_nFirstPersonCamp     = 0;
                m_nFirstPersonEntityID = 0;
                return;
            }

            m_listAroundPlayer.Clear();
            foreach (U3D_Render.EntityView Entity_Ev in WatchOutTowerAroundEntity)
            {
                if (Entity_Ev.gameObject == null)
                {
                    continue;
                }

                if (Entity_Ev.Type != ENTITY_TYPE.TYPE_PLAYER_ROLE)
                {
                    continue;
                }

                m_listAroundPlayer.Add(Entity_Ev);
            }

            bool bStartProgress = false;
            foreach (U3D_Render.EntityView Entity_Ev in m_listAroundPlayer)
            {
                int nPersonCamp = Entity_Ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CAMP);
                if (m_nFirstPersonCamp == 0 || m_listAroundPlayer.Count == 1)
                {
                    m_nFirstPersonCamp     = nPersonCamp;
                    m_nFirstPersonEntityID = Entity_Ev.ID;
                    if (Entity_Ev.ID == EntityFactory.MainHeroID)
                    {
                        bStartProgress = true;
                    }

                    continue;
                }
                // 同阵营加速读条 敌对阵营打断读条
                if (m_nFirstPersonCamp == nPersonCamp)
                {
                    // 预留接口先不做 时间有点不够。。
                }
                else
                {
                    bStartProgress = false;
                    if (m_nFirstPersonEntityID == EntityFactory.MainHeroID)
                    {
                        SendMainPlayerEndWatchOutProgress();
                    }
                    break;
                }
            }

            if (bStartProgress)
            {
                SendMainPlayerStartWatchOutProgress();
            }
        }
        break;

        default:
            break;
        }
    }
コード例 #17
0
    // 判断是否有障碍物,  true隐藏,  false代表显示
    public void CheckEntityOcclusions()
    {
        foreach (U3D_Render.EntityView ev in this.listEntity)
        {
            if (ev == null || ev.gameObject == null)
            {
                continue;
            }

            if (ev.StateMachine.GetState() == GameLogic.EntityState.Dead)
            {
                continue;
            }

            if (ev.Type != ENTITY_TYPE.TYPE_PLAYER_ROLE)
            {
                continue;
            }

            bool bInDarkCorner = false;
            int  nMask         = ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MASK);
            if ((nMask & (int)ENTITY_MASKFLAG.MASKFLAG_DISABLE_MINIMAP_SIGHT_CHECK) == 0)
            {
                Vector3 VecSourcePos = ev.gameObject.transform.position;
                VecSourcePos.y += 1;

                IList <U3D_Render.EntityView> EnemyAroundEntity = MapFinderManager.Nearest(ev.StateMachine.transform.position, ev.Sight, SPELL.CampFlag.CampFlag_Self);

                if (EnemyAroundEntity == null)
                {
                    return;
                }

                Vector3    VecTargetPos, RaycastDir;
                float      RaycastDistance;
                RaycastHit raycastHitInfo;
                LayerMask  raycastLayer = (1 << (LayerMask.NameToLayer(Config.LayerDefault)) | (1 << LayerMask.NameToLayer(Config.LayerBuilding)));

                int nCount = 0;
                foreach (U3D_Render.EntityView Enemy_Ev in EnemyAroundEntity)
                {
                    if (Enemy_Ev.gameObject == null)
                    {
                        return;
                    }
                    VecTargetPos    = Enemy_Ev.gameObject.transform.position;
                    VecTargetPos.y += 1;

                    RaycastDir = (VecTargetPos - VecSourcePos).normalized;
                    float tmpDis   = (VecTargetPos - VecSourcePos).magnitude;
                    float tmpSight = ev.Sight;
                    RaycastDistance = tmpDis > tmpSight ? tmpSight : tmpDis;
                    Debug.DrawLine(VecSourcePos, VecSourcePos + RaycastDir * RaycastDistance, Color.blue);
                    Ray ray = new Ray(VecSourcePos, RaycastDir);
                    if (Physics.Raycast(ray, out raycastHitInfo, RaycastDistance, raycastLayer) == false)
                    {
                        break;
                    }
                    nCount++;
                }


                if (nCount == EnemyAroundEntity.Count())
                {
                    bInDarkCorner = true;
                }
            }

            // 变化了才发出事件
            if (bInDarkCorner != ev.m_bInDarkCorner)
            {
                ev.m_bInDarkCorner = bInDarkCorner;

                U3D_Render.Utility.SEntityShowHero event_data = new U3D_Render.Utility.SEntityShowHero();
                event_data.ev      = ev;
                event_data.bIsHide = bInDarkCorner;
                if (event_data.ev != null)
                {
                    U3D_Render.Utility.EventManager.FireExecute(U3D_Render.Utility.EVENT.ENTITY_SHOW_HERO, ev.ID, event_data);
                }
            }
        }
    }