Ejemplo n.º 1
0
    public void ReplaceHealthBar(CharacterHealthBar newValue)
    {
        var index     = GameComponentsLookup.HealthBar;
        var component = (HealthBarComponent)CreateComponent(index, typeof(HealthBarComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Ejemplo n.º 2
0
 public void GenerateHealthBar()
 {
     foreach (var characterUnit in unitController.allCharacterUnit)
     {
         CharacterHealthBar go = Instantiate(healBarPrefab, Vector3.zero, Quaternion.identity, healthBarParent);
         go.Init(characterUnit, myRectTransform);
         go.GetComponent <RectTransform>().anchoredPosition = WorldToUI(myRectTransform, new Vector3(go.transform.position.x - 0.5f, go.transform.position.y - 0.5f, go.transform.position.z));
         if (characterUnit.tag.Contains("Player"))
         {
             StateUiController.InitTeamHealthUI(characterUnit);
         }
     }
 }