Example #1
0
 public void OccupyStandPos(StandPos p, int id)
 {
     if (m_StandPos.ContainsKey(p))
     {
         m_StandPos[p] = id;
     }
 }
Example #2
0
 public void ReleaseStandPos(StandPos p)
 {
     if (m_StandPos.ContainsKey(p))
     {
         m_StandPos [p] = -1;
     }
 }
Example #3
0
 public void RegStandPos(StandPos p)
 {
     if (p != null && !m_StandPos.ContainsKey(p))
     {
         m_StandPos [p] = -1;
     }
 }
Example #4
0
    public virtual void Init(BattleUnit bu)
    {
        m_BattleUnit = bu;
        RegEvent();

        string res;

        if (bu.IsPlayerSide)
        {
            res = ConfigMng.Instance.GetConfig <ClientHeroCfg> ().HeroClientData [bu.OrgData.unit_id].res_path;
        }
        else
        {
            res = ConfigMng.Instance.GetConfig <ClientHeroCfg> ().MonsterClientData [bu.OrgData.unit_id].res_path;
        }

        m_ModelObj = CommonUtil.ResourceMng.Instance.GetResource(res, CommonUtil.ResourceType.Model) as GameObject;
        if (m_ModelObj == null)
        {
            CommonLogger.LogError("Model Can't loaded: " + res);
            return;
        }
        m_AniCtrl = m_ModelObj.GetComponent <Animator> ();

        StandPos p = GameHelper.Game.FindEmptyPos(bu.IsPlayerSide ? StandType.Player : StandType.Enemy);

        if (p != null)
        {
            m_ModelObj.transform.position      = p.transform.position;
            m_ModelObj.transform.localRotation = p.transform.localRotation;
            GameHelper.Game.OccupyStandPos(p, bu.OrgData.unit_id);
            m_StandPos = p;
            m_StandPos.SetTapHero(this);
        }

        InitTaps();

        m_BloodBar        = (UIManager.Instance.AddUI("UI/BloodBar") as GameObject).GetComponent <BloodBar>();
        m_StateProgress   = (UIManager.Instance.AddUI("UI/StateProgressBar") as GameObject).GetComponent <UIProgressBar>();
        m_EmpowerProgress = (UIManager.Instance.AddUI("UI/EmpowerProgressBar") as GameObject).GetComponent <UIProgressBar>();
        CheckStateProgressBarShow();
        UpdateBloodBarPos();
    }