public void onStart()
 {
     if (Dict != null)
     {
         foreach (Healthbar pair in Dict.Values)
         {
             Destroy(pair.gameObject);
         }
     }
     Dict = new Dictionary <GameObject, Healthbar>();
     if (characterPlacer.showhp)
     {
         GameObject[] units = inspector.getCurrentUnits();
         for (int i = 1; i <= units.Length; i++)
         {
             if (inspector.setScriptsFrom(units[i - 1]))
             {
                 GameObject obj = Instantiate(HpBar);
                 Healthbar  bar = obj.GetComponent <Healthbar>();
                 bar.SetDesc(inspector.getScriptType());
                 bar.SetColorTag(units[i - 1].tag);
                 bar.maximumHealth = inspector.getInitialLives();
                 obj.transform.SetParent(HpBarParent);
                 obj.transform.localPosition = new Vector3(87, i * (-34) - 38, 30);
                 obj.transform.localScale    = new Vector3(1f, 0.2f, 0.2f);
                 Dict.Add(units[i - 1], bar);
             }
         }
     }
 }
Пример #2
0
 /// <summary>set Debuginfo from given unit</summary>
 /// <param name="unit">lolsbarry</param>
 public void setFromUnit(GameObject unit)
 {
     if (i.setScriptsFrom(unit))
     {
         initialLives   = i.getInitialLives();
         currentLives   = i.getLives();
         defaultDammage = i.getDamage();
         attackTag      = i.getAttackTag();
         range          = i.getRange();
         unitType       = i.getScriptType();
         //needAction=i.getNeedAction();
     }
 }