Ejemplo n.º 1
0
 public void UpdateAmmoCount(Dictionary <AmmunitionType, int> values)
 {
     foreach (AmmunitionType key in values.Keys)
     {
         AmmoInstanceVis vis = ammoVis[key];
         vis.UpdateValue(values[key]);
     }
 }
Ejemplo n.º 2
0
    public void InitAmmoCount(Dictionary <AmmunitionType, int> values)
    {
        ammoVis = new Dictionary <AmmunitionType, AmmoInstanceVis>();

        foreach (AmmunitionType key in values.Keys)
        {
            GameObject instance = Instantiate(AmmoInstancePrefab);
            instance.transform.SetParent(this.transform);
            instance.transform.localPosition = Vector2.zero;
            AmmoInstanceVis vis = instance.GetComponent <AmmoInstanceVis>();
            vis.Init(key.ToString(), values[key]);
            vis.ammoType = key;
            ammoVis.Add(key, vis);
        }
    }