Esempio n. 1
0
 private void OnRoleAttrInfo(GameEvent ge, EventParameter parameter)
 {
     MsgData_sRoleAttrInfoNotify data = parameter.msgParameter as MsgData_sRoleAttrInfoNotify;
     ActorObj obj = CoreEntry.gActorMgr.GetActorByServerID(data.RoleID);
     if (obj != null)
     {
         if (ArenaMgr.Instance.IsArena)//如果是竞技场 更新血量
         {
             CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_ARENA_HP_REFRESH, null);
         }
         obj.UpdateAttr(data.AttrList);
     }else //查看缓存中的数据
     {
         SceneObj so = mSceneCache.Find(o => { return o.ObjGuid == data.RoleID; });
         if(so != null && so.ObjType == EnEntType.EnEntType_Monster)
         {
             var msg = so.ObjData as MsgData_sSceneObjectEnterMonster;
             foreach(var attr in data.AttrList)
             {
                 var type = BaseAttr.GetBasicAttrTypeFromStatType(attr.AttrType);
                 switch(type)
                 {
                     case BasicAttrEnum.CurHP: msg.CurHp = attr.AttrValue; break;
                     case BasicAttrEnum.MaxHP: msg.MaxHp = attr.AttrValue; break;
                 }
             }
         }
     }
 }
Esempio n. 2
0
        //五行属性分为:冰火雷风
        //相克关系:
        //冰克火
        //火克雷
        //雷克风
        //风克冰
        //如果相克的话,在属性伤害最外层会额外增加一定比值的伤害。(目前暂定10%),相克只计算伤害,不计算其他效果
        public static float getElementAdd(BaseAttr atkAttr, BaseAttr behitAttr)
        {
            float re = 1.0f;// getElementAdd(atkAttr.CreatureDesc.element, behitAttr.CreatureDesc.element);

            //LogMgr.UnityLog("相克值:" + re);

            return(re);
        }
Esempio n. 3
0
        /// <summary>
        /// 初始化血条。
        /// </summary>
        /// <param name="bname">BOSS名称。</param>
        /// <param name="num">血量管数。</param>
        /// <param name="value">默认血量比例。</param>
        public override void Init(GameObject owner, float value = 1, int num = 1, bool ani = false)
        {
            if (owner == null)
            {
                return;
            }
            Owner          = owner;
            m_TotalSection = Mathf.Max(num, 1);
            SetValue(value, ani);

            ActorObj actor = Owner.GetComponent <ActorObj>();

            if (actor == null)     //血条测试时
            {
                return;
            }
            BaseAttr attr = actor.mBaseAttr;

            NameText.text    = string.Format("{0} {1}级", attr.Name, attr.Level);
            LastText.enabled = num > 0;

            //显示头像
            string ico = (actor as MonsterObj).ModelConfig.Get <string>("head_icon");

            IcoImage.sprite = AtlasSpriteManager.Instance.GetSprite(ico);
            int _typeName = (actor as MonsterObj).MonsterConfig.Get <int>("race");
            int _type     = 0;

            if (_typeName == 0)
            {
                BossType.enabled = false;
                // LogMgr.UnityLog("检查怪物配置表 race 字段 取到为空");
            }
            else
            {
                BossType.enabled = true;
                _type            = _typeName - 1;
                if (0 <= _type && _type < m_bossTypePath.Length)
                {
                    BossType.sprite = AtlasSpriteManager.Instance.GetSprite(m_bossTypePath[_type]);
                }
                else
                {
                    BossType.enabled = false;
                }
            }

            int    _isShowReward = (actor as MonsterObj).MonsterConfig.Get <int>("isShowReward");
            string _warkeyReward = (actor as MonsterObj).MonsterConfig.Get <string>("warkeyReward");

            SetDropInfo(_isShowReward, _warkeyReward);
        }
Esempio n. 4
0
 // 重新计算二级属性时调用
 static public void RefreshAttrs(BaseAttr attr, bool bMonster)
 {
     //for (int i = 0; i < attr.GiftsSkillIdArray.Length; i++)
     //{
     //    int skillID = attr.GiftsSkillIdArray[i];
     //    if (skillID == 0)
     //        continue;
     //    Configs.skillConfig skillDesc = ConfigManager.Instance.Skill.GetSkillConfig(skillID);
     //    if (skillDesc == null)
     //        continue;
     //    //if (skillDesc.passive <= attr.StarLevel || bMonster) // 星级
     //    //{
     //    //    Buff.RefreshAttrs(skillDesc.OwnerBuffID, attr);
     //    //}
     //    //    Buff.RefreshAttrs(skillDesc.OwnerBuffID, attr);
     //    }
 }
Esempio n. 5
0
        //private int mValue;

        public void Init(BasicAttrEnum type, double oldvalue, double newvalue, float x, float y, float delay)
        {
            mType = type;
            var change = newvalue - oldvalue;

            if (type == BasicAttrEnum.Power)
            {
                //战斗力表现方式不一样
                Scroll.SetValue((long)oldvalue, false);
                Scroll.SetValue((long)newvalue, true);
                ChangeText.text = change > 0 ? ("+" + change.ToString()) : change.ToString();

                PowerToText fun = LuaMgr.Instance.GetLuaEnv().Global.GetInPath <PowerToText>("Common.PowerToText");
                int         len = (oldvalue > newvalue ? oldvalue : newvalue).ToString().Length * 30;
                if (fun != null)
                {
                    len = fun((oldvalue > newvalue ? oldvalue : newvalue)).Length * 30;
                }

                int           clen    = ChangeText.text.Length * 30;
                RectTransform valuert = Scroll.GetComponent <RectTransform>();
                //valuert.anchoredPosition = new Vector2(-len / 2, 0);
                valuert.sizeDelta        = new Vector2(len, valuert.sizeDelta.y);
                PowerBackLeft.sizeDelta  = new Vector2(len / 2 + 100, PowerBackLeft.sizeDelta.y);
                PowerBackRight.sizeDelta = new Vector2(len / 2 + clen + 70, PowerBackRight.sizeDelta.y);
                if (EffectFire != null)
                {
                    EffectFire.Play();
                }
                // if (Effect != null)
                // {
                //     Effect.SetActive(false);
                //     Effect.SetActive(true);
                // }
            }
            else
            {
                NameText.text  = BaseAttr.GetBasicAttrName((int)mType);
                ValueText.text = string.Format("{0}{1}", change > 0 ? "+" : "", change);
            }
            AniCurve.Init(x, y, delay);
        }
Esempio n. 6
0
        /// <summary>
        /// 初始化玩家自身数据。
        /// </summary>
        public void InitFromPlayerData()
        {
            BaseAttr playerattr = PlayerData.Instance.BaseAttr;

            double[] attrs = playerattr.Attrs;
            for (int i = 0; i < attrs.Length; ++i)
            {
                mBasicAttrs[i] = attrs[i];
            }
            Dress         = playerattr.Dress;
            EquipStarMin  = playerattr.EquipStarMin;
            Weapon        = playerattr.Weapon;
            ShenBing      = playerattr.ShenBing;
            FashionDress  = playerattr.FashionDress;
            FashionWeapon = playerattr.FashionWeapon;
            FashionState  = playerattr.FashionState;
            ShenBing      = playerattr.ShenBing;
            mName         = PlayerData.Instance.Name;
            mLordId       = playerattr.Lord;
        }
Esempio n. 7
0
 public virtual void RefreshAttrs(BaseAttr attr)
 {
 }
Esempio n. 8
0
        /// <summary>
        /// 更新属性。
        /// </summary>
        /// <param name="attrs">属性列表。</param>
        public virtual void OnUpdateAttr(List <MsgData_sClientAttr> attrs)
        {
            //Debug.Log("OnUpdateAttr 0");
            //用于判断血量或战力是否发生变化
            long   oldhp          = mBasicAttr.CurHP;
            long   oldmaxhp       = mBasicAttr.MaxHP;
            long   oldpower       = mBasicAttr.Power;
            double fOldPower      = mBasicAttr.GetBasicAttrValue((int)BasicAttrEnum.Power);
            int    oldlevel       = mBasicAttr.Level;
            long   oldExp         = mBasicAttr.Exp;
            bool   currencychange = false;
            int    oldJingJieLv   = mBasicAttr.JingJieLevel;
            long   oldJingJieExp  = mBasicAttr.JingJieExp;
            int    oldVip         = mBasicAttr.VIPLevel;

            double[] oldattr = mInit ? FlyAttrManager.GetShowAttr(mBasicAttr.Attrs) : null;     //没进场不飘字
            for (int i = 0; i < attrs.Count; ++i)
            {
                MsgData_sClientAttr ca   = attrs[i];
                BasicAttrEnum       type = BaseAttr.GetBasicAttrTypeFromStatType(ca.AttrType);
                if (type != BasicAttrEnum.Unkonw)
                {
                    mBasicAttr.SetBasicAttrValue((int)type, ca.AttrValue);
                    continue;
                }
                int currencytype = CurrencyType.GetCurrencyTypeFromStatType(ca.AttrType);
                if (currencytype != -1)
                {
                    SetCurrency(currencytype, (long)ca.AttrValue);
                    currencychange = true;
                    if (currencytype == CurrencyType.CURRENCY_TYPE_UNBIND_MONEY)
                    {
                        Account.Instance.isRecharging = false; //充值钻石完成
                    }
                    continue;
                }
            }
            if (oldVip != mBasicAttr.VIPLevel)
            {
                if (CoreEntry.gActorMgr.MainPlayer != null)
                {
                    if (CoreEntry.gActorMgr.MainPlayer.mBaseAttr != null)
                    {
                        CoreEntry.gActorMgr.MainPlayer.mBaseAttr.VIPLevel = mBasicAttr.VIPLevel;
                        CoreEntry.gActorMgr.MainPlayer.Health.OnLordChange();
                    }
                }
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_VIP, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 1");
            }
            if (oldhp != mBasicAttr.CurHP || oldmaxhp != mBasicAttr.MaxHP)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_HP, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 2");
            }
            if (oldpower != mBasicAttr.Power)
            {
                long powerDiff    = (long)(mBasicAttr.GetBasicAttrValue((int)BasicAttrEnum.Power) - fOldPower);
                long powerDiffInt = mBasicAttr.Power - oldpower;
                oldpower = oldpower - (powerDiff - powerDiffInt);
                EventParameter ep = EventParameter.Get();
                ep.longParameter  = oldpower;
                ep.longParameter1 = mBasicAttr.Power;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_POWER, ep);
                Debug.Log("OnUpdateAttr 3");
            }
            if (oldlevel != mBasicAttr.Level)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_INFO, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 4");
                if (oldlevel != 0)
                {
                    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_LV, EventParameter.Get(oldlevel));
                    //Debug.Log("OnUpdateAttr 5");
                }
            }
            if (currencychange)
            {
                //注意,大量丢金币变化通知,卡CPU
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_CURRENCY, EventParameter.Get());
                //Debug.Log("OnUpdateAttr 6");
            }
            if (oldlevel != mBasicAttr.Level || oldExp != mBasicAttr.Exp)
            {
                EventParameter parameter = EventParameter.Get();
                parameter.intParameter  = oldlevel;
                parameter.longParameter = oldExp;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_EXP, parameter);
                //Debug.Log("OnUpdateAttr 7");
            }
            if (oldJingJieLv != mBasicAttr.JingJieLevel)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PLAYER_JINGJIE_LV, EventParameter.Get(oldJingJieLv));
                //Debug.Log("OnUpdateAttr 8");
            }
            if (oldJingJieLv != mBasicAttr.JingJieLevel || oldJingJieExp != mBasicAttr.JingJieExp)
            {
                EventParameter parameter = EventParameter.Get();
                parameter.intParameter  = oldJingJieLv;
                parameter.longParameter = oldJingJieExp;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_PALYER_JINGJIE_EXP, parameter);
                //Debug.Log("OnUpdateAttr 9");
            }
            if (oldattr != null)
            {
                double[]       newattr = FlyAttrManager.GetShowAttr(mBasicAttr.Attrs);
                EventParameter ep      = EventParameter.Get();
                ep.objParameter  = oldattr;
                ep.objParameter1 = newattr;
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FLY_ATTR, ep);
                //Debug.Log("OnUpdateAttr 10");
            }
        }
Esempio n. 9
0
        private void OnPlayerShowChanged(GameEvent ge, EventParameter parameter)
        {
            MsgData_sPlayerShowChanged data = parameter.msgParameter as MsgData_sPlayerShowChanged;

            //玩家自身数据层的更新
            if (data.RoleID == PlayerData.Instance.RoleID)
            {
                PlayerData.Instance.OnShowChanged(data.Type, data.Value);
            }

            //角色更新
            ActorObj obj = CoreEntry.gActorMgr.GetActorByServerID(data.RoleID);
            if (obj != null)
            {
                BaseAttr attr = obj.mBaseAttr;
                switch ((EModelChange)data.Type)
                {
                    case EModelChange.MODEL_CHANGE_WING:
                        attr.Wing = data.Value;
                        obj.ChangeWing(SceneLoader.GetWingModelID(attr.FashionState == 0 ? attr.FashionWing : 0, attr.Wing, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_WEAPON:
                        attr.Weapon = data.Value;
                        obj.ChangeWeapon(SceneLoader.GetWeaponModelID(attr.FashionState == 0 ? attr.FashionWeapon : 0, attr.ShenBing, attr.Weapon, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_DRESS:
                        attr.Dress = data.Value;
                        obj.ChangeClothes(SceneLoader.GetClothesModelID(attr.FashionState == 0 ? attr.FashionDress : 0, attr.Dress, attr.Prof,attr.EquipStarMin));
                        break;
                    case EModelChange.MODEL_CHANGE_EQUIPSTAR:
                        attr.EquipStarMin = data.Value;
                        obj.ChangeClothes(SceneLoader.GetClothesModelID(attr.FashionState == 0 ? attr.FashionDress : 0, attr.Dress, attr.Prof,attr.EquipStarMin));
                        break;
                    case EModelChange.MODEL_CHANGE_FASHION_WING:
                        attr.FashionWing = data.Value;
                        obj.ChangeWing(SceneLoader.GetWingModelID(attr.FashionState == 0 ? attr.FashionWing : 0, attr.Wing, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_ZHENFA:
                        attr.ZhenFa = data.Value;
                        obj.ChangeZhenFa(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_FACTION:
                        attr.Faction = data.Value;
                        obj.ChangeFaction(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_FASHION_DRESS:
                        attr.FashionDress = data.Value;
                        obj.ChangeClothes(SceneLoader.GetClothesModelID(attr.FashionState == 0 ? attr.FashionDress : 0, attr.Dress, attr.Prof,attr.EquipStarMin));
                        break;
                    case EModelChange.MODEL_CHANGE_FASHION_WEAPON:
                        attr.FashionWeapon = data.Value;
                        obj.ChangeWeapon(SceneLoader.GetWeaponModelID(attr.FashionState == 0 ? attr.FashionWeapon : 0, attr.ShenBing, attr.Weapon, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_SHENBING:
                        attr.ShenBing = data.Value;
                        obj.ChangeWeapon(SceneLoader.GetWeaponModelID(attr.FashionWeapon, attr.ShenBing, attr.Weapon, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_RIDE:
                        obj.FuckHorse(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_MAGICKEY:
                        obj.ShowMagicKey(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_MAGICKEY_STAR: // 法宝星级
                        obj.ShowMagicKeyByStar(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_PK_STATUS:
                        obj.ChangePKStatus(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_GUANZHI:
                        attr.Lord = data.Value;                     
                        obj.Health.OnCreateHPBar();
                        break;
                    case EModelChange.MODEL_CHANGE_FASHION:
                        attr.FashionState = data.Value;
                        obj.ChangeWing(SceneLoader.GetWingModelID(attr.FashionState == 0 ? attr.FashionWing : 0, attr.Wing, attr.Prof));
                        obj.ChangeClothes(SceneLoader.GetClothesModelID(attr.FashionState == 0 ? attr.FashionDress : 0, attr.Dress, attr.Prof,attr.EquipStarMin));
                        obj.ChangeWeapon(SceneLoader.GetWeaponModelID(attr.FashionState == 0 ? attr.FashionWeapon : 0, attr.ShenBing, attr.Weapon, attr.Prof));
                        break;
                    case EModelChange.MODEL_CHANGE_EQUIP_TITLE:
                        obj.ChangeHeroTitle(data.Value);
                        break;
                    case EModelChange.MODEL_CHANGE_UNEQUIP_TITLE:
                        obj.ChangeHeroTitle(0);
                        break;
                    default:
                        break;
                }
            }
        }
Esempio n. 10
0
        // Use this for initialization
        void Start()
        {
            CancelInvoke("Start");
            ////
            //m_skillBase = this.transform.root.gameObject.GetComponent<SkillBase>();
            if (m_skillBase == null || m_skillBase.m_actor == null)
            {
                return;
            }

            // 普通分身不产生分身
            if (m_skillBase.m_actor.m_bSummonMonster)
            {
                return;
            }

            // 是否删除之前召唤的生物
            if (m_summonDesc.killBefore == 1)
            {
                if (m_skillBase.m_actor.m_skillSummonList == null)
                {
                    m_skillBase.m_actor.m_skillSummonList = new List <ActorObj.SummonData>();
                }

                int index = 0;
                while (true)
                {
                    if (m_skillBase.m_actor.m_skillSummonList.Count <= index)
                    {
                        break;
                    }
                    ActorObj.SummonData summon = m_skillBase.m_actor.m_skillSummonList[index];
                    if (m_skillBase.m_actor.m_skillSummonList[index].SummonID == m_summonDesc.npcID)
                    {
                        OnSummonDeath(m_skillBase.m_actor.m_skillSummonList[index].entityid);
                        m_skillBase.m_actor.m_skillSummonList.Remove(summon);
                    }
                    else
                    {
                        index++;
                    }
                }
            }

            Vector3 origin = m_skillBase.m_actor.transform.position;


            int POS_TYPE_TARGET = 6;

            for (int i = 0; i < m_summonDesc.npcCount; i++)
            {
                Vector3 summonPos = GetSummonPos(m_skillBase.m_actor.transform, i);

                if (m_summonDesc.npcPosType == POS_TYPE_TARGET) //召唤位置在敌方脚下
                {
                    ActorObj actorObj = m_skillBase.m_actor.GetAttackObj();

                    if (actorObj == null)
                    {
                        actorObj = m_skillBase.m_hitActor;
                    }
                    else
                    {
                        return;
                    }

                    summonPos = actorObj.transform.position;
                }
                else
                {
                    summonPos = GetSummonPos(m_skillBase.m_actor.transform, i);
                }


                if (summonPos != Vector3.zero)
                {
                    // 是否有障碍
                    Vector3 bornPos = BaseTool.instance.GetWallHitPoint(origin, summonPos);
                    // 地面高度
                    bornPos = BaseTool.instance.GetGroundPoint(bornPos);
                    // 载入
                    GameObject obj = null;

                    if (m_summonDesc.summonType == 2)
                    {
                        CoreEntry.gObjPoolMgr.PushToPool(m_skillBase.m_actor.resid); // 加到对象池子里
                        CoreEntry.gGameMgr.SpawnMonster(m_skillBase.m_actor.resid, bornPos, out obj);
                    }
                    else
                    {
                        CoreEntry.gObjPoolMgr.PushToPool(m_summonDesc.npcID); // 加到内存池子里
                        CoreEntry.gGameMgr.SpawnMonster(m_summonDesc.npcID, bornPos, out obj);
                    }

                    obj.transform.localRotation = m_skillBase.m_actor.transform.localRotation;

                    ActorObj summonActorbase = obj.GetComponent <ActorObj>();
                    if (m_summonDesc.killBefore == 1)
                    {
                        ActorObj.SummonData data = new ActorObj.SummonData();
                        data.SummonID     = m_summonDesc.npcID;
                        data.entityid     = summonActorbase.entityid;
                        data.lifeTime     = m_summonDesc.lifeTime;
                        data.deadthToKill = m_summonDesc.deadthToKill;
                        data.startTime    = Time.time;
                        m_skillBase.m_actor.m_skillSummonList.Add(data);
                    }

                    summonActorbase.m_bSummonMonster = true; // 召唤生物标记

                    if (m_skillBase.m_actor.mActorType == ActorType.AT_PVP_PLAYER)
                    {
                        summonActorbase.mActorType = m_skillBase.m_actor.mActorType;
                    }

                    if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER)
                    {
                        summonActorbase.TeamType = 1;
                    }
                    else
                    {
                        summonActorbase.TeamType = 3;
                    }

                    if (summonActorbase.mActorType == ActorType.AT_BOSS)
                    {
                        summonActorbase.mActorType = ActorType.AT_AVATAR;
                    }

                    // 1.属性从召唤者继承*表里设置的属性百分比
                    if (m_summonDesc.summonType == 1)
                    {
                        // m_skillBase.m_actor.mBaseAttr.SummonTo(summonActorbase.mBaseAttr);
                        summonActorbase.curHp = summonActorbase.mBaseAttr.MaxHP;

                        // 重置AI
                        Destroy(summonActorbase.GetComponent <ActorAgent>());
                        ActorAgent actorAgent = null;
                        if (m_summonDesc.followMe)
                        {
                            actorAgent = summonActorbase.gameObject.AddComponent <PlayerAgent>();
                        }


                        ActorObj actorobj = summonActorbase.GetComponent <ActorObj>();

                        actorAgent.enabled = true;
                        actorobj.enabled   = true;
                        //summonActorbase.actorCreatureInfo.battleSpeed = m_skillBase.m_actor.actorCreatureInfo.battleSpeed;
                        //summonActorbase.mBaseAttr.Speed = summonActorbase.actorCreatureInfo.battleSpeed;
                        actorobj.SetSpeed(summonActorbase.mBaseAttr.Speed);
                    }
                    else
                    // 2.属性从召唤者继承*表里设置的属性百分比 模型外观变成召唤者
                    if (m_summonDesc.summonType == 2)
                    {
                        // 设置当前血量百分比
                        BaseAttr newCardAttr = new BaseAttr();
                        summonActorbase.mBaseAttr = newCardAttr;
                        summonActorbase.mBaseAttr = newCardAttr;
                        // m_skillBase.m_actor.mBaseAttr.SummonTo(summonActorbase.mBaseAttr);
                        float fHpRatio = (float)m_skillBase.m_actor.curHp / (float)m_skillBase.m_actor.mBaseAttr.MaxHP;
                        summonActorbase.curHp = (int)(summonActorbase.mBaseAttr.MaxHP * fHpRatio);
                        //
                        //MonsterHeath monsterHeath = summonActorbase.GetComponent<MonsterHeath>();
                        //if (monsterHeath != null)
                        //    monsterHeath.ResetHp(summonActorbase.mBaseAttr.MaxHP);
                        //PlayerHeath  playerHeath  = summonActorbase.GetComponent<PlayerHeath>();
                        //if (playerHeath != null)
                        //    playerHeath.OnResetHP();

                        // 重置AI
                        Destroy(summonActorbase.GetComponent <ActorAgent>());

                        ActorAgent actorAgent = null;
                        if (m_summonDesc.followMe)
                        {
                            actorAgent = summonActorbase.gameObject.AddComponent <PlayerAgent>();
                        }

                        // 设置速度
                        if (actorAgent != null)
                        {
                            actorAgent.enabled = true;
                            ActorObj actorobj = summonActorbase.GetComponent <ActorObj>();
                            actorobj.enabled = true;

                            //summonActorbase.actorCreatureInfo.battleSpeed = m_skillBase.m_actor.actorCreatureInfo.battleSpeed;
                            //summonActorbase.mBaseAttr.Speed = summonActorbase.actorCreatureInfo.battleSpeed;
                            actorobj.SetSpeed(summonActorbase.mBaseAttr.Speed);
                        }

                        // 颜色
                        Color color = new Color(67f / 255f, 146f / 255f, 223f / 255f, 205f / 255f);
                        summonActorbase.SetMaterialColor("DZSMobile/CharacterColor", "_BobyColor", color);
                        //summonActorbase.NoRecoverShader();

                        summonActorbase.m_bNoDieAction = true; // 不播放死亡动作
                    }

                    //
                    if (m_summonDesc.buffID != 0)
                    {
                        //         summonActorbase.Addbuff(m_summonDesc.buffID, m_skillBase.m_actor, 0);
                    }
                }
            }
        }
Esempio n. 11
0
        public virtual void Init(GameObject owner, float value = 1, int num = 1, bool ani = false)
        {
            if (owner == null)
            {
                return;
            }

            Owner = owner;
            SetBindNode(Owner, BIND_NAME);
            SetValue(value, ani);

            ActorObj actor = Owner.GetComponent <ActorObj>();

            if (actor == null)     //血条测试时
            {
                return;
            }
            BaseAttr attr = actor.mBaseAttr;

            self = actor.mActorType == ActorType.AT_LOCAL_PLAYER;          //玩家自身不显示血条,但要显示不包含等级的名字

            if (ArenaMgr.Instance.IsArena)
            {
                self = true;
                if (actor.mActorType == ActorType.AT_PET)
                {
                    self = false;
                }
            }
            lordName   = TitleMgr.Instance.GetCurLordText(attr.Lord, true);
            playerName = attr.Name;
            VipName    = "";
            if (attr.VIPLevel > 0)
            {
                GetVipScColor fun = LuaMgr.Instance.GetLuaEnv().Global.GetInPath <GetVipScColor>("Common.GetVipScColor");
                if (fun != null)
                {
                    VipName = fun(attr.VIPLevel, actor.ServerID);
                    //playerName = string.Format("{0} {1}", fun(attr.VIPLevel,actor.ServerID),attr.Name);
                }
            }

            //Debug.LogError("pet.Starlevel: " + pet.Starlevel);

            playerLvl = attr.Level;

            if (null != ImageHeroTitle)
            {
                ImageHeroTitle.gameObject.SetActive(false);
            }

            if (self)
            {
                InitPKStatus(PlayerData.Instance.CurPKState);
                // SetSelfPkLogo(PlayerData.Instance.CurPKState);
                ValueImage.transform.parent.gameObject.SetActive(false);

                LuaTable G  = LuaMgr.Instance.GetLuaEnv().Global;
                int      id = G.GetInPath <int>("ModelManager.HeroTitleModel.IDWear");
                if (id != 0)
                {
                    LuaTable row = RawLuaConfig.Instance.GetRowData("t_title", id);
                    if (row != null)
                    {
                        ChangeHeroTitle(row.Get <string>("icon"));
                    }
                }
            }
            else if (actor.mActorType == ActorType.AT_REMOTE_PLAYER)
            {
                InitPKStatus(actor as OtherPlayer);
                //  SetOtherPkLogo(actor as OtherPlayer);
                ValueImage.transform.parent.gameObject.SetActive(true);

                //LuaTable G = LuaMgr.Instance.GetLuaEnv().Global;
                int id = attr.HeroTitle;
                if (id != 0)
                {
                    LuaTable row = RawLuaConfig.Instance.GetRowData("t_title", id);
                    if (row != null)
                    {
                        ChangeHeroTitle(row.Get <string>("icon"));
                    }
                }
            }
            else if (actor.mActorType == ActorType.AT_MECHANICS)
            {
                InitPKStatus(actor as OtherPlayer);
                ValueImage.transform.parent.gameObject.SetActive(true);
            }
            else if (actor.mActorType == ActorType.AT_MONSTER)
            {
                LuaTable cfg = (actor as MonsterObj).MonsterConfig;
                NameText.text = string.Format("<color=#{2}>{0} {1}级</color>", attr.Name, attr.Level, cfg.Get <int>("type") == 2 ? EliteColor : MonsterColor);
            }
            else if (actor.mActorType == ActorType.AT_NPC)
            {
                NameText.text = attr.Name;
            }
            else if (actor.mActorType == ActorType.AT_PET)
            {
                SetPetLevel(actor);
            }
            else
            {
                NameText.text = string.Format("{0} {1}级", attr.Name, attr.Level);
            }
        }