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

        mTransform.SetParent(CUIManager.GetInstance().GetTransform());
    }
Пример #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;
        }
    }
Пример #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());
    }
Пример #4
0
    public void OnEnemyAwake(CEnemy enemy)
    {
        mEnemy = enemy;

        CUIManager.GetInstance().OnUnitCreated(enemy);
    }
Пример #5
0
    public void OnPlayerAwake(CPlayer player)
    {
        mPlayer = player;

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