コード例 #1
0
        public override void EmitEffect(ClientNPC _from, ClientNPC _target, bool _needUpdate = true)
        {
            Target                  = _target;
            Parent                  = _from;
            transform.parent        = Target.transform;
            transform.localPosition = Vector3.zero;
            ClientNpcAnimState cna = Target.animState;

            if (cna == null)
            {
                transform.localPosition = Vector3.up * 2f;
            }
            else
            {
                ed = GetComponent <EffectDef>();
                Transform cm = cna.getModelPart(ed.End);
                if (cm != null)
                {
                    transform.parent        = cm;
                    transform.localPosition = Vector3.up * 0.5f;
                }
                else
                {
                    transform.localPosition = Vector3.up * 2f;
                }
            }
//            transform.parent = Target.transform;
        }
コード例 #2
0
 public virtual void OnNpcStatus(WarMsgParam param)
 {
     if (param != null)
     {
         string        m_str = param.param as string;
         NpcStatusInfo info  = JSON.Instance.ToObject <NpcStatusInfo>(m_str);
         if (info != null)
         {
             List <StatusInfoItem> list = info.items;
             if (list != null)
             {
                 GameObject obj = null;
                 foreach (StatusInfoItem si in list)
                 {
                     if (!statusCache.TryGetValue(si.status, out obj))
                     {
                         obj = ClientNpcAnimState.getStatusObj(si.status);
                         if (obj != null)
                         {
                             obj = Instantiate(obj) as GameObject;
                             if (obj != null)
                             {
                                 SkillEffectBase seb = obj.GetComponent <SkillEffectBase>();
                                 if (seb != null)
                                 {
                                     seb.EmitEffect(null, cachedNpc, true);
                                 }
                             }
                             statusCache.Add(si.status, obj);
                         }
                     }
                     obj.SetActive(si.isAdd);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: WarUI.cs プロジェクト: wxl-007/ShadowDota
        //TODO 是否要加建筑的血条

        public void CreateUIForNpc(ClientNPC npc)
        {
            if (npc != null)
            {
                GameObject obj    = null;
                bool       isHero = npc.WhatTypeOf.check(LifeNPCType.Hero);
                if (isHero)
                {
                    obj = NGUITools.AddChild(HealthRoot, HeroHealthObj);
                }
                else
                {
                    obj = NGUITools.AddChild(HealthRoot, UnitHealthObj);
                }
                obj.SetActive(true);
                UIProgressBar health = obj.GetComponent <UIProgressBar>();
                UISprite      sp     = health.foregroundWidget as UISprite;

                ClientNpcAnimState cna = npc.animState;

                if (cna != null)
                {
                    cna.HealthBar = health;
                    cna.HitNum    = GenerateHitNumber;
                }

                if (sp != null)
                {
                    if (isHero)
                    {
                        if (npc.Camp == CAMP.Player)
                        {
                            sp.spriteName = "battle-021";
                        }
                        else if (npc.Camp == CAMP.Enemy)
                        {
                            sp.spriteName = "battle-020";
                        }
                        else
                        {
                            sp.spriteName = "battle-020";
                        }
                    }
                    else
                    {
                        if (npc.Camp == CAMP.Player)
                        {
                            sp.spriteName = "battle-043";
                        }
                        else
                        {
                            sp.spriteName = "battle-044";
                        }
                    }
                }

                if (!isHero)
                {
                    obj.SetActive(false);
                }
            }
        }