Exemple #1
0
    // Use this for initialization
    void Start()
    {
        mTransform    = gameObject.GetComponent <RectTransform>();
        mBarTransform = mBar.GetComponent <RectTransform>();

        mTransform.SetParent(CUIManager.GetInstance().GetTransform());
    }
Exemple #2
0
    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;
        }
    }
Exemple #3
0
    // 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());
    }
Exemple #4
0
    public void OnEnemyAwake(CEnemy enemy)
    {
        mEnemy = enemy;

        CUIManager.GetInstance().OnUnitCreated(enemy);
    }
Exemple #5
0
    public void OnPlayerAwake(CPlayer player)
    {
        mPlayer = player;

        CUIManager.GetInstance().OnUnitCreated(player);
    }