Example #1
0
        public static void CreateHPBar(MonsterHPBarView owner, Transform anchor, out GameObject root, out GameObject positionRoot, out UISlicedSprite hpBar, out UISlicedSprite recentDamage, out UISlicedSprite background, out UISlicedSprite barShadow, out UILabel monsterName)
        {
            root         = null;
            positionRoot = null;
            hpBar        = null;
            monsterName  = null;
            background   = null;
            barShadow    = null;
            recentDamage = null;
            if (s_Instance == null || owner == null || anchor == null || s_HPBarList.ContainsKey(owner))
            {
                return;
            }
            GameObject     gameObject     = NGUITools.AddChild(s_Instance.gameObject, s_Instance.m_hpBarPrefab);
            UIFollowTarget uifollowTarget = gameObject.AddComponent <UIFollowTarget>();

            uifollowTarget.target     = anchor;
            uifollowTarget.GameCamera = FXMainCamera.Instance.DefaultCamera.camera;
            uifollowTarget.UICamera   = GUIMainCamera.Instance.camera;
            HPBarViewData component = gameObject.GetComponent <HPBarViewData>();

            root         = gameObject;
            monsterName  = component.MonsterName;
            hpBar        = component.HpBar;
            background   = component.Background;
            barShadow    = component.BarShadow;
            recentDamage = component.RecentDamage;
            positionRoot = component.PositionRoot;
            s_HPBarList.Add(owner, gameObject);
        }
Example #2
0
 private void OnDestroy()
 {
     if (m_contollerMonster != null)
     {
         MonsterHPBarView contollerMonster = m_contollerMonster;
         contollerMonster.OnTooltipEvent = (EventHandler)Delegate.Remove(contollerMonster.OnTooltipEvent, new EventHandler(OnTooltip));
     }
     TooltipManager.Instance.Hide(this);
 }
Example #3
0
 public void OnMonsterAssigned(Object p_sender)
 {
     if (p_sender is MonsterHPBarView)
     {
         m_contollerMonster = (MonsterHPBarView)p_sender;
         MonsterHPBarView contollerMonster = m_contollerMonster;
         contollerMonster.OnTooltipEvent = (EventHandler)Delegate.Combine(contollerMonster.OnTooltipEvent, new EventHandler(OnTooltip));
     }
 }
Example #4
0
 public static Boolean CheckForCollision(MonsterHPBarView p_barToCheck)
 {
     foreach (MonsterHPBarView monsterHPBarView in s_positionedList)
     {
         if (p_barToCheck != monsterHPBarView && p_barToCheck.CheckCollision(monsterHPBarView))
         {
             return(true);
         }
     }
     return(false);
 }
Example #5
0
        public static void DestroyHPBar(MonsterHPBarView owner)
        {
            if (s_Instance == null || owner == null || !s_HPBarList.ContainsKey(owner))
            {
                return;
            }
            GameObject obj;

            if (s_HPBarList.TryGetValue(owner, out obj))
            {
                Destroy(obj);
                s_HPBarList.Remove(owner);
            }
            if (s_positionedList.Contains(owner))
            {
                s_positionedList.Remove(owner);
            }
        }
Example #6
0
 public static void AddForCollision(MonsterHPBarView p_barToAdd)
 {
     s_positionedList.Add(p_barToAdd);
 }