Esempio n. 1
0
    protected override void OnModuleMounted(Module module)
    {
        base.OnModuleMounted(module);

        bool found = false;

        for (int i = 0; i < displayedModuleTypes.Count; ++i)
        {
            if (module.ModuleType == displayedModuleTypes[i])
            {
                found = true;
                break;
            }
        }

        if (found)
        {
            HUDWeaponItem item = PoolManager.Instance.Get(itemPrefab.gameObject, Vector3.zero, Quaternion.identity, itemParent).GetComponent <HUDWeaponItem>();

            item.transform.localRotation = Quaternion.identity;
            item.transform.localPosition = Vector3.zero;
            item.transform.localScale    = new Vector3(1, 1, 1);

            DisplayedModule displayedModule = new DisplayedModule(module, item);

            item.SetLabel(module.Label);

            item.cooldownBar.gameObject.SetActive(false);
            CooldownTimer cooldownTimer = module.GetComponent <CooldownTimer>();
            if (cooldownTimer != null)
            {
                item.cooldownBar.gameObject.SetActive(true);
                cooldownTimer.onCooldownValueChanged.AddListener(item.cooldownBar.SetFillAmount);
            }

            displayedModules.Add(displayedModule);

            OrderItems();
        }
    }
Esempio n. 2
0
 public DisplayedModule(Module module, HUDWeaponItem displayItem)
 {
     this.module      = module;
     this.displayItem = displayItem;
 }