Ejemplo n.º 1
0
        public WeaponComponent this[WeaponComponentHash componentHash]
        {
            get
            {
                if (_components.Contains(componentHash))
                {
                    WeaponComponent component = null;
                    if (!_weaponComponents.TryGetValue(componentHash, out component))
                    {
                        component = new WeaponComponent(_owner, _weapon, componentHash);
                        _weaponComponents.Add(componentHash, component);
                    }

                    return(component);
                }
                else
                {
                    return(_invalidComponent);
                }
            }
        }
Ejemplo n.º 2
0
        public WeaponComponent this[int index]
        {
            get
            {
                WeaponComponent component = null;
                if (index >= 0 && index < Count)
                {
                    WeaponComponentHash componentHash = _components[index];

                    if (!_weaponComponents.TryGetValue(componentHash, out component))
                    {
                        component = new WeaponComponent(_owner, _weapon, componentHash);
                        _weaponComponents.Add(componentHash, component);
                    }
                    return(component);
                }
                else
                {
                    return(_invalidComponent);
                }
            }
        }