// Use this for initialization void Start() { mTransform = gameObject.GetComponent <RectTransform>(); mBarTransform = mBar.GetComponent <RectTransform>(); mTransform.SetParent(CUIManager.GetInstance().GetTransform()); }
public void OnUnitDestroyed(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: { mPlayer = null; Debug.Log("on player destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; case UNIT_TYPE.ENEMY: { mEnemy = null; Debug.Log("on enemy destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; } }
// Update is called once per frame void Update() { if (mTarget.GetStatus() == CUnit.UNIT_STATUS.US_DYING) { Destroy(gameObject); return; } Vector3 pos = mTarget.GetPos() * CGameScaller.GetInstance().GetScale(); pos -= CGameManager.GetInstance().GetPos(); pos.z = 1.0f; pos *= 1.0f / CUIManager.GetInstance().GetScaleFactor(); pos.y += 25; SetPos(pos.x, pos.y); SetValue(mTarget.GetHpPercent()); }
public void OnEnemyAwake(CEnemy enemy) { mEnemy = enemy; CUIManager.GetInstance().OnUnitCreated(enemy); }
public void OnPlayerAwake(CPlayer player) { mPlayer = player; CUIManager.GetInstance().OnUnitCreated(player); }