Ejemplo n.º 1
0
    public static Building Load(BinaryReader reader)
    {
        BuildingType type           = (BuildingType)reader.ReadInt32();
        TriDirection entDir         = (TriDirection)reader.ReadInt32();
        bool         underconstruct = reader.ReadBoolean();
        bool         working        = reader.ReadBoolean();
        float        constructTime  = reader.ReadSingle();
        Building     ret            = null;

        switch (type)
        {
        case BuildingType.INN:
            ret = Inn.Load(reader);
            break;

        case BuildingType.COMPANY:
            ret = Company.Load(reader);
            break;

        case BuildingType.WORKSITE:
            ret = Worksite.Load(reader);
            break;
        }
        ret.entranceDirection = entDir;
        ret.type           = type;
        ret.UnderConstruct = underconstruct;
        ret.Working        = working;
        ret.ConstructTime  = constructTime;
        return(ret);
    }