Example #1
0
 private void GenerateVitalWeaponInfos()
 {
     _vitalWeaponInfos = new List <VitalWeaponInfo>();
     for (int i = 0; i < _hwManager.Rooms.Length; i++)
     {
         VitalWeaponInfo info = Instantiate
                                    (_vitalWeaponInfoPrefab, _vitalWeaponInfoParent);
         _vitalWeaponInfos.Add(info);
         info.gameObject.SetActive(false);
     }
 }
Example #2
0
        public VitalWeaponInfo ActivateWeaponInfo(WeaponMouse weapon)
        {
            VitalWeaponInfo activatedInfo = null;

            foreach (VitalWeaponInfo info in _vitalWeaponInfos)
            {
                if (!info.gameObject.activeSelf)
                {
                    info.SetWeapon(weapon);
                    info.transform.SetSiblingIndex(0);
                    info.gameObject.SetActive(true);
                    activatedInfo = info;
                    _activeVitalWeaponInfoCount++;
                    break;
                }
            }

            if (activatedInfo == null)
            {
                Debug.LogError("No more available VitalWeaponInfos.");
            }

            return(activatedInfo);
        }