Example #1
0
    /// <summary>
    /// 指定uuid的角色是否显示归属
    /// </summary>
    /// <param name="uuid"></param>
    /// <returns></returns>
    public static bool IsAffiliation(uint uuid, uint teamId)
    {
        xc.Machine.State       curState          = Game.GetInstance().GetFSM().GetCurState();
        CommonLuaInstanceState wildInstanceState = curState as CommonLuaInstanceState;

        if (wildInstanceState != null && wildInstanceState.DataBossBehaviour != null)
        {
            return(wildInstanceState.DataBossBehaviour.IsAffiliation(uuid, teamId));
        }

        return(false);
    }
Example #2
0
    /// <summary>
    /// 获取自动战斗下一目标位置
    /// </summary>
    /// <returns>The auto runner target location.</returns>
    public static Vector3 GetAutoRunnerTargetLocation()
    {
        // 野外地图和洞穴
        uint instanceType = InstanceManager.GetInstance().InstanceType;

        if (instanceType == GameConst.WAR_TYPE_WILD)
        {
            xc.Machine.State       curState          = Game.GetInstance().GetFSM().GetCurState();
            CommonLuaInstanceState wildInstanceState = curState as CommonLuaInstanceState;
        }

        // 目标首先是最近的中立NPC和宝箱
        NpcPlayer closestNpc = NpcManager.Instance.GetClosestNpc(Neptune.Relationship.NEUTRAL);

        if (closestNpc != null && CanWalkTo(closestNpc.transform.position))
        {
            return(closestNpc.transform.position);
        }

        // 当前已经生成的boss
        Dictionary <UnitID, Actor> monsterList = ActorManager.Instance.MonsterSet;

        if (monsterList != null && monsterList.Count > 0)
        {
            Actor targetMonster = null;
            foreach (Actor actor in monsterList.Values)
            {
                Monster monster = actor as Monster;

                if (monster is Pet)
                {
                    continue;
                }

                if (actor.IsDead() == false && monster != null)
                {
                    // 目标首先是boss
                    if (monster.IsBoss() == true)
                    {
                        targetMonster = monster;
                        break;
                    }
                }
            }

            if (targetMonster != null && CanWalkTo(targetMonster.transform.position))
            {
                return(targetMonster.transform.position);
            }
        }

        // 还没生成的boss
        //List<MonsterGroupInfo> monsterGroupInfos = MonsterInfoManager.GetInstance().MonsterGroupInfos;
        //if (monsterGroupInfos != null && monsterGroupInfos.Count > 0)
        //{
        //    foreach (MonsterGroupInfo monsterGroupInfo in monsterGroupInfos)
        //    {
        //        if (monsterGroupInfo != null && monsterGroupInfo.HasSpawned == false && monsterGroupInfo.SpawnDirectly == true)
        //        {
        //            MonsterInfo targetMonster = null;
        //            foreach (MonsterInfo monster in monsterGroupInfo.Monsters)
        //            {
        //                DBFixedMonster dbFixedMonster = DBManager.GetInstance().GetDB<DBFixedMonster>();
        //                DBFixedMonster.FixedMonsterInfo fixedMonsterInfo = dbFixedMonster.GetFixedMonsterInfo((uint)monster.ActorId);
        //                if (fixedMonsterInfo != null)
        //                {
        //                    if (fixedMonsterInfo.mIsBoss == true)
        //                    {
        //                        targetMonster = monster;
        //                        break;
        //                    }
        //                }
        //                else
        //                {
        //                    GameDebug.LogError("GetAutoRunnerTargetLocation error, can not find actor id " + monster.ActorId);
        //                }
        //            }

        //            if (targetMonster != null && CanWalkTo(targetMonster.Position))
        //                return targetMonster.Position;
        //        }
        //    }
        //}

        // 已经生成的怪物
        if (monsterList != null && monsterList.Count > 0)
        {
            Actor targetMonster = null;
            int   index         = 0;
            foreach (Actor actor in monsterList.Values)
            {
                Monster monster = actor as Monster;


                if (monster is Pet)
                {
                    continue;
                }

                if (monster.IsDead())
                {
                    continue;
                }

                if (monster != null && monster.BeSummonedType == Monster.BeSummonType.NULL)
                {
                    // 目标有可能是第一个怪物
                    if (index == 0)
                    {
                        targetMonster = monster;
                    }
                }

                ++index;
            }

            if (targetMonster != null && CanWalkTo(targetMonster.transform.position))
            {
                return(targetMonster.transform.position);
            }
        }

        // 触发器
        //Dictionary<int, TriggerCollider> triggers = TriggerManager.Instance.Triggers;
        //if (triggers != null && triggers.Count > 0)
        //{
        //    foreach (TriggerCollider trigger in triggers.Values)
        //    {
        //        if (trigger.TriggerInfo.NeedNavigation == true)
        //        {
        //            bool hasEvent = false;
        //            //foreach (var eventId in trigger.TriggerInfo.EventsId)
        //            //{
        //            //    Destiny.DestinyNode node = Destiny.DestinyManager.Instance.GetRootNode(eventId);
        //            //    if (node != null)
        //            //    {
        //            //        Destiny.DestinyEventNode eventNode = node as Destiny.DestinyEventNode;

        //            //        if(eventNode != null && eventNode.Active)
        //            //        {
        //            //            hasEvent = true;
        //            //        }

        //            //        break;
        //            //    }
        //            //}

        //            if(hasEvent && CanWalkTo(trigger.transform.position))
        //            {
        //                return trigger.transform.position;
        //            }
        //        }

        //        if (trigger.TriggerInfo.Info == TriggerInfo.InfoType.PORTAL && trigger.TriggerInfo.NeedNavigation && CanWalkTo(trigger.transform.position))
        //        {
        //            return trigger.transform.position;
        //        }
        //    }
        //}

        // 还没生成的怪物
        //if (monsterGroupInfos != null && monsterGroupInfos.Count > 0)
        //{
        //    foreach (MonsterGroupInfo monsterGroupInfo in monsterGroupInfos)
        //    {
        //        if (monsterGroupInfo != null && monsterGroupInfo.HasSpawned == false && monsterGroupInfo.SpawnDirectly == true && CanWalkTo(monsterGroupInfo.Position))
        //            return monsterGroupInfo.Position;
        //    }
        //}

        // 传送点
        //        Dictionary<int, TriggerInfo> triggers = TriggerInfoManager.GetInstance().mTriggers;
        //        if (triggers != null && triggers.Count > 0)
        //        {
        //            foreach (TriggerInfo trigger in triggers.Values)
        //            {
        //                if (trigger.Info == TriggerInfo.InfoType.PORTAL)
        //                {
        //                    // 目标是第一个传送点
        //                    return trigger.Position;
        //                }
        //                if (trigger.NeedNavigation == true)
        //                {
        //
        //                }
        //            }
        //        }

        return(Vector3.zero);
    }
Example #3
0
    protected override void SetNameStyle()
    {
        UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo();
        styleInfo.Offset       = new Vector3(0, 2.8f, 0);
        styleInfo.HeadOffset   = new Vector3(0, this.Height, 0);
        styleInfo.ScreenOffset = UI3DText.NameTextScreenOffset;
        styleInfo.Scale        = Vector3.one;

        bool show_tips = false;

        styleInfo.IsShowBg  = PKModeManagerEx.Instance.IsLocalPlayerCanAttackActor(this, ref show_tips);
        styleInfo.SpritName = "Main@PKCan";
        int labelWidth = 100;//UserName.Length * 20;

        styleInfo.SpriteWidth     = labelWidth + 30;
        show_tips                 = false;
        styleInfo.IsShowBgPreHead = PKModeManagerEx.Instance.IsActorCanAttackLocalPlayer(this, ref show_tips);
        if (styleInfo.IsShowBg)
        {
            styleInfo.BgPreHeadOffset = new Vector3(styleInfo.SpriteWidth / 2 - 145, 2, 0);
        }
        else
        {
            styleInfo.BgPreHeadOffset = new Vector3(labelWidth / 2 - 110, 2, 0);
        }

        Actor local_player = Game.Instance.GetLocalPlayer();

        show_tips = false;
        styleInfo.IsEnemyRelation = !(PKModeManagerEx.Instance.IsFriendRelation(local_player, this));

        //更新归属
        xc.Machine.State       curState          = Game.GetInstance().GetFSM().GetCurState();
        CommonLuaInstanceState wildInstanceState = curState as CommonLuaInstanceState;

        if (wildInstanceState != null && wildInstanceState.DataBossBehaviour != null)
        {
            styleInfo.IsShowAffiliationPanel = wildInstanceState.DataBossBehaviour.IsAffiliation(this);
        }

        if (SceneHelp.Instance.IsInWorldBossExperienceInstance && this.IsLocalPlayer == false && this.IsPlayer() && this.IsDead())
        {
            styleInfo.LayoutIsVisiable = false;
        }
        else
        {
            styleInfo.LayoutIsVisiable = true;
        }

        // 和平模式,不显示血条,破碎死域副本内要总是显示血条
        if (PKModeManagerEx.Instance.CanShowPVPBlood(this) == false && SceneHelp.Instance.ForceShowHpBar == false)
        {
            SetShowBar(styleInfo, false);
        }
        else
        {
            SetShowBar(styleInfo, true);
        }

        TextNameBehavior nameBehavoir = GetBehavior <TextNameBehavior>();

        nameBehavoir.SetStyle(styleInfo);
    }