예제 #1
0
    public void Add(Health health)
    {
        HealthDisplay display = Instantiate(displayPrefab, displaysHead);

        displays.Add(display);
        display.SetUp(health);
        display.SetNewData(health);

        health.onUpdated += OnHealthUpdate;
        health.onDead    += OnDead;
        LayoutRebuilder.MarkLayoutForRebuild(displaysHead.GetComponent <RectTransform>());
    }
예제 #2
0
    private void OnHealthUpdate(Health obj)
    {
        HealthDisplay display = displays.Find(o => o.IsOwner(obj));

        display.SetNewData(obj);
    }