Пример #1
0
    public bool PutStorage(IItemHouse _item, PutItemCanType _typeStorage)
    {
        switch (_typeStorage)
        {
        case PutItemCanType.Cloth:
            for (int i = 0; i < _clothStorage.Length; i++)
            {
                if (_clothStorage[i] == null)
                {
                    _clothStorage[i] = (ICloth)_item;
                    return(true);
                }
            }
            break;

        case PutItemCanType.Tool:
            for (int i = 0; i < _toolStorage.Length; i++)
            {
                if (_toolStorage[i] == null)
                {
                    _toolStorage[i] = (ITool)_item;
                    return(true);
                }
            }
            break;

        case PutItemCanType.Material:
            for (int i = 0; i < _materialStorage.Length; i++)
            {
                if (_materialStorage[i] == null)
                {
                    _materialStorage[i] = (IMaterialBuild)_item;
                    return(true);
                }
            }
            break;

        case PutItemCanType.Food:
            for (int i = 0; i < _foodStorage.Length; i++)
            {
                if (_foodStorage[i] == null)
                {
                    _foodStorage[i] = (IFood)_item;
                    return(true);
                }
            }
            break;
        }
        return(false);
    }
Пример #2
0
    public int SetMaxStoragePlace(PutItemCanType _type)
    {
        switch (_type)
        {
        case PutItemCanType.Cloth:
            return(_clothStorage.Length);

        case PutItemCanType.Food:
            return(_foodStorage.Length);

        case PutItemCanType.Material:
            return(_materialStorage.Length);

        case PutItemCanType.Tool:
            return(_toolStorage.Length);
        }
        return(0);
    }
Пример #3
0
    public IItemHouse GetStorage(PutItemCanType _typeStorage, int _id)
    {
        switch (_typeStorage)
        {
        case PutItemCanType.Cloth:
            return((IItemHouse)_clothStorage[_id]);

        case PutItemCanType.Tool:
            return((IItemHouse)_toolStorage[_id]);

        case PutItemCanType.Material:
            return((IItemHouse)_materialStorage[_id]);

        case PutItemCanType.Food:
            return((IItemHouse)_foodStorage[_id]);
        }
        return(null);
    }